> ## Documentation Index
> Fetch the complete documentation index at: https://interfere.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Consent

> Set browser capture permissions before startup and update them when visitors choose.

For Next.js, Vite + React, and TanStack Start, consent controls browser analytics and replay. These settings do not control server telemetry.

Without a `consent` option, the SDK runs with its configured defaults. To wait for a visitor's choice before starting analytics or replay, pass `false` to `init()`:

```ts instrumentation-client.ts theme={null}
import { init } from "@interfere/next/instrumentation-client";

await init({ consent: false });
```

For Vite + React and TanStack Start, import `init` from `@interfere/vite/init` in the browser entry point.

Set this before React renders. Passing consent only to the provider leaves a gap between initialization and the first render.

Consent describes what the visitor allows **right now**. The same values work in `init()`, the provider's `consent` prop, and `consent.set()`:

| Value | What it allows |
| - | - |
| `false` | Neither analytics nor replay |
| `true` | Both analytics and replay |
| `{ analytics: true, replay: false }` | Analytics only |

| Category | What it covers |
| - | - |
| `analytics` | Page events, rage clicks, device info |
| `replay` | Session replay |

## Update consent

Import `useInterfere` from `@interfere/next/provider` or `@interfere/vite/provider`. Update the decision when the visitor accepts, declines, or changes their preferences:

```tsx theme={null}
const { consent } = useInterfere();

consent.set(true);
```

Use `consent.set(false)` to withdraw both permissions, or pass an object for separate choices:

```tsx theme={null}
consent.set({ analytics: true, replay: false });
```

Each update replaces the previous decision. Omitted categories are allowed, so include both booleans when mapping choices from a consent platform such as c15t, CookieYes, or OneTrust.

You can also keep the decision synchronized through the provider:

```tsx theme={null}
<InterfereProvider consent={{ analytics: true, replay: false }}>{children}</InterfereProvider>
```

Omitting the provider's `consent` prop preserves the decision supplied to `init()` or updated at runtime. Calling `consent.set()` without a value removes consent restrictions; it does not record the visitor's acceptance.

> [!NOTE]
>
> Consent controls analytics and replay. It does not disable errors, logs, tracing, or session
> storage, and granting consent does not enable plugins disabled in configuration.

Configure [masking](/docs/sdk/replay-privacy.md) separately for content that must not appear in recordings.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.