@c15t/browser 3.0.0-alpha.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.
Files changed (93) hide show
  1. package/AGENTS.md +64 -0
  2. package/CHANGELOG.md +27 -0
  3. package/README.md +128 -0
  4. package/dist/861.js +1079 -0
  5. package/dist/925.js +649 -0
  6. package/dist/c15t.css +213 -0
  7. package/dist/c15t.devtools.js +1 -0
  8. package/dist/c15t.headless.js +1 -0
  9. package/dist/c15t.iab.css +190 -0
  10. package/dist/c15t.iab.js +221 -0
  11. package/dist/c15t.js +30 -0
  12. package/dist/devtools.js +11 -0
  13. package/dist/headless.js +17 -0
  14. package/dist/iab.js +784 -0
  15. package/dist/index.js +17 -0
  16. package/dist-types/auto-init.d.ts +42 -0
  17. package/dist-types/client.d.ts +51 -0
  18. package/dist-types/deferred.d.ts +13 -0
  19. package/dist-types/devtools.d.ts +32 -0
  20. package/dist-types/entries/cdn-devtools.d.ts +13 -0
  21. package/dist-types/entries/cdn-headless.d.ts +8 -0
  22. package/dist-types/entries/cdn-iab.d.ts +1 -0
  23. package/dist-types/entries/cdn.d.ts +8 -0
  24. package/dist-types/gated-scripts.d.ts +35 -0
  25. package/dist-types/generated/iab-styles.d.ts +144 -0
  26. package/dist-types/generated/styles.d.ts +137 -0
  27. package/dist-types/global.d.ts +112 -0
  28. package/dist-types/headless.d.ts +41 -0
  29. package/dist-types/iab/mount.d.ts +8 -0
  30. package/dist-types/iab/preferences.d.ts +9 -0
  31. package/dist-types/iab/styles.d.ts +2 -0
  32. package/dist-types/iab/surface.d.ts +4 -0
  33. package/dist-types/iab/vendor-disclosures.d.ts +14 -0
  34. package/dist-types/iab.d.ts +20 -0
  35. package/dist-types/index.d.ts +43 -0
  36. package/dist-types/transports/manifest.d.ts +62 -0
  37. package/dist-types/transports/offline.d.ts +18 -0
  38. package/dist-types/types.d.ts +290 -0
  39. package/dist-types/ui/actions.d.ts +29 -0
  40. package/dist-types/ui/banner.d.ts +13 -0
  41. package/dist-types/ui/branding.d.ts +25 -0
  42. package/dist-types/ui/copy.d.ts +28 -0
  43. package/dist-types/ui/dialog.d.ts +14 -0
  44. package/dist-types/ui/dom.d.ts +48 -0
  45. package/dist-types/ui/mount.d.ts +27 -0
  46. package/dist-types/ui/surface.d.ts +43 -0
  47. package/dist-types/ui/trigger.d.ts +14 -0
  48. package/dist-types/ui/widget.d.ts +27 -0
  49. package/dist-types/version.d.ts +1 -0
  50. package/docs/README.md +64 -0
  51. package/docs/frameworks/javascript/script-loader.md +47 -0
  52. package/docs/frameworks/javascript/script-tag.md +375 -0
  53. package/docs/integrations/adobe-analytics.md +294 -0
  54. package/docs/integrations/ahrefs-analytics.md +291 -0
  55. package/docs/integrations/amplitude.md +292 -0
  56. package/docs/integrations/building-integrations.md +47 -0
  57. package/docs/integrations/clearbit.md +291 -0
  58. package/docs/integrations/cloudflare-web-analytics.md +292 -0
  59. package/docs/integrations/crisp.md +294 -0
  60. package/docs/integrations/databuddy.md +311 -0
  61. package/docs/integrations/fathom-analytics.md +293 -0
  62. package/docs/integrations/google-maps.md +384 -0
  63. package/docs/integrations/google-tag-manager.md +306 -0
  64. package/docs/integrations/google-tag.md +305 -0
  65. package/docs/integrations/heap.md +292 -0
  66. package/docs/integrations/hightouch.md +293 -0
  67. package/docs/integrations/hotjar.md +292 -0
  68. package/docs/integrations/intercom.md +285 -0
  69. package/docs/integrations/linkedin-insights.md +291 -0
  70. package/docs/integrations/logrocket.md +293 -0
  71. package/docs/integrations/matomo-analytics.md +316 -0
  72. package/docs/integrations/meta-pixel.md +285 -0
  73. package/docs/integrations/microsoft-clarity.md +292 -0
  74. package/docs/integrations/microsoft-uet.md +291 -0
  75. package/docs/integrations/mixpanel-analytics.md +295 -0
  76. package/docs/integrations/openai-pixel.md +441 -0
  77. package/docs/integrations/overview.md +111 -0
  78. package/docs/integrations/pirsch.md +295 -0
  79. package/docs/integrations/plausible-analytics.md +295 -0
  80. package/docs/integrations/posthog.md +397 -0
  81. package/docs/integrations/promptwatch.md +291 -0
  82. package/docs/integrations/reddit-pixel.md +294 -0
  83. package/docs/integrations/rudderstack.md +328 -0
  84. package/docs/integrations/rybbit-analytics.md +296 -0
  85. package/docs/integrations/segment.md +292 -0
  86. package/docs/integrations/snapchat-pixel.md +293 -0
  87. package/docs/integrations/tiktok-pixel.md +291 -0
  88. package/docs/integrations/umami-analytics.md +295 -0
  89. package/docs/integrations/vercel-analytics.md +293 -0
  90. package/docs/integrations/x-pixel.md +291 -0
  91. package/docs/integrations/youtube.md +405 -0
  92. package/package.json +117 -0
  93. package/readme.json +44 -0
