@c15t/react 3.0.0-alpha.8 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +10 -12
- package/README.md +41 -70
- package/SKILL.md +1 -1
- package/dist/aggregate-components.js +1 -1
- package/dist/components/consent-gate/atoms.js +1 -1
- package/dist/components/consent-gate/frame.js +2 -0
- package/dist/components/consent-gate/index.js +1 -1
- package/dist/components/iab-panel/atoms/root.js +1 -1
- package/dist/components/iab-panel/iab-panel.js +1 -1
- package/dist/components/iab-prompt/atoms/root.js +1 -1
- package/dist/components/iab-prompt/iab-prompt.js +1 -1
- package/dist/components/panel/atoms/root.js +1 -1
- package/dist/components/panel-trigger/atoms/root.js +1 -1
- package/dist/components/panel-trigger/panel-trigger.js +1 -1
- package/dist/components/panel-trigger/toolbar-loader.js +2 -0
- package/dist/components/preferences/atoms/root.js +1 -1
- package/dist/components/prompt/atoms/early-tap-script.js +2 -0
- package/dist/components/prompt/atoms/root.js +1 -1
- package/dist/components/prompt/prompt.js +1 -1
- package/dist/components/shared/dialog-sheets.js +1 -0
- package/dist/components/shared/first-paint-sheets.js +1 -0
- package/dist/components/shared/iab-dialog-sheets.js +1 -0
- package/dist/components/shared/iab-first-paint-sheets.js +1 -0
- package/dist/components/shared/primitives/button.js +1 -1
- package/dist/components/shared/surface-styles.js +2 -0
- package/dist/consent-gate.js +1 -1
- package/dist/context/index.js +1 -1
- package/dist/devtools.js +1 -1
- package/dist/hooks/use-iab-policy-guard.js +1 -0
- package/dist/iab/styles.tw3.css +2 -2
- package/dist/iab-context.js +1 -1
- package/dist/iab-dialog-deferred.js +2 -0
- package/dist/iab.js +1 -1
- package/dist/index-parts/consent-gate.js +1 -1
- package/dist/index-parts/core.js +1 -1
- package/dist/index-parts/frame.js +1 -0
- package/dist/index-parts/hosted.js +1 -0
- package/dist/index-parts/offline.js +1 -0
- package/dist/index-parts/presets.js +1 -0
- package/dist/index.js +1 -1
- package/dist/modes.js +1 -0
- package/dist/panel-link.js +1 -1
- package/dist/panel-trigger.js +1 -1
- package/dist/provider.js +1 -1
- package/dist/styles.tw3.css +2 -2
- package/dist/transports/hosted.js +1 -0
- package/dist/transports/manifest.js +1 -0
- package/dist/utils/deferred-module.js +1 -1
- package/dist/version.js +1 -1
- package/dist-types/chunk-warming.d.ts +7 -6
- package/dist-types/components/consent-gate/frame.d.ts +19 -0
- package/dist-types/components/consent-gate/index.d.ts +3 -19
- package/dist-types/components/iab-prompt/iab-prompt.d.ts +1 -1
- package/dist-types/components/panel/index.d.ts +1 -1
- package/dist-types/components/panel-trigger/toolbar-loader.d.ts +34 -0
- package/dist-types/components/preferences/index.d.ts +1 -1
- package/dist-types/components/prompt/atoms/early-tap-script.d.ts +17 -0
- package/dist-types/components/prompt/index.d.ts +1 -1
- package/dist-types/components/shared/dialog-sheets.d.ts +9 -0
- package/dist-types/components/shared/first-paint-sheets.d.ts +8 -0
- package/dist-types/components/shared/iab-dialog-sheets.d.ts +3 -0
- package/dist-types/components/shared/iab-first-paint-sheets.d.ts +3 -0
- package/dist-types/components/shared/surface-styles.d.ts +60 -0
- package/dist-types/consent-gate.d.ts +1 -1
- package/dist-types/context/index.d.ts +3 -3
- package/dist-types/context.d.ts +2 -0
- package/dist-types/gpp.d.ts +1 -1
- package/dist-types/hooks/use-iab-policy-guard.d.ts +35 -0
- package/dist-types/iab-dialog-deferred.d.ts +36 -0
- package/dist-types/iab.d.ts +3 -2
- package/dist-types/index-parts/consent-gate.d.ts +1 -1
- package/dist-types/index-parts/core.d.ts +1 -2
- package/dist-types/index-parts/frame.d.ts +7 -0
- package/dist-types/index-parts/hosted.d.ts +7 -0
- package/dist-types/index-parts/offline.d.ts +7 -0
- package/dist-types/index-parts/presets.d.ts +7 -0
- package/dist-types/index.d.ts +5 -1
- package/dist-types/modes.d.ts +26 -0
- package/dist-types/panel-link.d.ts +1 -1
- package/dist-types/panel-trigger.d.ts +1 -1
- package/dist-types/provider.d.ts +22 -4
- package/dist-types/transports/hosted.d.ts +36 -0
- package/dist-types/transports/manifest.d.ts +48 -0
- package/dist-types/ui-config-context.d.ts +4 -0
- package/dist-types/version.d.ts +1 -1
- package/docs/README.md +10 -12
- package/docs/concepts/choose-your-setup.md +45 -8
- package/docs/concepts/consent-categories.md +1 -1
- package/docs/concepts/consent-state.md +5 -2
- package/docs/concepts/data-fetching.md +100 -40
- package/docs/concepts/modes.md +281 -0
- package/docs/customization/dark-mode.md +1 -1
- package/docs/customization/motion.md +2 -2
- package/docs/customization/overview.md +3 -2
- package/docs/customization/recipes.md +4 -4
- package/docs/customization/slots.md +25 -25
- package/docs/customization/stylesheets.md +161 -50
- package/docs/customization/tailwind.md +71 -50
- package/docs/customization/tokens.md +42 -13
- package/docs/frameworks/react/components/consent-banner.md +14 -12
- package/docs/frameworks/react/components/consent-dialog.md +15 -13
- package/docs/frameworks/react/components/consent-provider.md +51 -46
- package/docs/frameworks/react/components.md +16 -13
- package/docs/frameworks/react/compose.md +3 -3
- package/docs/frameworks/react/content-security-policy.md +35 -12
- package/docs/frameworks/react/customize.md +21 -13
- package/docs/frameworks/react/hooks.md +2 -2
- package/docs/frameworks/react/iab.md +56 -6
- package/docs/frameworks/react/quickstart.md +65 -99
- package/docs/frameworks/react/rendering.md +170 -94
- package/docs/frameworks/react/scripts.md +19 -30
- package/docs/frameworks/react/troubleshooting.md +100 -32
- package/docs/frameworks/react/upgrade-v3.md +133 -79
- package/docs/frameworks/react/vendor-consent.md +19 -7
- package/docs/guides/banner-experiments.md +21 -8
- package/docs/guides/troubleshooting.md +90 -26
- package/docs/guides/verify-consent.md +23 -8
- package/docs/integrations/adobe-analytics.md +60 -64
- package/docs/integrations/ahrefs-analytics.md +58 -63
- package/docs/integrations/amplitude.md +60 -64
- package/docs/integrations/clearbit.md +59 -63
- package/docs/integrations/cloudflare-web-analytics.md +56 -60
- package/docs/integrations/cloudflare-zaraz.md +55 -57
- package/docs/integrations/crisp.md +64 -69
- package/docs/integrations/databuddy.md +62 -64
- package/docs/integrations/fathom-analytics.md +56 -60
- package/docs/integrations/front-chat.md +56 -60
- package/docs/integrations/google-maps.md +25 -13
- package/docs/integrations/google-tag-manager.md +153 -77
- package/docs/integrations/google-tag.md +134 -78
- package/docs/integrations/heap.md +56 -60
- package/docs/integrations/hightouch.md +55 -60
- package/docs/integrations/hotjar.md +60 -64
- package/docs/integrations/intercom.md +55 -60
- package/docs/integrations/klaviyo.md +65 -66
- package/docs/integrations/linkedin-insights.md +58 -63
- package/docs/integrations/logrocket.md +55 -60
- package/docs/integrations/matomo-analytics.md +58 -60
- package/docs/integrations/meta-pixel.md +56 -60
- package/docs/integrations/microsoft-clarity.md +57 -60
- package/docs/integrations/microsoft-uet.md +58 -61
- package/docs/integrations/mixpanel-analytics.md +73 -75
- package/docs/integrations/one-dollar-stats.md +53 -59
- package/docs/integrations/openai-pixel.md +58 -60
- package/docs/integrations/overview.md +59 -42
- package/docs/integrations/pinterest-tag.md +56 -60
- package/docs/integrations/pirsch.md +54 -60
- package/docs/integrations/plausible-analytics.md +55 -60
- package/docs/integrations/posthog.md +56 -60
- package/docs/integrations/promptwatch.md +57 -63
- package/docs/integrations/reddit-pixel.md +57 -60
- package/docs/integrations/rudderstack.md +65 -67
- package/docs/integrations/rybbit-analytics.md +70 -75
- package/docs/integrations/segment.md +56 -60
- package/docs/integrations/sentry.md +65 -60
- package/docs/integrations/snapchat-pixel.md +54 -60
- package/docs/integrations/tiktok-pixel.md +59 -63
- package/docs/integrations/umami-analytics.md +54 -60
- package/docs/integrations/vercel-analytics.md +53 -59
- package/docs/integrations/vercel-speed-insights.md +317 -0
- package/docs/integrations/x-pixel.md +57 -63
- package/docs/integrations/youtube.md +25 -13
- package/package.json +18 -8
- package/docs/upgrade-v3.md +0 -429
|
@@ -3,21 +3,31 @@ title: Segment
|
|
|
3
3
|
description: Load Segment Analytics.js only after measurement consent with the
|
|
4
4
|
c15t segment helper, guard your own track and identify calls, and check it in
|
|
5
5
|
DevTools.
|
|
6
|
+
seoTitle: Segment cookie consent with c15t
|
|
7
|
+
seoDescription: Load Segment Analytics.js only with measurement consent. The
|
|
8
|
+
c15t segment helper sends the first page call after consent.
|
|
6
9
|
icon: segment
|
|
7
10
|
group: integrations
|
|
8
11
|
---
|
|
9
12
|
|
|
13
|
+
The c15t `segment` helper keeps Segment Analytics.js off the page until
|
|
14
|
+
`measurement` has consent. Until then, c15t does not create `window.analytics`.
|
|
15
|
+
When `measurement` has consent, the helper queues a `page()` call and loads
|
|
16
|
+
Analytics.js. The helper sends no consent signal to Segment. If the visitor
|
|
17
|
+
withdraws consent, c15t removes the script element. By default, c15t also
|
|
18
|
+
reloads the page.
|
|
19
|
+
|
|
10
20
|
## Configure Segment
|
|
11
21
|
|
|
12
22
|
Copy the write key of your Segment JavaScript source. The helper builds the
|
|
13
23
|
loader URL from it.
|
|
14
24
|
|
|
15
|
-
| Package manager | Command
|
|
16
|
-
| :-------------- |
|
|
17
|
-
| npm | `npm install @c15t/integrations
|
|
18
|
-
| pnpm | `pnpm add @c15t/integrations
|
|
19
|
-
| yarn | `yarn add @c15t/integrations
|
|
20
|
-
| bun | `bun add @c15t/integrations
|
|
25
|
+
| Package manager | Command |
|
|
26
|
+
| :-------------- | :------------------------------- |
|
|
27
|
+
| npm | `npm install @c15t/integrations` |
|
|
28
|
+
| pnpm | `pnpm add @c15t/integrations` |
|
|
29
|
+
| yarn | `yarn add @c15t/integrations` |
|
|
30
|
+
| bun | `bun add @c15t/integrations` |
|
|
21
31
|
|
|
22
32
|
```ts title="src/consent-scripts.ts"
|
|
23
33
|
import { segment } from '@c15t/integrations/segment';
|
|
@@ -32,51 +42,41 @@ endpoint, policy, styles and consent UI. Remove the vendor's original script,
|
|
|
32
42
|
SDK initializer or tag-manager entry, so the vendor loads only through c15t.
|
|
33
43
|
|
|
34
44
|
The vendor pages put the helper in `src/consent-scripts.ts`. If your framework
|
|
35
|
-
quickstart already
|
|
36
|
-
Next.js guide, add the helper to that array instead of creating a
|
|
45
|
+
quickstart already has a `scripts` array, such as the one in `c15t.config.ts`
|
|
46
|
+
in the Next.js guide, add the helper to that array instead of creating a
|
|
47
|
+
second file.
|
|
37
48
|
The `scripts` export is a configuration, not an initializer. Add it to the c15t provider you already have, at the registration
|
|
38
49
|
point for your framework below. These are edits to that provider, not a second
|
|
39
50
|
provider.
|
|
40
51
|
|
|
41
52
|
**Next.js**
|
|
42
53
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
```ts
|
|
46
|
-
import { ConsentRoot } from 'c15t/next';
|
|
47
|
-
import { scripts } from './consent-scripts';
|
|
48
|
-
```
|
|
54
|
+
Add the configuration to `scripts` in `c15t.config.ts`, next to
|
|
55
|
+
`next.config.ts`:
|
|
49
56
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
57
|
+
```ts title="c15t.config.ts"
|
|
58
|
+
import { defineConsentConfig } from 'c15t/next';
|
|
59
|
+
import { scripts } from './src/consent-scripts';
|
|
53
60
|
|
|
54
|
-
|
|
55
|
-
<ConsentRoot state={state} config={consentConfig} scripts={scripts}>
|
|
56
|
-
{children}
|
|
57
|
-
</ConsentRoot>
|
|
61
|
+
export default defineConsentConfig({ scripts });
|
|
58
62
|
```
|
|
59
63
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
64
|
+
Keep the rest of your config, such as `mode` and `routePrefix`, in the
|
|
65
|
+
same call. `ConsentRoot` reads the config in the browser, so the layout
|
|
66
|
+
keeps passing only `state`. App Router, Pages Router and static export all
|
|
67
|
+
read the same file. See
|
|
63
68
|
[Next.js scripts and embeds](https://c15t.com/docs/frameworks/next/scripts).
|
|
64
69
|
|
|
65
70
|
**TanStack Start**
|
|
66
71
|
|
|
67
72
|
Import the configuration into your root route and pass it to the existing
|
|
68
|
-
`ConsentRoot` as a top-level prop. Keep the loader
|
|
69
|
-
|
|
73
|
+
`ConsentRoot` as a top-level prop. Keep the loader from the
|
|
74
|
+
[TanStack Start quickstart](https://c15t.com/docs/frameworks/tanstack-start/quickstart):
|
|
70
75
|
|
|
71
76
|
```tsx title="src/routes/__root.tsx"
|
|
72
77
|
import { scripts } from '../consent-scripts';
|
|
73
78
|
|
|
74
|
-
<ConsentRoot
|
|
75
|
-
state={consent}
|
|
76
|
-
backendURL={backendURL}
|
|
77
|
-
initRoute={false}
|
|
78
|
-
scripts={scripts}
|
|
79
|
-
>
|
|
79
|
+
<ConsentRoot state={consent} scripts={scripts}>
|
|
80
80
|
```
|
|
81
81
|
|
|
82
82
|
Import vendor helpers in the root route module, not in a server function.
|
|
@@ -95,8 +95,8 @@ import { scripts } from './consent-scripts';
|
|
|
95
95
|
<ConsentProvider options={{ mode, scripts }}>
|
|
96
96
|
```
|
|
97
97
|
|
|
98
|
-
`mode` is the `
|
|
99
|
-
|
|
98
|
+
`mode` is the `manifest()` value from the
|
|
99
|
+
[React quickstart](../frameworks/react/quickstart.md). Keep the banner,
|
|
100
100
|
dialog and preferences link inside the provider. See
|
|
101
101
|
[React scripts and embeds](../frameworks/react/scripts.md).
|
|
102
102
|
|
|
@@ -125,15 +125,16 @@ callbacks. Write the vendor IDs into `consent-scripts.ts`. See
|
|
|
125
125
|
Pass the scripts to the existing `c15tVue` plugin call in `src/main.ts`:
|
|
126
126
|
|
|
127
127
|
```ts title="src/main.ts"
|
|
128
|
+
import { c15tVue, manifest } from 'c15t/vue/vue-plugin';
|
|
128
129
|
import { scripts } from './consent-scripts';
|
|
129
130
|
|
|
130
131
|
app.use(c15tVue, {
|
|
131
|
-
|
|
132
|
+
mode: manifest(),
|
|
132
133
|
scripts,
|
|
133
134
|
});
|
|
134
135
|
```
|
|
135
136
|
|
|
136
|
-
Keep your existing
|
|
137
|
+
Keep your existing `mode` and other options. The plugin starts one
|
|
137
138
|
script loader when the app mounts, after it has applied the visitor's stored
|
|
138
139
|
choice. Do not also call `createScriptLoader` from a component. See
|
|
139
140
|
[Vue scripts and embeds](https://c15t.com/docs/frameworks/vue/scripts).
|
|
@@ -141,12 +142,11 @@ choice. Do not also call `createScriptLoader` from a component. See
|
|
|
141
142
|
**Astro**
|
|
142
143
|
|
|
143
144
|
Add the scripts to the client entrypoint from the
|
|
144
|
-
[Astro quickstart](https://c15t.com/docs/frameworks/astro/quickstart),
|
|
145
|
-
integration
|
|
146
|
-
|
|
147
|
-
already exports scripts, combine the two arrays.
|
|
145
|
+
[Astro quickstart](https://c15t.com/docs/frameworks/astro/quickstart), `src/c15t.client.ts`,
|
|
146
|
+
which the integration finds on its own. Keep `astro.config.mjs` as it is.
|
|
147
|
+
If the module already exports scripts, combine the two arrays.
|
|
148
148
|
|
|
149
|
-
```ts title="src/
|
|
149
|
+
```ts title="src/c15t.client.ts"
|
|
150
150
|
import type { C15tClientOptionsExtension } from 'c15t/astro';
|
|
151
151
|
import { scripts } from './consent-scripts';
|
|
152
152
|
|
|
@@ -166,15 +166,13 @@ pass them as a top-level prop:
|
|
|
166
166
|
|
|
167
167
|
```svelte title="src/App.svelte"
|
|
168
168
|
<script lang="ts">
|
|
169
|
-
import {
|
|
169
|
+
import { ConsentProvider, manifest } from '@c15t/svelte';
|
|
170
170
|
import { scripts } from './consent-scripts';
|
|
171
|
-
|
|
172
|
-
const mode = hosted({ url: 'https://your-project.inth.app' });
|
|
173
171
|
</script>
|
|
174
172
|
|
|
175
|
-
<
|
|
173
|
+
<ConsentProvider mode={manifest()} {scripts}>
|
|
176
174
|
<!-- Keep your application, consent UI and preferences link here. -->
|
|
177
|
-
</
|
|
175
|
+
</ConsentProvider>
|
|
178
176
|
```
|
|
179
177
|
|
|
180
178
|
Retain the styles and consent UI from the [Svelte quickstart](https://c15t.com/docs/frameworks/svelte/quickstart).
|
|
@@ -182,22 +180,21 @@ The provider owns the loader and disposes it on unmount.
|
|
|
182
180
|
|
|
183
181
|
**SvelteKit**
|
|
184
182
|
|
|
185
|
-
Add the scripts to the existing root layout
|
|
186
|
-
and
|
|
183
|
+
Add the scripts to the existing `ConsentRoot` in the root layout. Keep the
|
|
184
|
+
handle and the layout load from the [SvelteKit quickstart](https://c15t.com/docs/frameworks/sveltekit/quickstart).
|
|
187
185
|
|
|
188
186
|
```svelte title="src/routes/+layout.svelte"
|
|
189
187
|
<script lang="ts">
|
|
190
|
-
import {
|
|
188
|
+
import { ConsentRoot } from '@c15t/svelte';
|
|
191
189
|
import { scripts } from '../consent-scripts';
|
|
192
190
|
|
|
193
191
|
let { children, data } = $props();
|
|
194
|
-
const mode = hosted({ url: 'https://your-project.inth.app' });
|
|
195
192
|
</script>
|
|
196
193
|
|
|
197
|
-
<
|
|
194
|
+
<ConsentRoot state={data.consent} {scripts}>
|
|
198
195
|
{@render children()}
|
|
199
196
|
<!-- Keep your consent UI and preferences link here. -->
|
|
200
|
-
</
|
|
197
|
+
</ConsentRoot>
|
|
201
198
|
```
|
|
202
199
|
|
|
203
200
|
Import vendor helpers in the layout component, not in `+layout.server.ts`:
|
|
@@ -224,20 +221,19 @@ to a pasted snippet. See [HTML scripts](https://c15t.com/docs/frameworks/html/sc
|
|
|
224
221
|
|
|
225
222
|
**JavaScript**
|
|
226
223
|
|
|
227
|
-
Pass the scripts to `init()` from `@c15t/browser`, next to your
|
|
228
|
-
URL:
|
|
224
|
+
Pass the scripts to `init()` from `@c15t/browser`, next to your mode:
|
|
229
225
|
|
|
230
226
|
```ts
|
|
231
|
-
import { init } from '@c15t/browser';
|
|
227
|
+
import { init, manifest } from '@c15t/browser';
|
|
232
228
|
import { scripts } from './consent-scripts';
|
|
233
229
|
|
|
234
230
|
const consent = init({
|
|
235
|
-
|
|
231
|
+
mode: manifest(),
|
|
236
232
|
scripts,
|
|
237
233
|
});
|
|
238
234
|
```
|
|
239
235
|
|
|
240
|
-
Keep the
|
|
236
|
+
Keep the mode from your quickstart. With
|
|
241
237
|
`createConsentRuntime` from `c15t/runtime`, pass `scripts` to it instead.
|
|
242
238
|
A kernel you create yourself needs a loader from
|
|
243
239
|
`c15t/modules/script-loader`. Attach one loader per kernel. See
|
|
@@ -247,7 +243,7 @@ A kernel you create yourself needs a loader from
|
|
|
247
243
|
|
|
248
244
|
| Option | Default | Behavior |
|
|
249
245
|
| --------------- | --------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
|
|
250
|
-
| `writeKey` | Required | Source write key. Empty or whitespace-only values
|
|
246
|
+
| `writeKey` | Required | Source write key. Empty or whitespace-only values log an error and the script does not load. |
|
|
251
247
|
| `loadOptions` | `{}` | Set as `window.analytics._loadOptions` before the loader runs. Analytics.js reads it on initialization. |
|
|
252
248
|
| `trackPageView` | `true` | Queues one `analytics.page()` call before the loader. Set `false` to send page views yourself. |
|
|
253
249
|
| `scriptUrl` | `https://cdn.segment.com/analytics.js/v1/<writeKey>/analytics.min.js` | Loader URL override. |
|
|
@@ -313,8 +309,8 @@ permission before each of your own event calls. The reload does not delete
|
|
|
313
309
|
cookies the vendor already set; see
|
|
314
310
|
[clear on revocation for your framework](./overview.md#vendor-switches-and-cookie-cleanup).
|
|
315
311
|
|
|
316
|
-
The helper
|
|
317
|
-
|
|
312
|
+
The helper lists its vendor by name in the preference dialog, so a visitor can
|
|
313
|
+
turn it off inside an allowed category. See
|
|
318
314
|
[vendor consent for your framework](./overview.md#vendor-switches-and-cookie-cleanup). The
|
|
319
315
|
[consent verification guide](../guides/verify-consent.md) covers navigation,
|
|
320
316
|
expiry and hosting checks.
|
|
@@ -2,22 +2,33 @@
|
|
|
2
2
|
title: Sentry
|
|
3
3
|
description: Configure Sentry's CDN or your own SDK with consent for error
|
|
4
4
|
monitoring, Session Replay and user data.
|
|
5
|
+
seoTitle: Sentry and Session Replay consent with c15t
|
|
6
|
+
seoDescription: Keep Sentry error reports free of user data, and load Session
|
|
7
|
+
Replay only with measurement consent. Set it up with the c15t sentry helper.
|
|
5
8
|
icon: sentry
|
|
6
9
|
group: integrations
|
|
7
10
|
---
|
|
8
11
|
|
|
12
|
+
With a `dsn` and the default `loadMode`, the c15t `sentry` helper loads the
|
|
13
|
+
Sentry CDN bundle on every page, before the visitor chooses. Sentry reports
|
|
14
|
+
errors under the `necessary` category. While `measurement` has no consent, error
|
|
15
|
+
events contain no user data, cookies, request headers, or inferred IP address.
|
|
16
|
+
Session Replay also waits until `measurement` has consent. It stops after the
|
|
17
|
+
visitor withdraws consent. With `loadMode: 'after-consent'`, Sentry runs only
|
|
18
|
+
while `measurement` has consent.
|
|
19
|
+
|
|
9
20
|
## Configure Sentry
|
|
10
21
|
|
|
11
22
|
Remove any existing Sentry Loader Script or CDN tags, then add this configuration.
|
|
12
23
|
Errors run before consent by default; Replay and SDK data collection wait for
|
|
13
24
|
`measurement`.
|
|
14
25
|
|
|
15
|
-
| Package manager | Command
|
|
16
|
-
| :-------------- |
|
|
17
|
-
| npm | `npm install @c15t/integrations
|
|
18
|
-
| pnpm | `pnpm add @c15t/integrations
|
|
19
|
-
| yarn | `yarn add @c15t/integrations
|
|
20
|
-
| bun | `bun add @c15t/integrations
|
|
26
|
+
| Package manager | Command |
|
|
27
|
+
| :-------------- | :------------------------------- |
|
|
28
|
+
| npm | `npm install @c15t/integrations` |
|
|
29
|
+
| pnpm | `pnpm add @c15t/integrations` |
|
|
30
|
+
| yarn | `yarn add @c15t/integrations` |
|
|
31
|
+
| bun | `bun add @c15t/integrations` |
|
|
21
32
|
|
|
22
33
|
```ts title="src/consent-scripts.ts"
|
|
23
34
|
import { sentry } from '@c15t/integrations/sentry';
|
|
@@ -39,6 +50,9 @@ The default SDK is 11.4.0 with subresource integrity: `bundle.min.js`, or
|
|
|
39
50
|
`bundle.tracing.min.js` when traces are sampled. `replay.min.js` loads after
|
|
40
51
|
consent when a Replay sample rate is above 0.
|
|
41
52
|
|
|
53
|
+
CDN URLs need an exact release version. Keep the default to use its integrity
|
|
54
|
+
hash, or set `version` to an exact release in the supported SDK range below.
|
|
55
|
+
|
|
42
56
|
## Register the scripts
|
|
43
57
|
|
|
44
58
|
Complete your [framework quickstart](https://c15t.com/docs/frameworks) first. Keep its Inth
|
|
@@ -46,51 +60,41 @@ endpoint, policy, styles and consent UI. Remove the vendor's original script,
|
|
|
46
60
|
SDK initializer or tag-manager entry, so the vendor loads only through c15t.
|
|
47
61
|
|
|
48
62
|
The vendor pages put the helper in `src/consent-scripts.ts`. If your framework
|
|
49
|
-
quickstart already
|
|
50
|
-
Next.js guide, add the helper to that array instead of creating a
|
|
63
|
+
quickstart already has a `scripts` array, such as the one in `c15t.config.ts`
|
|
64
|
+
in the Next.js guide, add the helper to that array instead of creating a
|
|
65
|
+
second file.
|
|
51
66
|
The `scripts` export is a configuration, not an initializer. Add it to the c15t provider you already have, at the registration
|
|
52
67
|
point for your framework below. These are edits to that provider, not a second
|
|
53
68
|
provider.
|
|
54
69
|
|
|
55
70
|
**Next.js**
|
|
56
71
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
```ts
|
|
60
|
-
import { ConsentRoot } from 'c15t/next';
|
|
61
|
-
import { scripts } from './consent-scripts';
|
|
62
|
-
```
|
|
72
|
+
Add the configuration to `scripts` in `c15t.config.ts`, next to
|
|
73
|
+
`next.config.ts`:
|
|
63
74
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
75
|
+
```ts title="c15t.config.ts"
|
|
76
|
+
import { defineConsentConfig } from 'c15t/next';
|
|
77
|
+
import { scripts } from './src/consent-scripts';
|
|
67
78
|
|
|
68
|
-
|
|
69
|
-
<ConsentRoot state={state} config={consentConfig} scripts={scripts}>
|
|
70
|
-
{children}
|
|
71
|
-
</ConsentRoot>
|
|
79
|
+
export default defineConsentConfig({ scripts });
|
|
72
80
|
```
|
|
73
81
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
82
|
+
Keep the rest of your config, such as `mode` and `routePrefix`, in the
|
|
83
|
+
same call. `ConsentRoot` reads the config in the browser, so the layout
|
|
84
|
+
keeps passing only `state`. App Router, Pages Router and static export all
|
|
85
|
+
read the same file. See
|
|
77
86
|
[Next.js scripts and embeds](https://c15t.com/docs/frameworks/next/scripts).
|
|
78
87
|
|
|
79
88
|
**TanStack Start**
|
|
80
89
|
|
|
81
90
|
Import the configuration into your root route and pass it to the existing
|
|
82
|
-
`ConsentRoot` as a top-level prop. Keep the loader
|
|
83
|
-
|
|
91
|
+
`ConsentRoot` as a top-level prop. Keep the loader from the
|
|
92
|
+
[TanStack Start quickstart](https://c15t.com/docs/frameworks/tanstack-start/quickstart):
|
|
84
93
|
|
|
85
94
|
```tsx title="src/routes/__root.tsx"
|
|
86
95
|
import { scripts } from '../consent-scripts';
|
|
87
96
|
|
|
88
|
-
<ConsentRoot
|
|
89
|
-
state={consent}
|
|
90
|
-
backendURL={backendURL}
|
|
91
|
-
initRoute={false}
|
|
92
|
-
scripts={scripts}
|
|
93
|
-
>
|
|
97
|
+
<ConsentRoot state={consent} scripts={scripts}>
|
|
94
98
|
```
|
|
95
99
|
|
|
96
100
|
Import vendor helpers in the root route module, not in a server function.
|
|
@@ -109,8 +113,8 @@ import { scripts } from './consent-scripts';
|
|
|
109
113
|
<ConsentProvider options={{ mode, scripts }}>
|
|
110
114
|
```
|
|
111
115
|
|
|
112
|
-
`mode` is the `
|
|
113
|
-
|
|
116
|
+
`mode` is the `manifest()` value from the
|
|
117
|
+
[React quickstart](../frameworks/react/quickstart.md). Keep the banner,
|
|
114
118
|
dialog and preferences link inside the provider. See
|
|
115
119
|
[React scripts and embeds](../frameworks/react/scripts.md).
|
|
116
120
|
|
|
@@ -139,15 +143,16 @@ callbacks. Write the vendor IDs into `consent-scripts.ts`. See
|
|
|
139
143
|
Pass the scripts to the existing `c15tVue` plugin call in `src/main.ts`:
|
|
140
144
|
|
|
141
145
|
```ts title="src/main.ts"
|
|
146
|
+
import { c15tVue, manifest } from 'c15t/vue/vue-plugin';
|
|
142
147
|
import { scripts } from './consent-scripts';
|
|
143
148
|
|
|
144
149
|
app.use(c15tVue, {
|
|
145
|
-
|
|
150
|
+
mode: manifest(),
|
|
146
151
|
scripts,
|
|
147
152
|
});
|
|
148
153
|
```
|
|
149
154
|
|
|
150
|
-
Keep your existing
|
|
155
|
+
Keep your existing `mode` and other options. The plugin starts one
|
|
151
156
|
script loader when the app mounts, after it has applied the visitor's stored
|
|
152
157
|
choice. Do not also call `createScriptLoader` from a component. See
|
|
153
158
|
[Vue scripts and embeds](https://c15t.com/docs/frameworks/vue/scripts).
|
|
@@ -155,12 +160,11 @@ choice. Do not also call `createScriptLoader` from a component. See
|
|
|
155
160
|
**Astro**
|
|
156
161
|
|
|
157
162
|
Add the scripts to the client entrypoint from the
|
|
158
|
-
[Astro quickstart](https://c15t.com/docs/frameworks/astro/quickstart),
|
|
159
|
-
integration
|
|
160
|
-
|
|
161
|
-
already exports scripts, combine the two arrays.
|
|
163
|
+
[Astro quickstart](https://c15t.com/docs/frameworks/astro/quickstart), `src/c15t.client.ts`,
|
|
164
|
+
which the integration finds on its own. Keep `astro.config.mjs` as it is.
|
|
165
|
+
If the module already exports scripts, combine the two arrays.
|
|
162
166
|
|
|
163
|
-
```ts title="src/
|
|
167
|
+
```ts title="src/c15t.client.ts"
|
|
164
168
|
import type { C15tClientOptionsExtension } from 'c15t/astro';
|
|
165
169
|
import { scripts } from './consent-scripts';
|
|
166
170
|
|
|
@@ -180,15 +184,13 @@ pass them as a top-level prop:
|
|
|
180
184
|
|
|
181
185
|
```svelte title="src/App.svelte"
|
|
182
186
|
<script lang="ts">
|
|
183
|
-
import {
|
|
187
|
+
import { ConsentProvider, manifest } from '@c15t/svelte';
|
|
184
188
|
import { scripts } from './consent-scripts';
|
|
185
|
-
|
|
186
|
-
const mode = hosted({ url: 'https://your-project.inth.app' });
|
|
187
189
|
</script>
|
|
188
190
|
|
|
189
|
-
<
|
|
191
|
+
<ConsentProvider mode={manifest()} {scripts}>
|
|
190
192
|
<!-- Keep your application, consent UI and preferences link here. -->
|
|
191
|
-
</
|
|
193
|
+
</ConsentProvider>
|
|
192
194
|
```
|
|
193
195
|
|
|
194
196
|
Retain the styles and consent UI from the [Svelte quickstart](https://c15t.com/docs/frameworks/svelte/quickstart).
|
|
@@ -196,22 +198,21 @@ The provider owns the loader and disposes it on unmount.
|
|
|
196
198
|
|
|
197
199
|
**SvelteKit**
|
|
198
200
|
|
|
199
|
-
Add the scripts to the existing root layout
|
|
200
|
-
and
|
|
201
|
+
Add the scripts to the existing `ConsentRoot` in the root layout. Keep the
|
|
202
|
+
handle and the layout load from the [SvelteKit quickstart](https://c15t.com/docs/frameworks/sveltekit/quickstart).
|
|
201
203
|
|
|
202
204
|
```svelte title="src/routes/+layout.svelte"
|
|
203
205
|
<script lang="ts">
|
|
204
|
-
import {
|
|
206
|
+
import { ConsentRoot } from '@c15t/svelte';
|
|
205
207
|
import { scripts } from '../consent-scripts';
|
|
206
208
|
|
|
207
209
|
let { children, data } = $props();
|
|
208
|
-
const mode = hosted({ url: 'https://your-project.inth.app' });
|
|
209
210
|
</script>
|
|
210
211
|
|
|
211
|
-
<
|
|
212
|
+
<ConsentRoot state={data.consent} {scripts}>
|
|
212
213
|
{@render children()}
|
|
213
214
|
<!-- Keep your consent UI and preferences link here. -->
|
|
214
|
-
</
|
|
215
|
+
</ConsentRoot>
|
|
215
216
|
```
|
|
216
217
|
|
|
217
218
|
Import vendor helpers in the layout component, not in `+layout.server.ts`:
|
|
@@ -238,20 +239,19 @@ to a pasted snippet. See [HTML scripts](https://c15t.com/docs/frameworks/html/sc
|
|
|
238
239
|
|
|
239
240
|
**JavaScript**
|
|
240
241
|
|
|
241
|
-
Pass the scripts to `init()` from `@c15t/browser`, next to your
|
|
242
|
-
URL:
|
|
242
|
+
Pass the scripts to `init()` from `@c15t/browser`, next to your mode:
|
|
243
243
|
|
|
244
244
|
```ts
|
|
245
|
-
import { init } from '@c15t/browser';
|
|
245
|
+
import { init, manifest } from '@c15t/browser';
|
|
246
246
|
import { scripts } from './consent-scripts';
|
|
247
247
|
|
|
248
248
|
const consent = init({
|
|
249
|
-
|
|
249
|
+
mode: manifest(),
|
|
250
250
|
scripts,
|
|
251
251
|
});
|
|
252
252
|
```
|
|
253
253
|
|
|
254
|
-
Keep the
|
|
254
|
+
Keep the mode from your quickstart. With
|
|
255
255
|
`createConsentRuntime` from `c15t/runtime`, pass `scripts` to it instead.
|
|
256
256
|
A kernel you create yourself needs a loader from
|
|
257
257
|
`c15t/modules/script-loader`. Attach one loader per kernel. See
|
|
@@ -259,8 +259,13 @@ A kernel you create yourself needs a loader from
|
|
|
259
259
|
|
|
260
260
|
## Use your own Sentry SDK
|
|
261
261
|
|
|
262
|
-
|
|
263
|
-
|
|
262
|
+
The supported browser SDK range is `^10.67.0 || ^11.0.0`, including framework
|
|
263
|
+
SDKs built on those versions. Version 10.67.0 added Replay's
|
|
264
|
+
`stop({ flush: false })`, which c15t uses to discard pending recordings when
|
|
265
|
+
consent is withdrawn. Earlier versions flush those recordings when stopping.
|
|
266
|
+
|
|
267
|
+
Pass your SDK's functions instead of `dsn`. Keep Replay in a separate module
|
|
268
|
+
so it can load after consent:
|
|
264
269
|
|
|
265
270
|
```ts title="src/sentry-replay.ts"
|
|
266
271
|
import { replayIntegration } from '@sentry/browser';
|
|
@@ -336,7 +341,7 @@ and metrics.
|
|
|
336
341
|
|
|
337
342
|
| Option | Default | Behavior |
|
|
338
343
|
| ----------------- | ------------------------------------ | ----------------------------------------------------------------------------------------------------------------------- |
|
|
339
|
-
| `dsn` | Required to load Sentry | Your project's DSN. c15t loads the SDK and calls `Sentry.init`.
|
|
344
|
+
| `dsn` | Required to load Sentry | Your project's DSN. c15t loads the SDK and calls `Sentry.init`. A blank DSN logs an error and the script does not load. |
|
|
340
345
|
| `initOptions` | `{}` | Passed to `Sentry.init` with c15t's consent integration first. CDN `integrations` callbacks can access `window.Sentry`. |
|
|
341
346
|
| `version` | `'11.4.0'` | SDK version to load. Another version loads without subresource integrity. |
|
|
342
347
|
| `tracing` | `true` when traces are sampled | Loads the tracing bundle and adds `browserTracingIntegration()`. |
|