From 5323231aff77942c3e32a723e72f2d3c9871bb4c Mon Sep 17 00:00:00 2001 From: Philip Snyder Date: Fri, 9 Oct 2026 12:58:19 -0400 Subject: [PATCH 1/2] docs: explain consent shorthand and startup decisions --- sdk/next-js.mdx | 56 +++++++++++++++++++++++++++++++++-------------- sdk/vite.mdx | 58 ++++++++++++++++++++++++++++++++++--------------- 2 files changed, 80 insertions(+), 34 deletions(-) diff --git a/sdk/next-js.mdx b/sdk/next-js.mdx index 38b63a3..b6f9d44 100644 --- a/sdk/next-js.mdx +++ b/sdk/next-js.mdx @@ -335,33 +335,57 @@ function SyncIdentity() { ## Consent -By default all features are active. To respect a cookie banner or privacy preference, pass `consent` to the provider. Once you do, only essential capture (error tracking and logs) plus the categories you opt into will run: +Without a `consent` option, the SDK runs with its configured defaults. To wait for a visitor's choice before starting analytics or replay, pass `"denied"` to `init()`: -```tsx app/layout.tsx -{children} +```ts instrumentation-client.ts +import { init } from "@interfere/next/instrumentation-client"; + +await init({ consent: "denied" }); ``` -| Category | What it covers | Gateable | -| ----------- | ------------------------------------- | --------- | -| `necessary` | Error tracking, logs | Always on | -| `analytics` | Page events, rage clicks, device info | Yes | -| `replay` | Session replay | Yes | +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()`: -Update consent at runtime through the same hook: +| Value | What it allows | +| ------------------------------------ | ---------------------------- | +| `"denied"` | Neither analytics nor replay | +| `"granted"` | 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 the decision when the visitor accepts, declines, or changes their preferences: ```tsx const { consent } = useInterfere(); -consent.set({ analytics: true, replay: true }); // selective -consent.set(); // grant everything +consent.set("granted"); ``` -Interfere works with any consent platform (c15t, CookieYes, OneTrust). Map its booleans to the categories above. +Use `consent.set("denied")` to withdraw both permissions, or pass an object for separate choices: + +```tsx +consent.set({ analytics: true, replay: false }); +``` - - Set the `consent` prop from the provider's first render so a non-consented feature never gets a - chance to load. Update it through the hook as the user changes their mind. - +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 +{children} +``` + +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. + + + 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. + ## Mask replay data diff --git a/sdk/vite.mdx b/sdk/vite.mdx index d22bf67..72e007d 100644 --- a/sdk/vite.mdx +++ b/sdk/vite.mdx @@ -245,35 +245,57 @@ function SyncIdentity() { ## Consent -Everything captures out of the box. To tie that to a cookie banner or a privacy choice, hand the provider a `consent` object. From then on only essential capture (error tracking and logs) runs, plus whichever categories you switch on: +Without a `consent` option, the SDK runs with its configured defaults. To wait for a visitor's choice before starting analytics or replay, pass `"denied"` to `init()`: -```tsx - - {/* your routes */} - +```ts src/main.tsx +import { init } from "@interfere/vite/init"; + +await init({ consent: "denied" }); ``` -| Category | What it covers | Gateable | -| ----------- | ------------------------------------- | --------- | -| `necessary` | Error tracking, logs | Always on | -| `analytics` | Page events, rage clicks, device info | Yes | -| `replay` | Session replay | Yes | +Set this before React renders. Passing consent only to the provider leaves a gap between initialization and the first render. -Update consent at runtime through the same hook: +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 | +| ------------------------------------ | ---------------------------- | +| `"denied"` | Neither analytics nor replay | +| `"granted"` | 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 the decision when the visitor accepts, declines, or changes their preferences: ```tsx const { consent } = useInterfere(); -consent.set({ analytics: true, replay: true }); // selective -consent.set(); // grant everything +consent.set("granted"); ``` -Interfere works with any consent platform (c15t, CookieYes, OneTrust). Map its booleans to the categories above. +Use `consent.set("denied")` to withdraw both permissions, or pass an object for separate choices: - - Set the `consent` prop from the provider's first render so a non-consented feature never gets a - chance to load. Update it through the hook as the user changes their mind. - +```tsx +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 +{children} +``` + +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. + + + 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. + ## Mask replay data From 2e6248cc5fb8e528f17eb9baff9aceb78d5e0144 Mon Sep 17 00:00:00 2001 From: Philip Snyder Date: Fri, 9 Oct 2026 15:10:06 -0400 Subject: [PATCH 2/2] docs: use boolean consent shorthand --- sdk/next-js.mdx | 12 ++++++------ sdk/vite.mdx | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sdk/next-js.mdx b/sdk/next-js.mdx index b6f9d44..bcff362 100644 --- a/sdk/next-js.mdx +++ b/sdk/next-js.mdx @@ -335,12 +335,12 @@ function SyncIdentity() { ## Consent -Without a `consent` option, the SDK runs with its configured defaults. To wait for a visitor's choice before starting analytics or replay, pass `"denied"` to `init()`: +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 import { init } from "@interfere/next/instrumentation-client"; -await init({ consent: "denied" }); +await init({ consent: false }); ``` Set this before React renders. Passing consent only to the provider leaves a gap between initialization and the first render. @@ -349,8 +349,8 @@ Consent describes what the visitor allows **right now**. The same values work in | Value | What it allows | | ------------------------------------ | ---------------------------- | -| `"denied"` | Neither analytics nor replay | -| `"granted"` | Both analytics and replay | +| `false` | Neither analytics nor replay | +| `true` | Both analytics and replay | | `{ analytics: true, replay: false }` | Analytics only | | Category | What it covers | @@ -363,10 +363,10 @@ Update the decision when the visitor accepts, declines, or changes their prefere ```tsx const { consent } = useInterfere(); -consent.set("granted"); +consent.set(true); ``` -Use `consent.set("denied")` to withdraw both permissions, or pass an object for separate choices: +Use `consent.set(false)` to withdraw both permissions, or pass an object for separate choices: ```tsx consent.set({ analytics: true, replay: false }); diff --git a/sdk/vite.mdx b/sdk/vite.mdx index 72e007d..ff4dfa4 100644 --- a/sdk/vite.mdx +++ b/sdk/vite.mdx @@ -245,12 +245,12 @@ function SyncIdentity() { ## Consent -Without a `consent` option, the SDK runs with its configured defaults. To wait for a visitor's choice before starting analytics or replay, pass `"denied"` to `init()`: +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 src/main.tsx import { init } from "@interfere/vite/init"; -await init({ consent: "denied" }); +await init({ consent: false }); ``` Set this before React renders. Passing consent only to the provider leaves a gap between initialization and the first render. @@ -259,8 +259,8 @@ Consent describes what the visitor allows **right now**. The same values work in | Value | What it allows | | ------------------------------------ | ---------------------------- | -| `"denied"` | Neither analytics nor replay | -| `"granted"` | Both analytics and replay | +| `false` | Neither analytics nor replay | +| `true` | Both analytics and replay | | `{ analytics: true, replay: false }` | Analytics only | | Category | What it covers | @@ -273,10 +273,10 @@ Update the decision when the visitor accepts, declines, or changes their prefere ```tsx const { consent } = useInterfere(); -consent.set("granted"); +consent.set(true); ``` -Use `consent.set("denied")` to withdraw both permissions, or pass an object for separate choices: +Use `consent.set(false)` to withdraw both permissions, or pass an object for separate choices: ```tsx consent.set({ analytics: true, replay: false });