@@ -0,0 +1,306 @@
1
+ ---
2
+ title: Google Tag Manager
3
+ description: Load GTM with c15t consent signals and verify the tags inside your container.
4
+ group: integrations
5
+ ---
6
+
7
+ ## Register the container
8
+
9
+ | Package manager | Command |
10
+ | :-------------- | :-------------------------- |
11
+ | npm | `npm install @c15t/scripts` |
12
+ | pnpm | `pnpm add @c15t/scripts` |
13
+ | yarn | `yarn add @c15t/scripts` |
14
+ | bun | `bun add @c15t/scripts` |
15
+
16
+ ```ts title="src/consent-scripts.ts"
17
+ import { googleTagManager } from '@c15t/scripts/google-tag-manager';
18
+
19
+ export const scripts = [googleTagManager({ id: 'GTM-XXXXXXX' })];
20
+ ```
21
+
22
+ Replace the container ID and pass `scripts` to your existing provider options.
23
+ Remove the previous GTM snippet and any duplicate framework integration. The
24
+ helper sends a `consent-update` event after consent changes; `updateEventName`
25
+ customizes that event name.
26
+
27
+ ## Register the scripts
28
+
29
+ Complete your [framework quickstart](https://c15t.com/docs/frameworks) first. Keep its Inth
30
+ endpoint, policy, styles and consent UI. Remove the vendor's original script,
31
+ SDK initializer or tag-manager entry so c15t owns loading once.
32
+
33
+ The `scripts` export in `src/consent-scripts.ts` is a configuration, not an
34
+ initializer. Add it to your existing consent owner using the registration point
35
+ below. These are partial edits to that owner, not additional providers.
36
+
37
+ **Next.js**
38
+
39
+ Import the configuration into the client boundary from your router guide:
40
+
41
+ ```ts
42
+ import { ConsentRoot } from 'c15t/next';
43
+ import { scripts } from './consent-scripts';
44
+ ```
45
+
46
+ Keep the server-resolved `state` and shared `consentConfig` from your
47
+ router guide. Its manifest, init and save URLs stay in effect. Add
48
+ `scripts` as a top-level prop on the existing root:
49
+
50
+ ```tsx
51
+ <ConsentRoot state={state} config={consentConfig} scripts={scripts}>
52
+ {children}
53
+ </ConsentRoot>
54
+ ```
55
+
56
+ For a Pages Router or static-export setup using `ConsentProvider`, add
57
+ `scripts` to its existing `options` instead. Keep the router-specific setup
58
+ from [Next.js script loading](https://c15t.com/docs/frameworks/next/script-loader).
59
+
60
+ **TanStack Start**
61
+
62
+ In your existing root route component, import the scripts alongside
63
+ `ConsentRoot`. Keep the server loader from the [TanStack Start quickstart](https://c15t.com/docs/frameworks/tanstack-start/quickstart).
64
+
65
+ ```tsx
66
+ import { Outlet } from '@tanstack/react-router';
67
+ import { ConsentRoot } from 'c15t/tanstack-start';
68
+ import { scripts } from '../consent-scripts';
69
+
70
+ function Root() {
71
+ const state = Route.useLoaderData();
72
+ return (
73
+ <ConsentRoot state={state} backendURL={backendURL} initRoute={false} scripts={scripts}>
74
+ <Outlet />
75
+ {/* Keep your consent banner, dialog and preferences link here. */}
76
+ </ConsentRoot>
77
+ );
78
+ }
79
+ ```
80
+
81
+ This edits the existing route. `Route` and `backendURL` come from its setup;
82
+ keep the document shell and head components if they are part of your root.
83
+ `initRoute={false}` keeps the quickstart's direct-backend initialization.
84
+ If your app mounts a consent server route, retain its existing `initRoute`
85
+ instead. Do not return script callbacks from a server function or route loader.
86
+
87
+ **React**
88
+
89
+ Import the scripts into your existing provider component:
90
+
91
+ ```ts
92
+ import { ConsentProvider } from 'c15t/react';
93
+ import { scripts } from './consent-scripts';
94
+ ```
95
+
96
+ Keep the existing options and add `scripts`:
97
+
98
+ ```tsx
99
+ <ConsentProvider options={{ ...consentOptions, scripts }}>
100
+ {children}
101
+ </ConsentProvider>
102
+ ```
103
+
104
+ Here `consentOptions` is your existing configuration, including
105
+ `mode: hosted({ url: backendURL })`. Keep the banner, dialog and preferences
106
+ link inside the provider. See [React script loading](https://c15t.com/docs/frameworks/react/script-loader).
107
+
108
+ **Nuxt**
109
+
110
+ Attach one loader from the root `app.vue`, after the Nuxt module has
111
+ started its browser runtime. This keeps vendor callbacks in application code rather
112
+ than serialized `nuxt.config.ts` runtime configuration.
113
+
114
+ ```vue title="app/app.vue"
115
+ <script setup lang="ts">
116
+ import { onUnmounted } from 'vue';
117
+ import { createScriptLoader } from 'c15t/modules/script-loader';
118
+ import { scripts } from '../src/consent-scripts';
119
+
120
+ const nuxtApp = useNuxtApp();
121
+ const kernel = useConsentKernel();
122
+ let loader: ReturnType<typeof createScriptLoader> | undefined;
123
+
124
+ const removeMountedHook = nuxtApp.hook('app:mounted', () => {
125
+ loader = createScriptLoader({ kernel, scripts });
126
+ });
127
+ onUnmounted(() => {
128
+ removeMountedHook();
129
+ loader?.dispose();
130
+ });
131
+ </script>
132
+
133
+ <template>
134
+ <ConsentRoot />
135
+ <NuxtPage />
136
+ </template>
137
+ ```
138
+
139
+ Merge the setup code into your root and retain its footer and preferences
140
+ link. `useConsentKernel` is auto-imported by the c15t Nuxt module. Adjust the
141
+ relative script import if your `app.vue` is at the project root. This loader
142
+ waits until the module has applied browser persistence and privacy signals,
143
+ then reads the current snapshot and observes future changes. Do not also register these scripts
144
+ in another loader. See the [Nuxt quickstart](https://c15t.com/docs/frameworks/nuxt/quickstart).
145
+
146
+ **Vue**
147
+
148
+ Use the kernel already provided by the Vue plugin. Merge this setup into
149
+ `App.vue`, whose lifetime covers the application:
150
+
151
+ ```vue title="src/App.vue"
152
+ <script setup lang="ts">
153
+ import { onMounted, onUnmounted } from 'vue';
154
+ import { createScriptLoader } from 'c15t/modules/script-loader';
155
+ import { useConsentKernel } from 'c15t/vue/vue-plugin';
156
+ import ConsentRoot from 'c15t/vue/consent-root';
157
+ import { scripts } from './consent-scripts';
158
+
159
+ const kernel = useConsentKernel();
160
+ let loader: ReturnType<typeof createScriptLoader> | undefined;
161
+
162
+ onMounted(() => {
163
+ loader = createScriptLoader({ kernel, scripts });
164
+ });
165
+ onUnmounted(() => loader?.dispose());
166
+ </script>
167
+
168
+ <template>
169
+ <ConsentRoot />
170
+ <main>Your application</main>
171
+ </template>
172
+ ```
173
+
174
+ Keep your existing page content and preferences link. The plugin still owns
175
+ the kernel and persistence; this component owns only the vendor loader.
176
+ Do not register the same scripts in plugin configuration as well. See the
177
+ [Vue quickstart](https://c15t.com/docs/frameworks/vue/quickstart).
178
+
179
+ **Astro**
180
+
181
+ Point the existing Astro integration at a client module. Keep its `mode`,
182
+ `ui` and framework integration from the [Astro quickstart](https://c15t.com/docs/frameworks/astro/quickstart).
183
+ Import `fileURLToPath` in your Astro configuration:
184
+
185
+ ```js title="astro.config.mjs"
186
+ import { fileURLToPath } from 'node:url';
187
+ ```
188
+
189
+ Add this option to the existing `c15t({ ... })` call. Resolve the path from
190
+ the configuration file because Astro injects the import into a virtual module:
191
+
192
+ ```js
193
+ clientEntrypoint: fileURLToPath(new URL('./src/c15t.client.ts', import.meta.url)),
194
+ ```
195
+
196
+ Export the scripts from that module:
197
+
198
+ ```ts title="src/c15t.client.ts"
199
+ import type { C15tClientOptionsExtension } from '@c15t/astro';
200
+ import { scripts } from './consent-scripts';
201
+
202
+ export default { scripts } satisfies C15tClientOptionsExtension;
203
+ ```
204
+
205
+ The integration passes this extension to its shared browser runtime. Vendor
206
+ helpers contain callbacks, so do not put them in the serialized `scripts`
207
+ option in `astro.config.mjs`. Keep one runtime across consent islands and
208
+ `ClientRouter` navigation.
209
+
210
+ **Svelte**
211
+
212
+ Import the scripts in the component that owns your existing provider and
213
+ pass them as a top-level prop:
214
+
215
+ ```svelte title="src/App.svelte"
216
+ <script lang="ts">
217
+ import { ConsentManagerProvider, hosted } from '@c15t/svelte';
218
+ import { scripts } from './consent-scripts';
219
+
220
+ const backendURL = import.meta.env.VITE_C15T_BACKEND_URL;
221
+ if (!backendURL) throw new Error('Set VITE_C15T_BACKEND_URL');
222
+ const mode = hosted({ url: backendURL });
223
+ </script>
224
+
225
+ <ConsentManagerProvider {mode} {scripts}>
226
+ <!-- Keep your application, consent UI and preferences link here. -->
227
+ </ConsentManagerProvider>
228
+ ```
229
+
230
+ Retain the styles and consent UI from the [Svelte quickstart](https://c15t.com/docs/frameworks/svelte/quickstart).
231
+ The provider owns the loader and disposes it on unmount.
232
+
233
+ **SvelteKit**
234
+
235
+ Add the scripts to the existing root layout provider. Keep the server load
236
+ and its serializable prefetch data from the [SvelteKit quickstart](https://c15t.com/docs/frameworks/sveltekit/quickstart).
237
+
238
+ ```svelte title="src/routes/+layout.svelte"
239
+ <script lang="ts">
240
+ import { ConsentManagerProvider, hosted } from '@c15t/svelte';
241
+ import { scripts } from '../consent-scripts';
242
+
243
+ let { children, data } = $props();
244
+ const mode = hosted({ url: data.backendURL });
245
+ </script>
246
+
247
+ <ConsentManagerProvider {mode} {scripts} prefetch={data.prefetch}>
248
+ {@render children()}
249
+ <!-- Keep your consent UI and preferences link here. -->
250
+ </ConsentManagerProvider>
251
+ ```
252
+
253
+ Import vendor helpers in the layout component, not in `+layout.server.ts`.
254
+ For static hosting, keep your browser-only `mode` setup and omit request
255
+ prefetch; the `scripts` prop stays the same. If you pass an externally owned
256
+ `runtime` to the provider, register scripts when creating that runtime instead.
257
+
258
+ **JavaScript**
259
+
260
+ Attach the loader to your existing kernel before calling
261
+ `kernel.commands.init()`:
262
+
263
+ ```ts
264
+ import { createScriptLoader } from 'c15t/modules/script-loader';
265
+ import { scripts } from './consent-scripts';
266
+
267
+ const loader = createScriptLoader({ kernel, scripts });
268
+ ```
269
+
270
+ Call `loader.dispose()` when that application instance is destroyed.
271
+ `kernel` is the hosted kernel from your quickstart. A provider-owned kernel
272
+ already has a loader; do not attach a second one. See
273
+ [JavaScript script loading](../frameworks/javascript/script-loader.md).
274
+
275
+ ## Consent Mode is not a zero-request gate
276
+
277
+ This helper sets `alwaysLoad: true`. It prepares the Google queue, sends consent
278
+ defaults and updates, and loads Google's script even before a visitor makes a
279
+ choice. That is different from preventing any request to Google until consent.
280
+ Google describes the distinction in its
281
+ [Consent Mode overview](https://developers.google.com/tag-platform/security/concepts/consent-mode).
282
+
283
+ The default mapping is:
284
+
285
+ | c15t category | Google consent types |
286
+ | --------------- | -------------------------------------------------- |
287
+ | `necessary` | `security_storage` |
288
+ | `functionality` | `functionality_storage` |
289
+ | `measurement` | `analytics_storage` |
290
+ | `marketing` | `ad_storage`, `ad_user_data`, `ad_personalization` |
291
+ | `experience` | `personalization_storage` |
292
+
293
+ `consentMapping` replaces the mapping when supplied. Keep the full set of
294
+ signals your integration needs. Test both default and update commands and the
295
+ actual tag behavior. Do not infer a saved grant from an allowed default under an
296
+ opt-out policy.
297
+
298
+ ## Configure the container too
299
+
300
+ Loading GTM with consent signals does not make every custom tag consent-aware.
301
+ Configure the appropriate consent checks and triggers for tags inside the
302
+ container. Inspect their requests after rejection and revocation, including
303
+ non-Google tags. Use Google Tag Assistant alongside the browser Network panel.
304
+
305
+ If the requirement is no Google request before permission, do not deploy this
306
+ always-loaded helper unchanged. Choose and verify an explicitly gated setup.
@@ -0,0 +1,305 @@
1
+ ---
2
+ title: Google Tag
3
+ description: Configure gtag with c15t Consent Mode signals and understand its
4
+ loading behavior.
5
+ group: integrations
6
+ ---
7
+
8
+ ## Register gtag
9
+
10
+ | Package manager | Command |
11
+ | :-------------- | :-------------------------- |
12
+ | npm | `npm install @c15t/scripts` |
13
+ | pnpm | `pnpm add @c15t/scripts` |
14
+ | yarn | `yarn add @c15t/scripts` |
15
+ | bun | `bun add @c15t/scripts` |
16
+
17
+ ```ts title="src/consent-scripts.ts"
18
+ import { gtag } from '@c15t/scripts/google-tag';
19
+
20
+ export const scripts = [gtag({ id: 'G-XXXXXXXXXX', category: 'measurement' })];
21
+ ```
22
+
23
+ Use your Google tag ID and pass `scripts` to the existing provider options.
24
+ Choose `marketing` for a configuration whose purpose is advertising. The
25
+ category describes the integration but does not override `alwaysLoad`.
26
+ Remove a separately installed `gtag.js` snippet or a duplicate tag-manager
27
+ configuration before testing.
28
+
29
+ ## Register the scripts
30
+
31
+ Complete your [framework quickstart](https://c15t.com/docs/frameworks) first. Keep its Inth
32
+ endpoint, policy, styles and consent UI. Remove the vendor's original script,
33
+ SDK initializer or tag-manager entry so c15t owns loading once.
34
+
35
+ The `scripts` export in `src/consent-scripts.ts` is a configuration, not an
36
+ initializer. Add it to your existing consent owner using the registration point
37
+ below. These are partial edits to that owner, not additional providers.
38
+
39
+ **Next.js**
40
+
41
+ Import the configuration into the client boundary from your router guide:
42
+
43
+ ```ts
44
+ import { ConsentRoot } from 'c15t/next';
45
+ import { scripts } from './consent-scripts';
46
+ ```
47
+
48
+ Keep the server-resolved `state` and shared `consentConfig` from your
49
+ router guide. Its manifest, init and save URLs stay in effect. Add
50
+ `scripts` as a top-level prop on the existing root:
51
+
52
+ ```tsx
53
+ <ConsentRoot state={state} config={consentConfig} scripts={scripts}>
54
+ {children}
55
+ </ConsentRoot>
56
+ ```
57
+
58
+ For a Pages Router or static-export setup using `ConsentProvider`, add
59
+ `scripts` to its existing `options` instead. Keep the router-specific setup
60
+ from [Next.js script loading](https://c15t.com/docs/frameworks/next/script-loader).
61
+
62
+ **TanStack Start**
63
+
64
+ In your existing root route component, import the scripts alongside
65
+ `ConsentRoot`. Keep the server loader from the [TanStack Start quickstart](https://c15t.com/docs/frameworks/tanstack-start/quickstart).
66
+
67
+ ```tsx
68
+ import { Outlet } from '@tanstack/react-router';
69
+ import { ConsentRoot } from 'c15t/tanstack-start';
70
+ import { scripts } from '../consent-scripts';
71
+
72
+ function Root() {
73
+ const state = Route.useLoaderData();
74
+ return (
75
+ <ConsentRoot state={state} backendURL={backendURL} initRoute={false} scripts={scripts}>
76
+ <Outlet />
77
+ {/* Keep your consent banner, dialog and preferences link here. */}
78
+ </ConsentRoot>
79
+ );
80
+ }
81
+ ```
82
+
83
+ This edits the existing route. `Route` and `backendURL` come from its setup;
84
+ keep the document shell and head components if they are part of your root.
85
+ `initRoute={false}` keeps the quickstart's direct-backend initialization.
86
+ If your app mounts a consent server route, retain its existing `initRoute`
87
+ instead. Do not return script callbacks from a server function or route loader.
88
+
89
+ **React**
90
+
91
+ Import the scripts into your existing provider component:
92
+
93
+ ```ts
94
+ import { ConsentProvider } from 'c15t/react';
95
+ import { scripts } from './consent-scripts';
96
+ ```
97
+
98
+ Keep the existing options and add `scripts`:
99
+
100
+ ```tsx
101
+ <ConsentProvider options={{ ...consentOptions, scripts }}>
102
+ {children}
103
+ </ConsentProvider>
104
+ ```
105
+
106
+ Here `consentOptions` is your existing configuration, including
107
+ `mode: hosted({ url: backendURL })`. Keep the banner, dialog and preferences
108
+ link inside the provider. See [React script loading](https://c15t.com/docs/frameworks/react/script-loader).
109
+
110
+ **Nuxt**
111
+
112
+ Attach one loader from the root `app.vue`, after the Nuxt module has
113
+ started its browser runtime. This keeps vendor callbacks in application code rather
114
+ than serialized `nuxt.config.ts` runtime configuration.
115
+
116
+ ```vue title="app/app.vue"
117
+ <script setup lang="ts">
118
+ import { onUnmounted } from 'vue';
119
+ import { createScriptLoader } from 'c15t/modules/script-loader';
120
+ import { scripts } from '../src/consent-scripts';
121
+
122
+ const nuxtApp = useNuxtApp();
123
+ const kernel = useConsentKernel();
124
+ let loader: ReturnType<typeof createScriptLoader> | undefined;
125
+
126
+ const removeMountedHook = nuxtApp.hook('app:mounted', () => {
127
+ loader = createScriptLoader({ kernel, scripts });
128
+ });
129
+ onUnmounted(() => {
130
+ removeMountedHook();
131
+ loader?.dispose();
132
+ });
133
+ </script>
134
+
135
+ <template>
136
+ <ConsentRoot />
137
+ <NuxtPage />
138
+ </template>
139
+ ```
140
+
141
+ Merge the setup code into your root and retain its footer and preferences
142
+ link. `useConsentKernel` is auto-imported by the c15t Nuxt module. Adjust the
143
+ relative script import if your `app.vue` is at the project root. This loader
144
+ waits until the module has applied browser persistence and privacy signals,
145
+ then reads the current snapshot and observes future changes. Do not also register these scripts
146
+ in another loader. See the [Nuxt quickstart](https://c15t.com/docs/frameworks/nuxt/quickstart).
147
+
148
+ **Vue**
149
+
150
+ Use the kernel already provided by the Vue plugin. Merge this setup into
151
+ `App.vue`, whose lifetime covers the application:
152
+
153
+ ```vue title="src/App.vue"
154
+ <script setup lang="ts">
155
+ import { onMounted, onUnmounted } from 'vue';
156
+ import { createScriptLoader } from 'c15t/modules/script-loader';
157
+ import { useConsentKernel } from 'c15t/vue/vue-plugin';
158
+ import ConsentRoot from 'c15t/vue/consent-root';
159
+ import { scripts } from './consent-scripts';
160
+
161
+ const kernel = useConsentKernel();
162
+ let loader: ReturnType<typeof createScriptLoader> | undefined;
163
+
164
+ onMounted(() => {
165
+ loader = createScriptLoader({ kernel, scripts });
166
+ });
167
+ onUnmounted(() => loader?.dispose());
168
+ </script>
169
+
170
+ <template>
171
+ <ConsentRoot />
172
+ <main>Your application</main>
173
+ </template>
174
+ ```
175
+
176
+ Keep your existing page content and preferences link. The plugin still owns
177
+ the kernel and persistence; this component owns only the vendor loader.
178
+ Do not register the same scripts in plugin configuration as well. See the
179
+ [Vue quickstart](https://c15t.com/docs/frameworks/vue/quickstart).
180
+
181
+ **Astro**
182
+
183
+ Point the existing Astro integration at a client module. Keep its `mode`,
184
+ `ui` and framework integration from the [Astro quickstart](https://c15t.com/docs/frameworks/astro/quickstart).
185
+ Import `fileURLToPath` in your Astro configuration:
186
+
187
+ ```js title="astro.config.mjs"
188
+ import { fileURLToPath } from 'node:url';
189
+ ```
190
+
191
+ Add this option to the existing `c15t({ ... })` call. Resolve the path from
192
+ the configuration file because Astro injects the import into a virtual module:
193
+
194
+ ```js
195
+ clientEntrypoint: fileURLToPath(new URL('./src/c15t.client.ts', import.meta.url)),
196
+ ```
197
+
198
+ Export the scripts from that module:
199
+
200
+ ```ts title="src/c15t.client.ts"
201
+ import type { C15tClientOptionsExtension } from '@c15t/astro';
202
+ import { scripts } from './consent-scripts';
203
+
204
+ export default { scripts } satisfies C15tClientOptionsExtension;
205
+ ```
206
+
207
+ The integration passes this extension to its shared browser runtime. Vendor
208
+ helpers contain callbacks, so do not put them in the serialized `scripts`
209
+ option in `astro.config.mjs`. Keep one runtime across consent islands and
210
+ `ClientRouter` navigation.
211
+
212
+ **Svelte**
213
+
214
+ Import the scripts in the component that owns your existing provider and
215
+ pass them as a top-level prop:
216
+
217
+ ```svelte title="src/App.svelte"
218
+ <script lang="ts">
219
+ import { ConsentManagerProvider, hosted } from '@c15t/svelte';
220
+ import { scripts } from './consent-scripts';
221
+
222
+ const backendURL = import.meta.env.VITE_C15T_BACKEND_URL;
223
+ if (!backendURL) throw new Error('Set VITE_C15T_BACKEND_URL');
224
+ const mode = hosted({ url: backendURL });
225
+ </script>
226
+
227
+ <ConsentManagerProvider {mode} {scripts}>
228
+ <!-- Keep your application, consent UI and preferences link here. -->
229
+ </ConsentManagerProvider>
230
+ ```
231
+
232
+ Retain the styles and consent UI from the [Svelte quickstart](https://c15t.com/docs/frameworks/svelte/quickstart).
233
+ The provider owns the loader and disposes it on unmount.
234
+
235
+ **SvelteKit**
236
+
237
+ Add the scripts to the existing root layout provider. Keep the server load
238
+ and its serializable prefetch data from the [SvelteKit quickstart](https://c15t.com/docs/frameworks/sveltekit/quickstart).
239
+
240
+ ```svelte title="src/routes/+layout.svelte"
241
+ <script lang="ts">
242
+ import { ConsentManagerProvider, hosted } from '@c15t/svelte';
243
+ import { scripts } from '../consent-scripts';
244
+
245
+ let { children, data } = $props();
246
+ const mode = hosted({ url: data.backendURL });
247
+ </script>
248
+
249
+ <ConsentManagerProvider {mode} {scripts} prefetch={data.prefetch}>
250
+ {@render children()}
251
+ <!-- Keep your consent UI and preferences link here. -->
252
+ </ConsentManagerProvider>
253
+ ```
254
+
255
+ Import vendor helpers in the layout component, not in `+layout.server.ts`.
256
+ For static hosting, keep your browser-only `mode` setup and omit request
257
+ prefetch; the `scripts` prop stays the same. If you pass an externally owned
258
+ `runtime` to the provider, register scripts when creating that runtime instead.
259
+
260
+ **JavaScript**
261
+
262
+ Attach the loader to your existing kernel before calling
263
+ `kernel.commands.init()`:
264
+
265
+ ```ts
266
+ import { createScriptLoader } from 'c15t/modules/script-loader';
267
+ import { scripts } from './consent-scripts';
268
+
269
+ const loader = createScriptLoader({ kernel, scripts });
270
+ ```
271
+
272
+ Call `loader.dispose()` when that application instance is destroyed.
273
+ `kernel` is the hosted kernel from your quickstart. A provider-owned kernel
274
+ already has a loader; do not attach a second one. See
275
+ [JavaScript script loading](../frameworks/javascript/script-loader.md).
276
+
277
+ ## Consent Mode is not a zero-request gate
278
+
279
+ This helper sets `alwaysLoad: true`. It prepares the Google queue, sends consent
280
+ defaults and updates, and loads Google's script even before a visitor makes a
281
+ choice. That is different from preventing any request to Google until consent.
282
+ Google describes the distinction in its
283
+ [Consent Mode overview](https://developers.google.com/tag-platform/security/concepts/consent-mode).
284
+
285
+ The default mapping is:
286
+
287
+ | c15t category | Google consent types |
288
+ | --------------- | -------------------------------------------------- |
289
+ | `necessary` | `security_storage` |
290
+ | `functionality` | `functionality_storage` |
291
+ | `measurement` | `analytics_storage` |
292
+ | `marketing` | `ad_storage`, `ad_user_data`, `ad_personalization` |
293
+ | `experience` | `personalization_storage` |
294
+
295
+ `consentMapping` replaces the mapping when supplied. Keep the full set of
296
+ signals your integration needs. Test both default and update commands and the
297
+ actual tag behavior. Do not infer a saved grant from an allowed default under an
298
+ opt-out policy.
299
+
300
+ ## Test event delivery
301
+
302
+ Confirm the initial consent command precedes configuration and event commands.
303
+ Then reject, grant and revoke permission and inspect updates. Test page-view
304
+ behavior during client navigation so a separate routing integration does not
305
+ send duplicate events or bypass your chosen consent behavior.