@c15t/react 3.0.0-alpha.9 → 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 +7 -9
- 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/shared/primitives/button.js +1 -1
- package/dist/components/shared/surface-styles.js +1 -1
- package/dist/consent-gate.js +1 -1
- package/dist/context/index.js +1 -1
- package/dist/devtools.js +1 -1
- package/dist/iab/styles.tw3.css +2 -2
- 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/surface-styles.d.ts +26 -2
- 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/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 +3 -3
- package/dist-types/transports/hosted.d.ts +36 -0
- package/dist-types/transports/manifest.d.ts +48 -0
- package/dist-types/version.d.ts +1 -1
- package/docs/README.md +7 -9
- package/docs/concepts/choose-your-setup.md +45 -10
- package/docs/concepts/consent-categories.md +1 -1
- package/docs/concepts/consent-state.md +5 -2
- package/docs/concepts/data-fetching.md +100 -42
- 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/recipes.md +4 -4
- package/docs/customization/slots.md +25 -25
- package/docs/customization/stylesheets.md +12 -14
- package/docs/customization/tailwind.md +17 -11
- package/docs/customization/tokens.md +36 -7
- package/docs/frameworks/react/components/consent-banner.md +14 -10
- package/docs/frameworks/react/components/consent-dialog.md +14 -10
- package/docs/frameworks/react/components/consent-provider.md +51 -44
- package/docs/frameworks/react/components.md +14 -10
- package/docs/frameworks/react/content-security-policy.md +21 -12
- package/docs/frameworks/react/hooks.md +2 -2
- package/docs/frameworks/react/iab.md +20 -2
- package/docs/frameworks/react/quickstart.md +63 -97
- package/docs/frameworks/react/rendering.md +168 -94
- package/docs/frameworks/react/scripts.md +19 -28
- package/docs/frameworks/react/troubleshooting.md +57 -25
- package/docs/frameworks/react/upgrade-v3.md +110 -62
- package/docs/guides/banner-experiments.md +21 -6
- package/docs/guides/troubleshooting.md +89 -25
- 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,10 +3,22 @@ title: Cloudflare Zaraz
|
|
|
3
3
|
description: Sync c15t permissions to Cloudflare Zaraz purposes with the c15t
|
|
4
4
|
cloudflareZaraz bridge, which runs on every page without loading a script, and
|
|
5
5
|
check the tools it controls.
|
|
6
|
+
seoTitle: Cloudflare Zaraz consent with c15t
|
|
7
|
+
seoDescription: Connect your cookie banner to Cloudflare Zaraz. The c15t
|
|
8
|
+
cloudflareZaraz helper turns on each Zaraz purpose only while its c15t
|
|
9
|
+
category has consent.
|
|
6
10
|
icon: cloudflare-web-analytics
|
|
7
11
|
group: integrations
|
|
8
12
|
---
|
|
9
13
|
|
|
14
|
+
The c15t `cloudflareZaraz` helper connects c15t consent to Cloudflare Zaraz
|
|
15
|
+
under the `necessary` category. The helper loads no script. Cloudflare loads
|
|
16
|
+
Zaraz and its tools for every visitor, so the Zaraz purposes control which tools
|
|
17
|
+
run. When the Zaraz consent API is ready, the helper calls
|
|
18
|
+
`zaraz.consent.set()`. A purpose is `true` only while the c15t category that you
|
|
19
|
+
map to it in `purposes` has consent. When a purpose changes to `true`, the
|
|
20
|
+
helper calls `zaraz.consent.sendQueuedEvents()`.
|
|
21
|
+
|
|
10
22
|
## Configure Cloudflare Zaraz
|
|
11
23
|
|
|
12
24
|
`cloudflareZaraz` connects c15t to an existing Zaraz installation. It inserts
|
|
@@ -30,12 +42,12 @@ Zaraz can still run before the bridge starts; audit them. Cloudflare documents
|
|
|
30
42
|
[purpose assignment](https://developers.cloudflare.com/zaraz/consent-management/)
|
|
31
43
|
and [pageview settings](https://developers.cloudflare.com/zaraz/reference/settings/).
|
|
32
44
|
|
|
33
|
-
| Package manager | Command
|
|
34
|
-
| :-------------- |
|
|
35
|
-
| npm | `npm install @c15t/integrations
|
|
36
|
-
| pnpm | `pnpm add @c15t/integrations
|
|
37
|
-
| yarn | `yarn add @c15t/integrations
|
|
38
|
-
| bun | `bun add @c15t/integrations
|
|
45
|
+
| Package manager | Command |
|
|
46
|
+
| :-------------- | :------------------------------- |
|
|
47
|
+
| npm | `npm install @c15t/integrations` |
|
|
48
|
+
| pnpm | `pnpm add @c15t/integrations` |
|
|
49
|
+
| yarn | `yarn add @c15t/integrations` |
|
|
50
|
+
| bun | `bun add @c15t/integrations` |
|
|
39
51
|
|
|
40
52
|
```ts title="src/consent-scripts.ts"
|
|
41
53
|
import { cloudflareZaraz } from '@c15t/integrations/cloudflare-zaraz';
|
|
@@ -70,51 +82,41 @@ endpoint, policy, styles and consent UI. Remove the vendor's original script,
|
|
|
70
82
|
SDK initializer or tag-manager entry, so the vendor loads only through c15t.
|
|
71
83
|
|
|
72
84
|
The vendor pages put the helper in `src/consent-scripts.ts`. If your framework
|
|
73
|
-
quickstart already
|
|
74
|
-
Next.js guide, add the helper to that array instead of creating a
|
|
85
|
+
quickstart already has a `scripts` array, such as the one in `c15t.config.ts`
|
|
86
|
+
in the Next.js guide, add the helper to that array instead of creating a
|
|
87
|
+
second file.
|
|
75
88
|
The `scripts` export is a configuration, not an initializer. Add it to the c15t provider you already have, at the registration
|
|
76
89
|
point for your framework below. These are edits to that provider, not a second
|
|
77
90
|
provider.
|
|
78
91
|
|
|
79
92
|
**Next.js**
|
|
80
93
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
```ts
|
|
84
|
-
import { ConsentRoot } from 'c15t/next';
|
|
85
|
-
import { scripts } from './consent-scripts';
|
|
86
|
-
```
|
|
94
|
+
Add the configuration to `scripts` in `c15t.config.ts`, next to
|
|
95
|
+
`next.config.ts`:
|
|
87
96
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
97
|
+
```ts title="c15t.config.ts"
|
|
98
|
+
import { defineConsentConfig } from 'c15t/next';
|
|
99
|
+
import { scripts } from './src/consent-scripts';
|
|
91
100
|
|
|
92
|
-
|
|
93
|
-
<ConsentRoot state={state} config={consentConfig} scripts={scripts}>
|
|
94
|
-
{children}
|
|
95
|
-
</ConsentRoot>
|
|
101
|
+
export default defineConsentConfig({ scripts });
|
|
96
102
|
```
|
|
97
103
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
104
|
+
Keep the rest of your config, such as `mode` and `routePrefix`, in the
|
|
105
|
+
same call. `ConsentRoot` reads the config in the browser, so the layout
|
|
106
|
+
keeps passing only `state`. App Router, Pages Router and static export all
|
|
107
|
+
read the same file. See
|
|
101
108
|
[Next.js scripts and embeds](https://c15t.com/docs/frameworks/next/scripts).
|
|
102
109
|
|
|
103
110
|
**TanStack Start**
|
|
104
111
|
|
|
105
112
|
Import the configuration into your root route and pass it to the existing
|
|
106
|
-
`ConsentRoot` as a top-level prop. Keep the loader
|
|
107
|
-
|
|
113
|
+
`ConsentRoot` as a top-level prop. Keep the loader from the
|
|
114
|
+
[TanStack Start quickstart](https://c15t.com/docs/frameworks/tanstack-start/quickstart):
|
|
108
115
|
|
|
109
116
|
```tsx title="src/routes/__root.tsx"
|
|
110
117
|
import { scripts } from '../consent-scripts';
|
|
111
118
|
|
|
112
|
-
<ConsentRoot
|
|
113
|
-
state={consent}
|
|
114
|
-
backendURL={backendURL}
|
|
115
|
-
initRoute={false}
|
|
116
|
-
scripts={scripts}
|
|
117
|
-
>
|
|
119
|
+
<ConsentRoot state={consent} scripts={scripts}>
|
|
118
120
|
```
|
|
119
121
|
|
|
120
122
|
Import vendor helpers in the root route module, not in a server function.
|
|
@@ -133,8 +135,8 @@ import { scripts } from './consent-scripts';
|
|
|
133
135
|
<ConsentProvider options={{ mode, scripts }}>
|
|
134
136
|
```
|
|
135
137
|
|
|
136
|
-
`mode` is the `
|
|
137
|
-
|
|
138
|
+
`mode` is the `manifest()` value from the
|
|
139
|
+
[React quickstart](../frameworks/react/quickstart.md). Keep the banner,
|
|
138
140
|
dialog and preferences link inside the provider. See
|
|
139
141
|
[React scripts and embeds](../frameworks/react/scripts.md).
|
|
140
142
|
|
|
@@ -163,15 +165,16 @@ callbacks. Write the vendor IDs into `consent-scripts.ts`. See
|
|
|
163
165
|
Pass the scripts to the existing `c15tVue` plugin call in `src/main.ts`:
|
|
164
166
|
|
|
165
167
|
```ts title="src/main.ts"
|
|
168
|
+
import { c15tVue, manifest } from 'c15t/vue/vue-plugin';
|
|
166
169
|
import { scripts } from './consent-scripts';
|
|
167
170
|
|
|
168
171
|
app.use(c15tVue, {
|
|
169
|
-
|
|
172
|
+
mode: manifest(),
|
|
170
173
|
scripts,
|
|
171
174
|
});
|
|
172
175
|
```
|
|
173
176
|
|
|
174
|
-
Keep your existing
|
|
177
|
+
Keep your existing `mode` and other options. The plugin starts one
|
|
175
178
|
script loader when the app mounts, after it has applied the visitor's stored
|
|
176
179
|
choice. Do not also call `createScriptLoader` from a component. See
|
|
177
180
|
[Vue scripts and embeds](https://c15t.com/docs/frameworks/vue/scripts).
|
|
@@ -179,12 +182,11 @@ choice. Do not also call `createScriptLoader` from a component. See
|
|
|
179
182
|
**Astro**
|
|
180
183
|
|
|
181
184
|
Add the scripts to the client entrypoint from the
|
|
182
|
-
[Astro quickstart](https://c15t.com/docs/frameworks/astro/quickstart),
|
|
183
|
-
integration
|
|
184
|
-
|
|
185
|
-
already exports scripts, combine the two arrays.
|
|
185
|
+
[Astro quickstart](https://c15t.com/docs/frameworks/astro/quickstart), `src/c15t.client.ts`,
|
|
186
|
+
which the integration finds on its own. Keep `astro.config.mjs` as it is.
|
|
187
|
+
If the module already exports scripts, combine the two arrays.
|
|
186
188
|
|
|
187
|
-
```ts title="src/
|
|
189
|
+
```ts title="src/c15t.client.ts"
|
|
188
190
|
import type { C15tClientOptionsExtension } from 'c15t/astro';
|
|
189
191
|
import { scripts } from './consent-scripts';
|
|
190
192
|
|
|
@@ -204,15 +206,13 @@ pass them as a top-level prop:
|
|
|
204
206
|
|
|
205
207
|
```svelte title="src/App.svelte"
|
|
206
208
|
<script lang="ts">
|
|
207
|
-
import {
|
|
209
|
+
import { ConsentProvider, manifest } from '@c15t/svelte';
|
|
208
210
|
import { scripts } from './consent-scripts';
|
|
209
|
-
|
|
210
|
-
const mode = hosted({ url: 'https://your-project.inth.app' });
|
|
211
211
|
</script>
|
|
212
212
|
|
|
213
|
-
<
|
|
213
|
+
<ConsentProvider mode={manifest()} {scripts}>
|
|
214
214
|
<!-- Keep your application, consent UI and preferences link here. -->
|
|
215
|
-
</
|
|
215
|
+
</ConsentProvider>
|
|
216
216
|
```
|
|
217
217
|
|
|
218
218
|
Retain the styles and consent UI from the [Svelte quickstart](https://c15t.com/docs/frameworks/svelte/quickstart).
|
|
@@ -220,22 +220,21 @@ The provider owns the loader and disposes it on unmount.
|
|
|
220
220
|
|
|
221
221
|
**SvelteKit**
|
|
222
222
|
|
|
223
|
-
Add the scripts to the existing root layout
|
|
224
|
-
and
|
|
223
|
+
Add the scripts to the existing `ConsentRoot` in the root layout. Keep the
|
|
224
|
+
handle and the layout load from the [SvelteKit quickstart](https://c15t.com/docs/frameworks/sveltekit/quickstart).
|
|
225
225
|
|
|
226
226
|
```svelte title="src/routes/+layout.svelte"
|
|
227
227
|
<script lang="ts">
|
|
228
|
-
import {
|
|
228
|
+
import { ConsentRoot } from '@c15t/svelte';
|
|
229
229
|
import { scripts } from '../consent-scripts';
|
|
230
230
|
|
|
231
231
|
let { children, data } = $props();
|
|
232
|
-
const mode = hosted({ url: 'https://your-project.inth.app' });
|
|
233
232
|
</script>
|
|
234
233
|
|
|
235
|
-
<
|
|
234
|
+
<ConsentRoot state={data.consent} {scripts}>
|
|
236
235
|
{@render children()}
|
|
237
236
|
<!-- Keep your consent UI and preferences link here. -->
|
|
238
|
-
</
|
|
237
|
+
</ConsentRoot>
|
|
239
238
|
```
|
|
240
239
|
|
|
241
240
|
Import vendor helpers in the layout component, not in `+layout.server.ts`:
|
|
@@ -262,20 +261,19 @@ to a pasted snippet. See [HTML scripts](https://c15t.com/docs/frameworks/html/sc
|
|
|
262
261
|
|
|
263
262
|
**JavaScript**
|
|
264
263
|
|
|
265
|
-
Pass the scripts to `init()` from `@c15t/browser`, next to your
|
|
266
|
-
URL:
|
|
264
|
+
Pass the scripts to `init()` from `@c15t/browser`, next to your mode:
|
|
267
265
|
|
|
268
266
|
```ts
|
|
269
|
-
import { init } from '@c15t/browser';
|
|
267
|
+
import { init, manifest } from '@c15t/browser';
|
|
270
268
|
import { scripts } from './consent-scripts';
|
|
271
269
|
|
|
272
270
|
const consent = init({
|
|
273
|
-
|
|
271
|
+
mode: manifest(),
|
|
274
272
|
scripts,
|
|
275
273
|
});
|
|
276
274
|
```
|
|
277
275
|
|
|
278
|
-
Keep the
|
|
276
|
+
Keep the mode from your quickstart. With
|
|
279
277
|
`createConsentRuntime` from `c15t/runtime`, pass `scripts` to it instead.
|
|
280
278
|
A kernel you create yourself needs a loader from
|
|
281
279
|
`c15t/modules/script-loader`. Attach one loader per kernel. See
|
|
@@ -2,21 +2,30 @@
|
|
|
2
2
|
title: Crisp
|
|
3
3
|
description: Load the Crisp chat widget only after functionality consent with
|
|
4
4
|
the c15t crisp helper, pass its runtime settings and check it in DevTools.
|
|
5
|
+
seoTitle: Crisp chat cookie consent with c15t
|
|
6
|
+
seoDescription: Show the Crisp chat widget only with functionality consent. Set
|
|
7
|
+
it up with the c15t crisp helper and check it in DevTools.
|
|
5
8
|
icon: crisp
|
|
6
9
|
group: integrations
|
|
7
10
|
---
|
|
8
11
|
|
|
12
|
+
The c15t `crisp` helper keeps the Crisp chat widget off the page until
|
|
13
|
+
`functionality` has consent. Until then, c15t does not set
|
|
14
|
+
`window.CRISP_WEBSITE_ID`, so no chat widget shows. If the visitor withdraws
|
|
15
|
+
consent, c15t removes the script element. The widget stays on the page until
|
|
16
|
+
c15t reloads the page, which c15t does by default.
|
|
17
|
+
|
|
9
18
|
## Configure Crisp
|
|
10
19
|
|
|
11
20
|
Copy the website ID from your Crisp installation snippet, where it is assigned
|
|
12
21
|
to `CRISP_WEBSITE_ID`.
|
|
13
22
|
|
|
14
|
-
| Package manager | Command
|
|
15
|
-
| :-------------- |
|
|
16
|
-
| npm | `npm install @c15t/integrations
|
|
17
|
-
| pnpm | `pnpm add @c15t/integrations
|
|
18
|
-
| yarn | `yarn add @c15t/integrations
|
|
19
|
-
| bun | `bun add @c15t/integrations
|
|
23
|
+
| Package manager | Command |
|
|
24
|
+
| :-------------- | :------------------------------- |
|
|
25
|
+
| npm | `npm install @c15t/integrations` |
|
|
26
|
+
| pnpm | `pnpm add @c15t/integrations` |
|
|
27
|
+
| yarn | `yarn add @c15t/integrations` |
|
|
28
|
+
| bun | `bun add @c15t/integrations` |
|
|
20
29
|
|
|
21
30
|
```ts title="src/consent-scripts.ts"
|
|
22
31
|
import { crisp } from '@c15t/integrations/crisp';
|
|
@@ -31,51 +40,41 @@ endpoint, policy, styles and consent UI. Remove the vendor's original script,
|
|
|
31
40
|
SDK initializer or tag-manager entry, so the vendor loads only through c15t.
|
|
32
41
|
|
|
33
42
|
The vendor pages put the helper in `src/consent-scripts.ts`. If your framework
|
|
34
|
-
quickstart already
|
|
35
|
-
Next.js guide, add the helper to that array instead of creating a
|
|
43
|
+
quickstart already has a `scripts` array, such as the one in `c15t.config.ts`
|
|
44
|
+
in the Next.js guide, add the helper to that array instead of creating a
|
|
45
|
+
second file.
|
|
36
46
|
The `scripts` export is a configuration, not an initializer. Add it to the c15t provider you already have, at the registration
|
|
37
47
|
point for your framework below. These are edits to that provider, not a second
|
|
38
48
|
provider.
|
|
39
49
|
|
|
40
50
|
**Next.js**
|
|
41
51
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
```ts
|
|
45
|
-
import { ConsentRoot } from 'c15t/next';
|
|
46
|
-
import { scripts } from './consent-scripts';
|
|
47
|
-
```
|
|
52
|
+
Add the configuration to `scripts` in `c15t.config.ts`, next to
|
|
53
|
+
`next.config.ts`:
|
|
48
54
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
55
|
+
```ts title="c15t.config.ts"
|
|
56
|
+
import { defineConsentConfig } from 'c15t/next';
|
|
57
|
+
import { scripts } from './src/consent-scripts';
|
|
52
58
|
|
|
53
|
-
|
|
54
|
-
<ConsentRoot state={state} config={consentConfig} scripts={scripts}>
|
|
55
|
-
{children}
|
|
56
|
-
</ConsentRoot>
|
|
59
|
+
export default defineConsentConfig({ scripts });
|
|
57
60
|
```
|
|
58
61
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
Keep the rest of your config, such as `mode` and `routePrefix`, in the
|
|
63
|
+
same call. `ConsentRoot` reads the config in the browser, so the layout
|
|
64
|
+
keeps passing only `state`. App Router, Pages Router and static export all
|
|
65
|
+
read the same file. See
|
|
62
66
|
[Next.js scripts and embeds](https://c15t.com/docs/frameworks/next/scripts).
|
|
63
67
|
|
|
64
68
|
**TanStack Start**
|
|
65
69
|
|
|
66
70
|
Import the configuration into your root route and pass it to the existing
|
|
67
|
-
`ConsentRoot` as a top-level prop. Keep the loader
|
|
68
|
-
|
|
71
|
+
`ConsentRoot` as a top-level prop. Keep the loader from the
|
|
72
|
+
[TanStack Start quickstart](https://c15t.com/docs/frameworks/tanstack-start/quickstart):
|
|
69
73
|
|
|
70
74
|
```tsx title="src/routes/__root.tsx"
|
|
71
75
|
import { scripts } from '../consent-scripts';
|
|
72
76
|
|
|
73
|
-
<ConsentRoot
|
|
74
|
-
state={consent}
|
|
75
|
-
backendURL={backendURL}
|
|
76
|
-
initRoute={false}
|
|
77
|
-
scripts={scripts}
|
|
78
|
-
>
|
|
77
|
+
<ConsentRoot state={consent} scripts={scripts}>
|
|
79
78
|
```
|
|
80
79
|
|
|
81
80
|
Import vendor helpers in the root route module, not in a server function.
|
|
@@ -94,8 +93,8 @@ import { scripts } from './consent-scripts';
|
|
|
94
93
|
<ConsentProvider options={{ mode, scripts }}>
|
|
95
94
|
```
|
|
96
95
|
|
|
97
|
-
`mode` is the `
|
|
98
|
-
|
|
96
|
+
`mode` is the `manifest()` value from the
|
|
97
|
+
[React quickstart](../frameworks/react/quickstart.md). Keep the banner,
|
|
99
98
|
dialog and preferences link inside the provider. See
|
|
100
99
|
[React scripts and embeds](../frameworks/react/scripts.md).
|
|
101
100
|
|
|
@@ -124,15 +123,16 @@ callbacks. Write the vendor IDs into `consent-scripts.ts`. See
|
|
|
124
123
|
Pass the scripts to the existing `c15tVue` plugin call in `src/main.ts`:
|
|
125
124
|
|
|
126
125
|
```ts title="src/main.ts"
|
|
126
|
+
import { c15tVue, manifest } from 'c15t/vue/vue-plugin';
|
|
127
127
|
import { scripts } from './consent-scripts';
|
|
128
128
|
|
|
129
129
|
app.use(c15tVue, {
|
|
130
|
-
|
|
130
|
+
mode: manifest(),
|
|
131
131
|
scripts,
|
|
132
132
|
});
|
|
133
133
|
```
|
|
134
134
|
|
|
135
|
-
Keep your existing
|
|
135
|
+
Keep your existing `mode` and other options. The plugin starts one
|
|
136
136
|
script loader when the app mounts, after it has applied the visitor's stored
|
|
137
137
|
choice. Do not also call `createScriptLoader` from a component. See
|
|
138
138
|
[Vue scripts and embeds](https://c15t.com/docs/frameworks/vue/scripts).
|
|
@@ -140,12 +140,11 @@ choice. Do not also call `createScriptLoader` from a component. See
|
|
|
140
140
|
**Astro**
|
|
141
141
|
|
|
142
142
|
Add the scripts to the client entrypoint from the
|
|
143
|
-
[Astro quickstart](https://c15t.com/docs/frameworks/astro/quickstart),
|
|
144
|
-
integration
|
|
145
|
-
|
|
146
|
-
already exports scripts, combine the two arrays.
|
|
143
|
+
[Astro quickstart](https://c15t.com/docs/frameworks/astro/quickstart), `src/c15t.client.ts`,
|
|
144
|
+
which the integration finds on its own. Keep `astro.config.mjs` as it is.
|
|
145
|
+
If the module already exports scripts, combine the two arrays.
|
|
147
146
|
|
|
148
|
-
```ts title="src/
|
|
147
|
+
```ts title="src/c15t.client.ts"
|
|
149
148
|
import type { C15tClientOptionsExtension } from 'c15t/astro';
|
|
150
149
|
import { scripts } from './consent-scripts';
|
|
151
150
|
|
|
@@ -165,15 +164,13 @@ pass them as a top-level prop:
|
|
|
165
164
|
|
|
166
165
|
```svelte title="src/App.svelte"
|
|
167
166
|
<script lang="ts">
|
|
168
|
-
import {
|
|
167
|
+
import { ConsentProvider, manifest } from '@c15t/svelte';
|
|
169
168
|
import { scripts } from './consent-scripts';
|
|
170
|
-
|
|
171
|
-
const mode = hosted({ url: 'https://your-project.inth.app' });
|
|
172
169
|
</script>
|
|
173
170
|
|
|
174
|
-
<
|
|
171
|
+
<ConsentProvider mode={manifest()} {scripts}>
|
|
175
172
|
<!-- Keep your application, consent UI and preferences link here. -->
|
|
176
|
-
</
|
|
173
|
+
</ConsentProvider>
|
|
177
174
|
```
|
|
178
175
|
|
|
179
176
|
Retain the styles and consent UI from the [Svelte quickstart](https://c15t.com/docs/frameworks/svelte/quickstart).
|
|
@@ -181,22 +178,21 @@ The provider owns the loader and disposes it on unmount.
|
|
|
181
178
|
|
|
182
179
|
**SvelteKit**
|
|
183
180
|
|
|
184
|
-
Add the scripts to the existing root layout
|
|
185
|
-
and
|
|
181
|
+
Add the scripts to the existing `ConsentRoot` in the root layout. Keep the
|
|
182
|
+
handle and the layout load from the [SvelteKit quickstart](https://c15t.com/docs/frameworks/sveltekit/quickstart).
|
|
186
183
|
|
|
187
184
|
```svelte title="src/routes/+layout.svelte"
|
|
188
185
|
<script lang="ts">
|
|
189
|
-
import {
|
|
186
|
+
import { ConsentRoot } from '@c15t/svelte';
|
|
190
187
|
import { scripts } from '../consent-scripts';
|
|
191
188
|
|
|
192
189
|
let { children, data } = $props();
|
|
193
|
-
const mode = hosted({ url: 'https://your-project.inth.app' });
|
|
194
190
|
</script>
|
|
195
191
|
|
|
196
|
-
<
|
|
192
|
+
<ConsentRoot state={data.consent} {scripts}>
|
|
197
193
|
{@render children()}
|
|
198
194
|
<!-- Keep your consent UI and preferences link here. -->
|
|
199
|
-
</
|
|
195
|
+
</ConsentRoot>
|
|
200
196
|
```
|
|
201
197
|
|
|
202
198
|
Import vendor helpers in the layout component, not in `+layout.server.ts`:
|
|
@@ -223,20 +219,19 @@ to a pasted snippet. See [HTML scripts](https://c15t.com/docs/frameworks/html/sc
|
|
|
223
219
|
|
|
224
220
|
**JavaScript**
|
|
225
221
|
|
|
226
|
-
Pass the scripts to `init()` from `@c15t/browser`, next to your
|
|
227
|
-
URL:
|
|
222
|
+
Pass the scripts to `init()` from `@c15t/browser`, next to your mode:
|
|
228
223
|
|
|
229
224
|
```ts
|
|
230
|
-
import { init } from '@c15t/browser';
|
|
225
|
+
import { init, manifest } from '@c15t/browser';
|
|
231
226
|
import { scripts } from './consent-scripts';
|
|
232
227
|
|
|
233
228
|
const consent = init({
|
|
234
|
-
|
|
229
|
+
mode: manifest(),
|
|
235
230
|
scripts,
|
|
236
231
|
});
|
|
237
232
|
```
|
|
238
233
|
|
|
239
|
-
Keep the
|
|
234
|
+
Keep the mode from your quickstart. With
|
|
240
235
|
`createConsentRuntime` from `c15t/runtime`, pass `scripts` to it instead.
|
|
241
236
|
A kernel you create yourself needs a loader from
|
|
242
237
|
`c15t/modules/script-loader`. Attach one loader per kernel. See
|
|
@@ -244,16 +239,16 @@ A kernel you create yourself needs a loader from
|
|
|
244
239
|
|
|
245
240
|
## Options
|
|
246
241
|
|
|
247
|
-
| Option | Default | Behavior
|
|
248
|
-
| -------------- | -------------------------------- |
|
|
249
|
-
| `websiteId` | Required | Written to `window.CRISP_WEBSITE_ID`. The helper trims it. Empty or whitespace-only values
|
|
250
|
-
| `locale` | None | Widget locale, written to `window.CRISP_RUNTIME_CONFIG.locale`.
|
|
251
|
-
| `sessionMerge` | None | Merges anonymous sessions into token-backed sessions. Written to `CRISP_RUNTIME_CONFIG.session_merge`.
|
|
252
|
-
| `tokenId` | None | Session continuity token, written to `window.CRISP_TOKEN_ID`.
|
|
253
|
-
| `cookieDomain` | None | Cookie domain, written to `window.CRISP_COOKIE_DOMAIN`.
|
|
254
|
-
| `cookieExpiry` | None | Cookie lifetime in seconds, written to `window.CRISP_COOKIE_EXPIRE`.
|
|
255
|
-
| `safeMode` | `false` | Pushes `['safe', true]` to `$crisp` before the loader.
|
|
256
|
-
| `scriptSrc` | `https://client.crisp.chat/l.js` | Loader URL override. A blank value falls back to the default.
|
|
242
|
+
| Option | Default | Behavior |
|
|
243
|
+
| -------------- | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
|
|
244
|
+
| `websiteId` | Required | Written to `window.CRISP_WEBSITE_ID`. The helper trims it. Empty or whitespace-only values log an error and the script does not load. |
|
|
245
|
+
| `locale` | None | Widget locale, written to `window.CRISP_RUNTIME_CONFIG.locale`. |
|
|
246
|
+
| `sessionMerge` | None | Merges anonymous sessions into token-backed sessions. Written to `CRISP_RUNTIME_CONFIG.session_merge`. |
|
|
247
|
+
| `tokenId` | None | Session continuity token, written to `window.CRISP_TOKEN_ID`. |
|
|
248
|
+
| `cookieDomain` | None | Cookie domain, written to `window.CRISP_COOKIE_DOMAIN`. |
|
|
249
|
+
| `cookieExpiry` | None | Cookie lifetime in seconds, written to `window.CRISP_COOKIE_EXPIRE`. |
|
|
250
|
+
| `safeMode` | `false` | Pushes `['safe', true]` to `$crisp` before the loader. |
|
|
251
|
+
| `scriptSrc` | `https://client.crisp.chat/l.js` | Loader URL override. A blank value falls back to the default. |
|
|
257
252
|
|
|
258
253
|
## Loading and revocation
|
|
259
254
|
|
|
@@ -293,8 +288,8 @@ permission before each of your own event calls. The reload does not delete
|
|
|
293
288
|
cookies the vendor already set; see
|
|
294
289
|
[clear on revocation for your framework](./overview.md#vendor-switches-and-cookie-cleanup).
|
|
295
290
|
|
|
296
|
-
The helper
|
|
297
|
-
|
|
291
|
+
The helper lists its vendor by name in the preference dialog, so a visitor can
|
|
292
|
+
turn it off inside an allowed category. See
|
|
298
293
|
[vendor consent for your framework](./overview.md#vendor-switches-and-cookie-cleanup). The
|
|
299
294
|
[consent verification guide](../guides/verify-consent.md) covers navigation,
|
|
300
295
|
expiry and hosting checks.
|