@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
|
@@ -2,21 +2,32 @@
|
|
|
2
2
|
title: Microsoft Clarity
|
|
3
3
|
description: Load Microsoft Clarity only after measurement consent with the c15t
|
|
4
4
|
clarity helper, send Consent V2 storage signals and check them in DevTools.
|
|
5
|
+
seoTitle: Microsoft Clarity cookie consent with c15t
|
|
6
|
+
seoDescription: Load Microsoft Clarity only after measurement consent. The c15t
|
|
7
|
+
clarity helper sends Clarity consentv2 signals for analytics and ad storage.
|
|
5
8
|
icon: microsoft-clarity
|
|
6
9
|
group: integrations
|
|
7
10
|
---
|
|
8
11
|
|
|
12
|
+
The c15t `clarity` helper keeps Microsoft Clarity off the page until
|
|
13
|
+
`measurement` has consent. Before the script loads, and after each consent
|
|
14
|
+
change, the helper calls `clarity('consentv2', ...)`. `measurement` controls
|
|
15
|
+
`analytics_Storage`, and `marketing` controls `ad_Storage`. The `defaultConsent`
|
|
16
|
+
option replaces the values in the first call. After the visitor withdraws
|
|
17
|
+
consent, Clarity stays on the page and gets `analytics_Storage: 'denied'`. By
|
|
18
|
+
default, c15t also reloads the page.
|
|
19
|
+
|
|
9
20
|
## Configure Microsoft Clarity
|
|
10
21
|
|
|
11
22
|
Copy the project ID from your Clarity tracking code, where it follows
|
|
12
23
|
`https://www.clarity.ms/tag/`. The helper builds the loader URL from it.
|
|
13
24
|
|
|
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
|
|
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` |
|
|
20
31
|
|
|
21
32
|
```ts title="src/consent-scripts.ts"
|
|
22
33
|
import { clarity } from '@c15t/integrations/microsoft-clarity';
|
|
@@ -31,51 +42,41 @@ endpoint, policy, styles and consent UI. Remove the vendor's original script,
|
|
|
31
42
|
SDK initializer or tag-manager entry, so the vendor loads only through c15t.
|
|
32
43
|
|
|
33
44
|
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
|
|
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.
|
|
36
48
|
The `scripts` export is a configuration, not an initializer. Add it to the c15t provider you already have, at the registration
|
|
37
49
|
point for your framework below. These are edits to that provider, not a second
|
|
38
50
|
provider.
|
|
39
51
|
|
|
40
52
|
**Next.js**
|
|
41
53
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
```ts
|
|
45
|
-
import { ConsentRoot } from 'c15t/next';
|
|
46
|
-
import { scripts } from './consent-scripts';
|
|
47
|
-
```
|
|
54
|
+
Add the configuration to `scripts` in `c15t.config.ts`, next to
|
|
55
|
+
`next.config.ts`:
|
|
48
56
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
57
|
+
```ts title="c15t.config.ts"
|
|
58
|
+
import { defineConsentConfig } from 'c15t/next';
|
|
59
|
+
import { scripts } from './src/consent-scripts';
|
|
52
60
|
|
|
53
|
-
|
|
54
|
-
<ConsentRoot state={state} config={consentConfig} scripts={scripts}>
|
|
55
|
-
{children}
|
|
56
|
-
</ConsentRoot>
|
|
61
|
+
export default defineConsentConfig({ scripts });
|
|
57
62
|
```
|
|
58
63
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
|
62
68
|
[Next.js scripts and embeds](https://c15t.com/docs/frameworks/next/scripts).
|
|
63
69
|
|
|
64
70
|
**TanStack Start**
|
|
65
71
|
|
|
66
72
|
Import the configuration into your root route and pass it to the existing
|
|
67
|
-
`ConsentRoot` as a top-level prop. Keep the loader
|
|
68
|
-
|
|
73
|
+
`ConsentRoot` as a top-level prop. Keep the loader from the
|
|
74
|
+
[TanStack Start quickstart](https://c15t.com/docs/frameworks/tanstack-start/quickstart):
|
|
69
75
|
|
|
70
76
|
```tsx title="src/routes/__root.tsx"
|
|
71
77
|
import { scripts } from '../consent-scripts';
|
|
72
78
|
|
|
73
|
-
<ConsentRoot
|
|
74
|
-
state={consent}
|
|
75
|
-
backendURL={backendURL}
|
|
76
|
-
initRoute={false}
|
|
77
|
-
scripts={scripts}
|
|
78
|
-
>
|
|
79
|
+
<ConsentRoot state={consent} scripts={scripts}>
|
|
79
80
|
```
|
|
80
81
|
|
|
81
82
|
Import vendor helpers in the root route module, not in a server function.
|
|
@@ -94,8 +95,8 @@ import { scripts } from './consent-scripts';
|
|
|
94
95
|
<ConsentProvider options={{ mode, scripts }}>
|
|
95
96
|
```
|
|
96
97
|
|
|
97
|
-
`mode` is the `
|
|
98
|
-
|
|
98
|
+
`mode` is the `manifest()` value from the
|
|
99
|
+
[React quickstart](../frameworks/react/quickstart.md). Keep the banner,
|
|
99
100
|
dialog and preferences link inside the provider. See
|
|
100
101
|
[React scripts and embeds](../frameworks/react/scripts.md).
|
|
101
102
|
|
|
@@ -124,15 +125,16 @@ callbacks. Write the vendor IDs into `consent-scripts.ts`. See
|
|
|
124
125
|
Pass the scripts to the existing `c15tVue` plugin call in `src/main.ts`:
|
|
125
126
|
|
|
126
127
|
```ts title="src/main.ts"
|
|
128
|
+
import { c15tVue, manifest } from 'c15t/vue/vue-plugin';
|
|
127
129
|
import { scripts } from './consent-scripts';
|
|
128
130
|
|
|
129
131
|
app.use(c15tVue, {
|
|
130
|
-
|
|
132
|
+
mode: manifest(),
|
|
131
133
|
scripts,
|
|
132
134
|
});
|
|
133
135
|
```
|
|
134
136
|
|
|
135
|
-
Keep your existing
|
|
137
|
+
Keep your existing `mode` and other options. The plugin starts one
|
|
136
138
|
script loader when the app mounts, after it has applied the visitor's stored
|
|
137
139
|
choice. Do not also call `createScriptLoader` from a component. See
|
|
138
140
|
[Vue scripts and embeds](https://c15t.com/docs/frameworks/vue/scripts).
|
|
@@ -140,12 +142,11 @@ choice. Do not also call `createScriptLoader` from a component. See
|
|
|
140
142
|
**Astro**
|
|
141
143
|
|
|
142
144
|
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.
|
|
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.
|
|
147
148
|
|
|
148
|
-
```ts title="src/
|
|
149
|
+
```ts title="src/c15t.client.ts"
|
|
149
150
|
import type { C15tClientOptionsExtension } from 'c15t/astro';
|
|
150
151
|
import { scripts } from './consent-scripts';
|
|
151
152
|
|
|
@@ -165,15 +166,13 @@ pass them as a top-level prop:
|
|
|
165
166
|
|
|
166
167
|
```svelte title="src/App.svelte"
|
|
167
168
|
<script lang="ts">
|
|
168
|
-
import {
|
|
169
|
+
import { ConsentProvider, manifest } from '@c15t/svelte';
|
|
169
170
|
import { scripts } from './consent-scripts';
|
|
170
|
-
|
|
171
|
-
const mode = hosted({ url: 'https://your-project.inth.app' });
|
|
172
171
|
</script>
|
|
173
172
|
|
|
174
|
-
<
|
|
173
|
+
<ConsentProvider mode={manifest()} {scripts}>
|
|
175
174
|
<!-- Keep your application, consent UI and preferences link here. -->
|
|
176
|
-
</
|
|
175
|
+
</ConsentProvider>
|
|
177
176
|
```
|
|
178
177
|
|
|
179
178
|
Retain the styles and consent UI from the [Svelte quickstart](https://c15t.com/docs/frameworks/svelte/quickstart).
|
|
@@ -181,22 +180,21 @@ The provider owns the loader and disposes it on unmount.
|
|
|
181
180
|
|
|
182
181
|
**SvelteKit**
|
|
183
182
|
|
|
184
|
-
Add the scripts to the existing root layout
|
|
185
|
-
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).
|
|
186
185
|
|
|
187
186
|
```svelte title="src/routes/+layout.svelte"
|
|
188
187
|
<script lang="ts">
|
|
189
|
-
import {
|
|
188
|
+
import { ConsentRoot } from '@c15t/svelte';
|
|
190
189
|
import { scripts } from '../consent-scripts';
|
|
191
190
|
|
|
192
191
|
let { children, data } = $props();
|
|
193
|
-
const mode = hosted({ url: 'https://your-project.inth.app' });
|
|
194
192
|
</script>
|
|
195
193
|
|
|
196
|
-
<
|
|
194
|
+
<ConsentRoot state={data.consent} {scripts}>
|
|
197
195
|
{@render children()}
|
|
198
196
|
<!-- Keep your consent UI and preferences link here. -->
|
|
199
|
-
</
|
|
197
|
+
</ConsentRoot>
|
|
200
198
|
```
|
|
201
199
|
|
|
202
200
|
Import vendor helpers in the layout component, not in `+layout.server.ts`:
|
|
@@ -223,20 +221,19 @@ to a pasted snippet. See [HTML scripts](https://c15t.com/docs/frameworks/html/sc
|
|
|
223
221
|
|
|
224
222
|
**JavaScript**
|
|
225
223
|
|
|
226
|
-
Pass the scripts to `init()` from `@c15t/browser`, next to your
|
|
227
|
-
URL:
|
|
224
|
+
Pass the scripts to `init()` from `@c15t/browser`, next to your mode:
|
|
228
225
|
|
|
229
226
|
```ts
|
|
230
|
-
import { init } from '@c15t/browser';
|
|
227
|
+
import { init, manifest } from '@c15t/browser';
|
|
231
228
|
import { scripts } from './consent-scripts';
|
|
232
229
|
|
|
233
230
|
const consent = init({
|
|
234
|
-
|
|
231
|
+
mode: manifest(),
|
|
235
232
|
scripts,
|
|
236
233
|
});
|
|
237
234
|
```
|
|
238
235
|
|
|
239
|
-
Keep the
|
|
236
|
+
Keep the mode from your quickstart. With
|
|
240
237
|
`createConsentRuntime` from `c15t/runtime`, pass `scripts` to it instead.
|
|
241
238
|
A kernel you create yourself needs a loader from
|
|
242
239
|
`c15t/modules/script-loader`. Attach one loader per kernel. See
|
|
@@ -246,7 +243,7 @@ A kernel you create yourself needs a loader from
|
|
|
246
243
|
|
|
247
244
|
| Option | Default | Behavior |
|
|
248
245
|
| ---------------- | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
249
|
-
| `id` | Required | Clarity project ID. Surrounding whitespace is trimmed.
|
|
246
|
+
| `id` | Required | Clarity project ID. Surrounding whitespace is trimmed. Unless you set `scriptUrl`, an empty ID logs an error and the script does not load. |
|
|
250
247
|
| `defaultConsent` | c15t state | Consent V2 value queued once, before the loader. `true` or `false` sets both channels. An object sets `ad_Storage` or `analytics_Storage`, also accepted as `marketing` and `measurement`; channels you leave out follow c15t. Later updates always follow c15t. `true` grants ad storage even while marketing is denied. |
|
|
251
248
|
| `scriptUrl` | `https://www.clarity.ms/tag/<id>` | Loader URL override. |
|
|
252
249
|
|
|
@@ -293,8 +290,8 @@ permission before each of your own event calls. The reload does not delete
|
|
|
293
290
|
cookies the vendor already set; see
|
|
294
291
|
[clear on revocation for your framework](./overview.md#vendor-switches-and-cookie-cleanup).
|
|
295
292
|
|
|
296
|
-
The helper
|
|
297
|
-
|
|
293
|
+
The helper lists its vendor by name in the preference dialog, so a visitor can
|
|
294
|
+
turn it off inside an allowed category. See
|
|
298
295
|
[vendor consent for your framework](./overview.md#vendor-switches-and-cookie-cleanup). The
|
|
299
296
|
[consent verification guide](../guides/verify-consent.md) covers navigation,
|
|
300
297
|
expiry and hosting checks.
|
|
@@ -3,22 +3,33 @@ title: Microsoft UET
|
|
|
3
3
|
description: Load Microsoft Advertising UET on every page with the c15t
|
|
4
4
|
microsoftUet helper, send ad_storage consent defaults and updates, and verify
|
|
5
5
|
both in DevTools.
|
|
6
|
+
seoTitle: Microsoft UET consent mode with c15t
|
|
7
|
+
seoDescription: Send Microsoft UET consent mode signals from your cookie banner.
|
|
8
|
+
The c15t microsoftUet helper sets ad_storage from marketing consent before
|
|
9
|
+
bat.js runs.
|
|
6
10
|
icon: microsoft
|
|
7
11
|
group: integrations
|
|
8
12
|
---
|
|
9
13
|
|
|
14
|
+
The c15t `microsoftUet` helper loads Microsoft Advertising UET, `bat.js`, on
|
|
15
|
+
every page, before the visitor chooses. Before the script loads, the helper
|
|
16
|
+
calls `uetq.push('consent', 'default', { ad_storage })`. The `ad_storage` value
|
|
17
|
+
is `granted` or `denied`, from the consent for `marketing`. When that consent
|
|
18
|
+
changes, the helper sends an `update`. After the visitor withdraws consent, UET
|
|
19
|
+
stays on the page and gets `denied`. By default, c15t also reloads the page.
|
|
20
|
+
|
|
10
21
|
## Configure Microsoft UET
|
|
11
22
|
|
|
12
23
|
Copy your UET tag ID from Microsoft Advertising. Remove the UET snippet and
|
|
13
24
|
any tag-manager entry that loads the same tag, because the helper creates the
|
|
14
25
|
`uetq` queue and constructs UET itself.
|
|
15
26
|
|
|
16
|
-
| Package manager | Command
|
|
17
|
-
| :-------------- |
|
|
18
|
-
| npm | `npm install @c15t/integrations
|
|
19
|
-
| pnpm | `pnpm add @c15t/integrations
|
|
20
|
-
| yarn | `yarn add @c15t/integrations
|
|
21
|
-
| bun | `bun add @c15t/integrations
|
|
27
|
+
| Package manager | Command |
|
|
28
|
+
| :-------------- | :------------------------------- |
|
|
29
|
+
| npm | `npm install @c15t/integrations` |
|
|
30
|
+
| pnpm | `pnpm add @c15t/integrations` |
|
|
31
|
+
| yarn | `yarn add @c15t/integrations` |
|
|
32
|
+
| bun | `bun add @c15t/integrations` |
|
|
22
33
|
|
|
23
34
|
```ts title="src/consent-scripts.ts"
|
|
24
35
|
import { microsoftUet } from '@c15t/integrations/microsoft-uet';
|
|
@@ -33,51 +44,41 @@ endpoint, policy, styles and consent UI. Remove the vendor's original script,
|
|
|
33
44
|
SDK initializer or tag-manager entry, so the vendor loads only through c15t.
|
|
34
45
|
|
|
35
46
|
The vendor pages put the helper in `src/consent-scripts.ts`. If your framework
|
|
36
|
-
quickstart already
|
|
37
|
-
Next.js guide, add the helper to that array instead of creating a
|
|
47
|
+
quickstart already has a `scripts` array, such as the one in `c15t.config.ts`
|
|
48
|
+
in the Next.js guide, add the helper to that array instead of creating a
|
|
49
|
+
second file.
|
|
38
50
|
The `scripts` export is a configuration, not an initializer. Add it to the c15t provider you already have, at the registration
|
|
39
51
|
point for your framework below. These are edits to that provider, not a second
|
|
40
52
|
provider.
|
|
41
53
|
|
|
42
54
|
**Next.js**
|
|
43
55
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
```ts
|
|
47
|
-
import { ConsentRoot } from 'c15t/next';
|
|
48
|
-
import { scripts } from './consent-scripts';
|
|
49
|
-
```
|
|
56
|
+
Add the configuration to `scripts` in `c15t.config.ts`, next to
|
|
57
|
+
`next.config.ts`:
|
|
50
58
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
59
|
+
```ts title="c15t.config.ts"
|
|
60
|
+
import { defineConsentConfig } from 'c15t/next';
|
|
61
|
+
import { scripts } from './src/consent-scripts';
|
|
54
62
|
|
|
55
|
-
|
|
56
|
-
<ConsentRoot state={state} config={consentConfig} scripts={scripts}>
|
|
57
|
-
{children}
|
|
58
|
-
</ConsentRoot>
|
|
63
|
+
export default defineConsentConfig({ scripts });
|
|
59
64
|
```
|
|
60
65
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
Keep the rest of your config, such as `mode` and `routePrefix`, in the
|
|
67
|
+
same call. `ConsentRoot` reads the config in the browser, so the layout
|
|
68
|
+
keeps passing only `state`. App Router, Pages Router and static export all
|
|
69
|
+
read the same file. See
|
|
64
70
|
[Next.js scripts and embeds](https://c15t.com/docs/frameworks/next/scripts).
|
|
65
71
|
|
|
66
72
|
**TanStack Start**
|
|
67
73
|
|
|
68
74
|
Import the configuration into your root route and pass it to the existing
|
|
69
|
-
`ConsentRoot` as a top-level prop. Keep the loader
|
|
70
|
-
|
|
75
|
+
`ConsentRoot` as a top-level prop. Keep the loader from the
|
|
76
|
+
[TanStack Start quickstart](https://c15t.com/docs/frameworks/tanstack-start/quickstart):
|
|
71
77
|
|
|
72
78
|
```tsx title="src/routes/__root.tsx"
|
|
73
79
|
import { scripts } from '../consent-scripts';
|
|
74
80
|
|
|
75
|
-
<ConsentRoot
|
|
76
|
-
state={consent}
|
|
77
|
-
backendURL={backendURL}
|
|
78
|
-
initRoute={false}
|
|
79
|
-
scripts={scripts}
|
|
80
|
-
>
|
|
81
|
+
<ConsentRoot state={consent} scripts={scripts}>
|
|
81
82
|
```
|
|
82
83
|
|
|
83
84
|
Import vendor helpers in the root route module, not in a server function.
|
|
@@ -96,8 +97,8 @@ import { scripts } from './consent-scripts';
|
|
|
96
97
|
<ConsentProvider options={{ mode, scripts }}>
|
|
97
98
|
```
|
|
98
99
|
|
|
99
|
-
`mode` is the `
|
|
100
|
-
|
|
100
|
+
`mode` is the `manifest()` value from the
|
|
101
|
+
[React quickstart](../frameworks/react/quickstart.md). Keep the banner,
|
|
101
102
|
dialog and preferences link inside the provider. See
|
|
102
103
|
[React scripts and embeds](../frameworks/react/scripts.md).
|
|
103
104
|
|
|
@@ -126,15 +127,16 @@ callbacks. Write the vendor IDs into `consent-scripts.ts`. See
|
|
|
126
127
|
Pass the scripts to the existing `c15tVue` plugin call in `src/main.ts`:
|
|
127
128
|
|
|
128
129
|
```ts title="src/main.ts"
|
|
130
|
+
import { c15tVue, manifest } from 'c15t/vue/vue-plugin';
|
|
129
131
|
import { scripts } from './consent-scripts';
|
|
130
132
|
|
|
131
133
|
app.use(c15tVue, {
|
|
132
|
-
|
|
134
|
+
mode: manifest(),
|
|
133
135
|
scripts,
|
|
134
136
|
});
|
|
135
137
|
```
|
|
136
138
|
|
|
137
|
-
Keep your existing
|
|
139
|
+
Keep your existing `mode` and other options. The plugin starts one
|
|
138
140
|
script loader when the app mounts, after it has applied the visitor's stored
|
|
139
141
|
choice. Do not also call `createScriptLoader` from a component. See
|
|
140
142
|
[Vue scripts and embeds](https://c15t.com/docs/frameworks/vue/scripts).
|
|
@@ -142,12 +144,11 @@ choice. Do not also call `createScriptLoader` from a component. See
|
|
|
142
144
|
**Astro**
|
|
143
145
|
|
|
144
146
|
Add the scripts to the client entrypoint from the
|
|
145
|
-
[Astro quickstart](https://c15t.com/docs/frameworks/astro/quickstart),
|
|
146
|
-
integration
|
|
147
|
-
|
|
148
|
-
already exports scripts, combine the two arrays.
|
|
147
|
+
[Astro quickstart](https://c15t.com/docs/frameworks/astro/quickstart), `src/c15t.client.ts`,
|
|
148
|
+
which the integration finds on its own. Keep `astro.config.mjs` as it is.
|
|
149
|
+
If the module already exports scripts, combine the two arrays.
|
|
149
150
|
|
|
150
|
-
```ts title="src/
|
|
151
|
+
```ts title="src/c15t.client.ts"
|
|
151
152
|
import type { C15tClientOptionsExtension } from 'c15t/astro';
|
|
152
153
|
import { scripts } from './consent-scripts';
|
|
153
154
|
|
|
@@ -167,15 +168,13 @@ pass them as a top-level prop:
|
|
|
167
168
|
|
|
168
169
|
```svelte title="src/App.svelte"
|
|
169
170
|
<script lang="ts">
|
|
170
|
-
import {
|
|
171
|
+
import { ConsentProvider, manifest } from '@c15t/svelte';
|
|
171
172
|
import { scripts } from './consent-scripts';
|
|
172
|
-
|
|
173
|
-
const mode = hosted({ url: 'https://your-project.inth.app' });
|
|
174
173
|
</script>
|
|
175
174
|
|
|
176
|
-
<
|
|
175
|
+
<ConsentProvider mode={manifest()} {scripts}>
|
|
177
176
|
<!-- Keep your application, consent UI and preferences link here. -->
|
|
178
|
-
</
|
|
177
|
+
</ConsentProvider>
|
|
179
178
|
```
|
|
180
179
|
|
|
181
180
|
Retain the styles and consent UI from the [Svelte quickstart](https://c15t.com/docs/frameworks/svelte/quickstart).
|
|
@@ -183,22 +182,21 @@ The provider owns the loader and disposes it on unmount.
|
|
|
183
182
|
|
|
184
183
|
**SvelteKit**
|
|
185
184
|
|
|
186
|
-
Add the scripts to the existing root layout
|
|
187
|
-
and
|
|
185
|
+
Add the scripts to the existing `ConsentRoot` in the root layout. Keep the
|
|
186
|
+
handle and the layout load from the [SvelteKit quickstart](https://c15t.com/docs/frameworks/sveltekit/quickstart).
|
|
188
187
|
|
|
189
188
|
```svelte title="src/routes/+layout.svelte"
|
|
190
189
|
<script lang="ts">
|
|
191
|
-
import {
|
|
190
|
+
import { ConsentRoot } from '@c15t/svelte';
|
|
192
191
|
import { scripts } from '../consent-scripts';
|
|
193
192
|
|
|
194
193
|
let { children, data } = $props();
|
|
195
|
-
const mode = hosted({ url: 'https://your-project.inth.app' });
|
|
196
194
|
</script>
|
|
197
195
|
|
|
198
|
-
<
|
|
196
|
+
<ConsentRoot state={data.consent} {scripts}>
|
|
199
197
|
{@render children()}
|
|
200
198
|
<!-- Keep your consent UI and preferences link here. -->
|
|
201
|
-
</
|
|
199
|
+
</ConsentRoot>
|
|
202
200
|
```
|
|
203
201
|
|
|
204
202
|
Import vendor helpers in the layout component, not in `+layout.server.ts`:
|
|
@@ -225,20 +223,19 @@ to a pasted snippet. See [HTML scripts](https://c15t.com/docs/frameworks/html/sc
|
|
|
225
223
|
|
|
226
224
|
**JavaScript**
|
|
227
225
|
|
|
228
|
-
Pass the scripts to `init()` from `@c15t/browser`, next to your
|
|
229
|
-
URL:
|
|
226
|
+
Pass the scripts to `init()` from `@c15t/browser`, next to your mode:
|
|
230
227
|
|
|
231
228
|
```ts
|
|
232
|
-
import { init } from '@c15t/browser';
|
|
229
|
+
import { init, manifest } from '@c15t/browser';
|
|
233
230
|
import { scripts } from './consent-scripts';
|
|
234
231
|
|
|
235
232
|
const consent = init({
|
|
236
|
-
|
|
233
|
+
mode: manifest(),
|
|
237
234
|
scripts,
|
|
238
235
|
});
|
|
239
236
|
```
|
|
240
237
|
|
|
241
|
-
Keep the
|
|
238
|
+
Keep the mode from your quickstart. With
|
|
242
239
|
`createConsentRuntime` from `c15t/runtime`, pass `scripts` to it instead.
|
|
243
240
|
A kernel you create yourself needs a loader from
|
|
244
241
|
`c15t/modules/script-loader`. Attach one loader per kernel. See
|
|
@@ -246,10 +243,10 @@ A kernel you create yourself needs a loader from
|
|
|
246
243
|
|
|
247
244
|
## Options
|
|
248
245
|
|
|
249
|
-
| Option | Default | Behavior
|
|
250
|
-
| ----------- | ----------------------- |
|
|
251
|
-
| `id` | Required | UET tag ID, passed to UET as `ti`. The helper trims it. Empty or whitespace-only values
|
|
252
|
-
| `scriptSrc` | `//bat.bing.com/bat.js` | Loader URL override. A blank value falls back to the default.
|
|
246
|
+
| Option | Default | Behavior |
|
|
247
|
+
| ----------- | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
|
|
248
|
+
| `id` | Required | UET tag ID, passed to UET as `ti`. The helper trims it. Empty or whitespace-only values log an error and the script does not load. |
|
|
249
|
+
| `scriptSrc` | `//bat.bing.com/bat.js` | Loader URL override. A blank value falls back to the default. |
|
|
253
250
|
|
|
254
251
|
## Loading and revocation
|
|
255
252
|
|