@c15t/react 3.1.0 → 3.2.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 +35 -5
- package/README.md +2 -2
- package/dist/component-hooks/use-consent-gate.js +2 -0
- package/dist/component-hooks/use-consent-labels.js +2 -0
- package/dist/component-hooks/use-consent-text-direction.js +2 -0
- package/dist/component-hooks/use-vendors-listed-under.js +2 -0
- package/dist/components/consent-gate/atoms.js +1 -1
- package/dist/components/consent-gate/consent-gate.js +1 -1
- package/dist/components/iab-prompt/atoms/root.js +1 -1
- package/dist/components/panel-trigger/atoms/toolbar.js +1 -1
- package/dist/components/preferences/atoms/button.js +1 -1
- package/dist/components/preferences/atoms/vendor-list.js +1 -1
- package/dist/components/prompt/atoms/root.js +1 -1
- package/dist/components/prompt/components.js +1 -1
- package/dist/components/prompt/policy-actions.js +1 -1
- package/dist/components/prompt/prompt.js +1 -1
- package/dist/components/prompt/surface-context.js +1 -1
- package/dist/components/prompt/use-banner-copy.js +1 -1
- package/dist/components/shared/streamed-surface.js +1 -1
- package/dist/headless.js +1 -1
- package/dist/index-parts/offline.js +1 -1
- package/dist/modes.js +1 -1
- package/dist/styles.tw3.css +2 -2
- package/dist/transports/offline.js +1 -1
- package/dist/version.js +1 -1
- package/dist-types/component-hooks/use-consent-gate.d.ts +102 -0
- package/dist-types/component-hooks/use-consent-labels.d.ts +32 -0
- package/dist-types/component-hooks/use-consent-text-direction.d.ts +22 -0
- package/dist-types/component-hooks/use-vendors-listed-under.d.ts +30 -0
- package/dist-types/components/prompt/atoms/root.d.ts +3 -3
- package/dist-types/components/prompt/prompt.d.ts +4 -3
- package/dist-types/components/prompt/surface-context.d.ts +1 -14
- package/dist-types/components/prompt/use-banner-copy.d.ts +8 -3
- package/dist-types/components/shared/streamed-surface.d.ts +47 -10
- package/dist-types/headless.d.ts +10 -1
- package/dist-types/hooks/use-iab-policy-guard.d.ts +17 -1
- package/dist-types/hooks/use-scroll-lock.d.ts +16 -2
- package/dist-types/index-parts/offline.d.ts +1 -1
- package/dist-types/modes.d.ts +1 -1
- package/dist-types/module-hooks/script-loader.d.ts +9 -0
- package/dist-types/provider.d.ts +3 -3
- package/dist-types/transports/offline.d.ts +2 -2
- package/dist-types/version.d.ts +1 -1
- package/docs/README.md +35 -5
- package/docs/concepts/choose-your-setup.md +9 -9
- package/docs/concepts/consent-state.md +81 -9
- package/docs/concepts/data-fetching.md +30 -23
- package/docs/concepts/modes.md +87 -35
- package/docs/customization/recipes.md +4 -4
- package/docs/customization/stylesheets.md +42 -3
- package/docs/customization/tailwind.md +17 -34
- package/docs/customization/translations.md +18 -12
- package/docs/frameworks/react/clear-on-revocation.md +3 -2
- package/docs/frameworks/react/components/consent-banner.md +3 -3
- package/docs/frameworks/react/components/consent-provider.md +29 -29
- package/docs/frameworks/react/gpp.md +1 -1
- package/docs/frameworks/react/headless.md +146 -19
- package/docs/frameworks/react/hooks.md +2 -1
- package/docs/frameworks/react/iab.md +8 -1
- package/docs/frameworks/react/quickstart.md +2 -2
- package/docs/frameworks/react/rendering.md +1 -1
- package/docs/frameworks/react/translations.md +9 -9
- package/docs/frameworks/react/troubleshooting.md +1 -1
- package/docs/frameworks/react/upgrade-v3.md +39 -32
- package/docs/frameworks/react/vendor-consent.md +5 -0
- package/docs/guides/banner-experiments.md +3 -3
- package/docs/guides/troubleshooting.md +3 -2
- package/docs/integrations/activecampaign.md +297 -0
- package/docs/integrations/ada.md +396 -0
- package/docs/integrations/adobe-analytics.md +2 -2
- package/docs/integrations/adobe-target.md +460 -0
- package/docs/integrations/adroll.md +336 -0
- package/docs/integrations/ahrefs-analytics.md +2 -2
- package/docs/integrations/amazon-ads.md +424 -0
- package/docs/integrations/amplitude.md +2 -2
- package/docs/integrations/appcues.md +368 -0
- package/docs/integrations/attentive.md +313 -0
- package/docs/integrations/building-integrations.md +29 -16
- package/docs/integrations/clay.md +305 -0
- package/docs/integrations/clearbit.md +3 -3
- package/docs/integrations/cloudflare-web-analytics.md +2 -2
- package/docs/integrations/cloudflare-zaraz.md +2 -2
- package/docs/integrations/crisp.md +2 -2
- package/docs/integrations/customer-io.md +369 -0
- package/docs/integrations/databuddy.md +127 -52
- package/docs/integrations/default-com.md +497 -0
- package/docs/integrations/dynamic-yield.md +373 -0
- package/docs/integrations/fathom-analytics.md +2 -2
- package/docs/integrations/front-chat.md +2 -2
- package/docs/integrations/fullstory.md +298 -0
- package/docs/integrations/gainsight-px.md +418 -0
- package/docs/integrations/google-maps.md +2 -2
- package/docs/integrations/google-tag-manager.md +59 -2
- package/docs/integrations/google-tag.md +2 -2
- package/docs/integrations/gorgias.md +365 -0
- package/docs/integrations/heap.md +2 -2
- package/docs/integrations/hightouch.md +2 -2
- package/docs/integrations/hotjar.md +40 -26
- package/docs/integrations/hubspot.md +529 -0
- package/docs/integrations/insider.md +550 -0
- package/docs/integrations/intercom.md +2 -2
- package/docs/integrations/klaviyo.md +2 -2
- package/docs/integrations/linkedin-insights.md +2 -2
- package/docs/integrations/liveintent.md +327 -0
- package/docs/integrations/logrocket.md +2 -2
- package/docs/integrations/lucky-orange.md +336 -0
- package/docs/integrations/marketo.md +309 -0
- package/docs/integrations/matomo-analytics.md +2 -2
- package/docs/integrations/meta-pixel.md +2 -2
- package/docs/integrations/microsoft-clarity.md +2 -2
- package/docs/integrations/microsoft-uet.md +2 -2
- package/docs/integrations/mixpanel-analytics.md +2 -2
- package/docs/integrations/one-dollar-stats.md +2 -2
- package/docs/integrations/openai-pixel.md +2 -2
- package/docs/integrations/optimizely.md +411 -0
- package/docs/integrations/oracle-eloqua.md +301 -0
- package/docs/integrations/overview.md +128 -81
- package/docs/integrations/pendo.md +339 -0
- package/docs/integrations/pinterest-tag.md +2 -2
- package/docs/integrations/pirsch.md +2 -2
- package/docs/integrations/plausible-analytics.md +2 -2
- package/docs/integrations/posthog.md +2 -2
- package/docs/integrations/promptwatch.md +2 -2
- package/docs/integrations/rb2b.md +363 -0
- package/docs/integrations/reddit-pixel.md +2 -2
- package/docs/integrations/rudderstack.md +2 -2
- package/docs/integrations/rybbit-analytics.md +2 -2
- package/docs/integrations/salesforce-pardot.md +342 -0
- package/docs/integrations/segment.md +2 -2
- package/docs/integrations/sentry.md +2 -2
- package/docs/integrations/shopify.md +323 -0
- package/docs/integrations/snapchat-pixel.md +2 -2
- package/docs/integrations/statable-analytics.md +345 -0
- package/docs/integrations/the-trade-desk.md +328 -0
- package/docs/integrations/tiktok-pixel.md +2 -2
- package/docs/integrations/umami-analytics.md +2 -2
- package/docs/integrations/vector.md +333 -0
- package/docs/integrations/vercel-analytics.md +2 -2
- package/docs/integrations/vercel-speed-insights.md +7 -2
- package/docs/integrations/wisepops.md +416 -0
- package/docs/integrations/x-pixel.md +2 -2
- package/docs/integrations/youtube.md +2 -2
- package/docs/integrations/zendesk.md +359 -0
- package/package.json +10 -32
- package/dist/components/prompt/resolve-banner-primary-actions.js +0 -1
- package/dist-types/components/prompt/resolve-banner-primary-actions.d.ts +0 -14
|
@@ -36,22 +36,22 @@ with your framework, follow any vendor guide, for example
|
|
|
36
36
|
|
|
37
37
|
## Script fields
|
|
38
38
|
|
|
39
|
-
| Field | Default | Behavior
|
|
40
|
-
| ----------------------------------------------- | ---------------------- |
|
|
41
|
-
| `id` | Required | Stable identifier. c15t tracks the script by it across renders.
|
|
42
|
-
| `category` | Required | A category name, or a condition such as `{ or: ['measurement', 'marketing'] }`, `{ and: [...] }` or `{ not: '...' }`.
|
|
43
|
-
| `src` / `textContent` | None | Set exactly one, unless `callbackOnly` is `true`.
|
|
44
|
-
| `vendor` | None | Vendor slug, so a visitor can turn this vendor off inside an allowed category.
|
|
45
|
-
| `callbackOnly` | `false` |
|
|
46
|
-
| `alwaysLoad` | `false` | Load regardless of permission.
|
|
47
|
-
| `persistAfterConsentRevoked` | `false` |
|
|
48
|
-
| `onBeforeLoad`, `onLoad`, `onError` | None | Run before the element is added, after it loads, and if it fails.
|
|
49
|
-
| `onConsentChange` | None | Runs when permissions change after the script has loaded, and when it is removed.
|
|
50
|
-
| `onDispose` | None | Runs when this configuration is removed or its loader is disposed. Revocation alone does not call it.
|
|
51
|
-
| `target` | `'head'` | `'head'` or `'body'`.
|
|
52
|
-
| `async`, `defer`, `attributes`, `fetchPriority` | None | Copied to the script element.
|
|
53
|
-
| `nonce` | The provider's `nonce` | Content Security Policy nonce for this element.
|
|
54
|
-
| `anonymizeId` | `true` | Use a random element ID. Set `false` for `c15t-script-<id>`.
|
|
39
|
+
| Field | Default | Behavior |
|
|
40
|
+
| ----------------------------------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
41
|
+
| `id` | Required | Stable identifier. c15t tracks the script by it across renders. |
|
|
42
|
+
| `category` | Required | A category name, or a condition such as `{ or: ['measurement', 'marketing'] }`, `{ and: [...] }` or `{ not: '...' }`. |
|
|
43
|
+
| `src` / `textContent` | None | Set exactly one, unless `callbackOnly` is `true` or returns `true`. |
|
|
44
|
+
| `vendor` | None | Vendor slug, so a visitor can turn this vendor off inside an allowed category. |
|
|
45
|
+
| `callbackOnly` | `false` | `true` or a zero-argument predicate returning `true` runs callbacks without adding a script element. |
|
|
46
|
+
| `alwaysLoad` | `false` | Load regardless of permission. |
|
|
47
|
+
| `persistAfterConsentRevoked` | `false` | `true` keeps the element after withdrawal, including pending downloads. `'loaded'` keeps only elements whose load event completed; pending and failed loads are removed. |
|
|
48
|
+
| `onBeforeLoad`, `onLoad`, `onError` | None | Run before the element is added, after it loads, and if it fails. |
|
|
49
|
+
| `onConsentChange` | None | Runs when permissions change after the script has loaded, and when it is removed. |
|
|
50
|
+
| `onDispose` | None | Runs when this configuration is removed or its loader is disposed. Revocation alone does not call it. |
|
|
51
|
+
| `target` | `'head'` | `'head'` or `'body'`. |
|
|
52
|
+
| `async`, `defer`, `attributes`, `fetchPriority` | None | Copied to the script element. |
|
|
53
|
+
| `nonce` | The provider's `nonce` | Content Security Policy nonce for this element. |
|
|
54
|
+
| `anonymizeId` | `true` | Use a random element ID. Set `false` for `c15t-script-<id>`. |
|
|
55
55
|
|
|
56
56
|
Every callback receives `{ id, elementId, hasConsent, consents }`, plus
|
|
57
57
|
`vendor` when the script declares one, and `element` for scripts with an
|
|
@@ -137,6 +137,19 @@ a callback-only script runs `onBeforeLoad` and `onLoad` only once permission is
|
|
|
137
137
|
allowed. [PostHog](./posthog.md#use-an-existing-posthog-sdk) shows
|
|
138
138
|
this pattern with a real SDK.
|
|
139
139
|
|
|
140
|
+
For runtime detection, `callbackOnly` also accepts a zero-argument function
|
|
141
|
+
that returns a boolean. c15t evaluates it before each new mount, when reading
|
|
142
|
+
diagnostics, and when selecting scripts for server startup. Return `true` to
|
|
143
|
+
use callbacks alone, or `false` to load `src` or `textContent`. Keep the function
|
|
144
|
+
free of side effects and safe to call on the server. It can run more than once,
|
|
145
|
+
and it does not remove an element already mounted by that registration.
|
|
146
|
+
A function survives script customization with object spread, so later mounts
|
|
147
|
+
check the current runtime instead of a value captured when the copy was made.
|
|
148
|
+
Keep the function reference stable across script updates, for example by
|
|
149
|
+
defining it at module level. A new function counts as a resource change and
|
|
150
|
+
remounts the registration. If a predicate throws during server startup, c15t
|
|
151
|
+
leaves that script to the client loader and starts unrelated scripts normally.
|
|
152
|
+
|
|
140
153
|
## Revocation and verification
|
|
141
154
|
|
|
142
155
|
By default c15t reloads the page when a visitor turns off a category or vendor
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Clay
|
|
3
|
+
description: Load Clay web intent only after marketing consent and understand
|
|
4
|
+
its storage and revocation limits.
|
|
5
|
+
seoTitle: Clay web intent consent with c15t
|
|
6
|
+
seoDescription: Gate Clay visitor identification on marketing consent with c15t
|
|
7
|
+
and verify the loader, storage and revocation behavior.
|
|
8
|
+
icon: radar
|
|
9
|
+
group: integrations
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
The `clay` helper waits for `marketing` consent before loading Clay web intent.
|
|
13
|
+
Clay resolves visitors' IP addresses to companies and can use device fingerprints
|
|
14
|
+
and identifiers from other vendors for sales profiling.
|
|
15
|
+
|
|
16
|
+
## Configure Clay
|
|
17
|
+
|
|
18
|
+
Copy the `id` from Settings > Web intent > JavaScript Snippet. Remove any direct
|
|
19
|
+
Clay snippet or GTM copy so it cannot bypass c15t.
|
|
20
|
+
|
|
21
|
+
| Package manager | Command |
|
|
22
|
+
| :-------------- | :------------------------------- |
|
|
23
|
+
| npm | `npm install @c15t/integrations` |
|
|
24
|
+
| pnpm | `pnpm add @c15t/integrations` |
|
|
25
|
+
| yarn | `yarn add @c15t/integrations` |
|
|
26
|
+
| bun | `bun add @c15t/integrations` |
|
|
27
|
+
|
|
28
|
+
```ts title="src/consent-scripts.ts"
|
|
29
|
+
import { clay } from '@c15t/integrations/clay';
|
|
30
|
+
|
|
31
|
+
export const scripts = [clay({ siteId: 'YOUR_SITE_ID' })];
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Register the scripts
|
|
35
|
+
|
|
36
|
+
Complete your [framework quickstart](https://c15t.com/docs/frameworks) first. Keep its Inth
|
|
37
|
+
endpoint, policy, styles and consent UI. Remove the vendor's original script,
|
|
38
|
+
SDK initializer or tag-manager entry, so the vendor loads only through c15t.
|
|
39
|
+
|
|
40
|
+
The vendor pages put the helper in `src/consent-scripts.ts`. If your framework
|
|
41
|
+
quickstart already has a `scripts` array, such as the one in `c15t.config.ts`
|
|
42
|
+
in the Next.js guide, add the helper to that array instead of creating a
|
|
43
|
+
second file.
|
|
44
|
+
The `scripts` export is a configuration, not an initializer. Add it to the c15t provider you already have, at the registration
|
|
45
|
+
point for your framework below. These are edits to that provider, not a second
|
|
46
|
+
provider.
|
|
47
|
+
|
|
48
|
+
**Next.js**
|
|
49
|
+
|
|
50
|
+
Add the configuration to `scripts` in `c15t.config.ts`, next to
|
|
51
|
+
`next.config.ts`:
|
|
52
|
+
|
|
53
|
+
```ts title="c15t.config.ts"
|
|
54
|
+
import { defineConsentConfig } from 'c15t/next';
|
|
55
|
+
import { scripts } from './src/consent-scripts';
|
|
56
|
+
|
|
57
|
+
export default defineConsentConfig({ scripts });
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Keep the rest of your config, such as `mode` and `routePrefix`, in the
|
|
61
|
+
same call. `ConsentRoot` reads the config in the browser, so the layout
|
|
62
|
+
keeps passing only `state`. App Router, Pages Router and static export all
|
|
63
|
+
read the same file. See
|
|
64
|
+
[Next.js scripts and embeds](https://c15t.com/docs/frameworks/next/scripts).
|
|
65
|
+
|
|
66
|
+
**TanStack Start**
|
|
67
|
+
|
|
68
|
+
Import the configuration into your root route and pass it to the existing
|
|
69
|
+
`ConsentRoot` as a top-level prop. Keep the loader from the
|
|
70
|
+
[TanStack Start quickstart](https://c15t.com/docs/frameworks/tanstack-start/quickstart):
|
|
71
|
+
|
|
72
|
+
```tsx title="src/routes/__root.tsx"
|
|
73
|
+
import { scripts } from '../consent-scripts';
|
|
74
|
+
|
|
75
|
+
<ConsentRoot state={consent} scripts={scripts}>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Import vendor helpers in the root route module, not in a server function.
|
|
79
|
+
A server function's return value must be serializable, and script
|
|
80
|
+
configurations carry callbacks. See
|
|
81
|
+
[TanStack Start scripts](https://c15t.com/docs/frameworks/tanstack-start/scripts).
|
|
82
|
+
|
|
83
|
+
**React**
|
|
84
|
+
|
|
85
|
+
Add the configuration to the existing `ConsentProvider` options, next to
|
|
86
|
+
`mode`:
|
|
87
|
+
|
|
88
|
+
```tsx title="src/consent.tsx"
|
|
89
|
+
import { scripts } from './consent-scripts';
|
|
90
|
+
|
|
91
|
+
<ConsentProvider options={{ mode, scripts }}>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
`mode` is the `manifest()` value from the
|
|
95
|
+
[React quickstart](../frameworks/react/quickstart.md). Keep the banner,
|
|
96
|
+
dialog and preferences link inside the provider. See
|
|
97
|
+
[React scripts and embeds](../frameworks/react/scripts.md).
|
|
98
|
+
|
|
99
|
+
**Nuxt**
|
|
100
|
+
|
|
101
|
+
Register the scripts under the `c15t` key in `app/app.config.ts`. Adjust the
|
|
102
|
+
relative import to where you created `consent-scripts.ts`:
|
|
103
|
+
|
|
104
|
+
```ts title="app/app.config.ts"
|
|
105
|
+
import { scripts } from '../src/consent-scripts';
|
|
106
|
+
|
|
107
|
+
export default defineAppConfig({
|
|
108
|
+
c15t: { scripts },
|
|
109
|
+
});
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
The Nuxt module merges this over its options in `nuxt.config.ts` and starts
|
|
113
|
+
one script loader in the browser after hydration, once it has applied the
|
|
114
|
+
visitor's stored choice and privacy signals. Keep `scripts` out of
|
|
115
|
+
`nuxt.config.ts`, which reaches the browser as JSON and drops the vendor
|
|
116
|
+
callbacks. Write the vendor IDs into `consent-scripts.ts`. See
|
|
117
|
+
[Nuxt scripts and embeds](https://c15t.com/docs/frameworks/nuxt/scripts).
|
|
118
|
+
|
|
119
|
+
**Vue**
|
|
120
|
+
|
|
121
|
+
Pass the scripts to the existing `c15tVue` plugin call in `src/main.ts`:
|
|
122
|
+
|
|
123
|
+
```ts title="src/main.ts"
|
|
124
|
+
import { c15tVue, manifest } from 'c15t/vue/vue-plugin';
|
|
125
|
+
import { scripts } from './consent-scripts';
|
|
126
|
+
|
|
127
|
+
app.use(c15tVue, {
|
|
128
|
+
mode: manifest(),
|
|
129
|
+
scripts,
|
|
130
|
+
});
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Keep your existing `mode` and other options. The plugin starts one
|
|
134
|
+
script loader when the app mounts, after it has applied the visitor's stored
|
|
135
|
+
choice. Do not also call `createScriptLoader` from a component. See
|
|
136
|
+
[Vue scripts and embeds](https://c15t.com/docs/frameworks/vue/scripts).
|
|
137
|
+
|
|
138
|
+
**Astro**
|
|
139
|
+
|
|
140
|
+
Add the scripts to the client entrypoint from the
|
|
141
|
+
[Astro quickstart](https://c15t.com/docs/frameworks/astro/quickstart), `src/c15t.client.ts`,
|
|
142
|
+
which the integration finds on its own. Keep `astro.config.mjs` as it is.
|
|
143
|
+
If the module already exports scripts, combine the two arrays.
|
|
144
|
+
|
|
145
|
+
```ts title="src/c15t.client.ts"
|
|
146
|
+
import type { C15tClientOptionsExtension } from 'c15t/astro';
|
|
147
|
+
import { scripts } from './consent-scripts';
|
|
148
|
+
|
|
149
|
+
export default { scripts } satisfies C15tClientOptionsExtension;
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Vendor helpers contain callbacks, and the integration options in
|
|
153
|
+
`astro.config.mjs` are serialized into the page, so do not put helpers in
|
|
154
|
+
the integration's `scripts` option. The integration passes the client
|
|
155
|
+
entrypoint to the one runtime every page shares, including across
|
|
156
|
+
`ClientRouter` navigation.
|
|
157
|
+
|
|
158
|
+
**Svelte**
|
|
159
|
+
|
|
160
|
+
Import the scripts in the component that owns your existing provider and
|
|
161
|
+
pass them as a top-level prop:
|
|
162
|
+
|
|
163
|
+
```svelte title="src/App.svelte"
|
|
164
|
+
<script lang="ts">
|
|
165
|
+
import { ConsentProvider, manifest } from 'c15t/svelte';
|
|
166
|
+
import { scripts } from './consent-scripts';
|
|
167
|
+
</script>
|
|
168
|
+
|
|
169
|
+
<ConsentProvider mode={manifest()} {scripts}>
|
|
170
|
+
<!-- Keep your application, consent UI and preferences link here. -->
|
|
171
|
+
</ConsentProvider>
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Retain the styles and consent UI from the [Svelte quickstart](https://c15t.com/docs/frameworks/svelte/quickstart).
|
|
175
|
+
The provider owns the loader and disposes it on unmount.
|
|
176
|
+
|
|
177
|
+
**SvelteKit**
|
|
178
|
+
|
|
179
|
+
Add the scripts to the existing `ConsentRoot` in the root layout. Keep the
|
|
180
|
+
handle and the layout load from the [SvelteKit quickstart](https://c15t.com/docs/frameworks/sveltekit/quickstart).
|
|
181
|
+
|
|
182
|
+
```svelte title="src/routes/+layout.svelte"
|
|
183
|
+
<script lang="ts">
|
|
184
|
+
import { ConsentRoot } from 'c15t/svelte';
|
|
185
|
+
import { scripts } from '../consent-scripts';
|
|
186
|
+
|
|
187
|
+
let { children, data } = $props();
|
|
188
|
+
</script>
|
|
189
|
+
|
|
190
|
+
<ConsentRoot state={data.consent} {scripts}>
|
|
191
|
+
{@render children()}
|
|
192
|
+
<!-- Keep your consent UI and preferences link here. -->
|
|
193
|
+
</ConsentRoot>
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Import vendor helpers in the layout component, not in `+layout.server.ts`:
|
|
197
|
+
a server load cannot send functions to the browser. Prerendered, static and
|
|
198
|
+
SPA-mode pages use the same `scripts` prop. If you pass an externally owned
|
|
199
|
+
`runtime` to the provider, register scripts when creating that runtime instead.
|
|
200
|
+
|
|
201
|
+
**HTML**
|
|
202
|
+
|
|
203
|
+
The helpers in `@c15t/integrations` are ES modules that need a bundler. On a
|
|
204
|
+
page that loads the c15t script tag, paste the vendor's own snippet instead
|
|
205
|
+
and keep it inert until its category is allowed:
|
|
206
|
+
|
|
207
|
+
```html
|
|
208
|
+
<script type="text/plain" data-c15t-category="measurement">
|
|
209
|
+
// The vendor's snippet, unchanged
|
|
210
|
+
</script>
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Use the category this guide names for the vendor. c15t runs the snippet
|
|
214
|
+
once that category is allowed, and reloads the page when the visitor
|
|
215
|
+
withdraws it. Helper options on this page, such as `loadMode`, do not apply
|
|
216
|
+
to a pasted snippet. See [HTML scripts](https://c15t.com/docs/frameworks/html/scripts).
|
|
217
|
+
|
|
218
|
+
**JavaScript**
|
|
219
|
+
|
|
220
|
+
Pass the scripts to `init()` from `@c15t/browser`, next to your mode:
|
|
221
|
+
|
|
222
|
+
```ts
|
|
223
|
+
import { init, manifest } from '@c15t/browser';
|
|
224
|
+
import { scripts } from './consent-scripts';
|
|
225
|
+
|
|
226
|
+
const consent = init({
|
|
227
|
+
mode: manifest(),
|
|
228
|
+
scripts,
|
|
229
|
+
});
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
Keep the mode from your quickstart. With
|
|
233
|
+
`createConsentRuntime` from `c15t/runtime`, pass `scripts` to it instead.
|
|
234
|
+
A kernel you create yourself needs a loader from
|
|
235
|
+
`c15t/modules/script-loader`. Attach one loader per kernel. See
|
|
236
|
+
[JavaScript scripts](https://c15t.com/docs/frameworks/javascript/scripts).
|
|
237
|
+
|
|
238
|
+
## Options
|
|
239
|
+
|
|
240
|
+
| Option | Default | Behavior |
|
|
241
|
+
| ----------- | --------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
242
|
+
| `siteId` | Required | Public ID from Clay's snippet. Trimmed and URL-encoded. Non-string, blank or invalid IDs log an error and skip loading. |
|
|
243
|
+
| `scriptUrl` | `https://static.claydar.com/init.v1.js?id=<siteId>` | Override for a proxy or pinned loader. Keep the `id` query parameter because Clay reads `document.currentScript.src`. A blank override uses the default. |
|
|
244
|
+
|
|
245
|
+
## Loading and revocation
|
|
246
|
+
|
|
247
|
+
The loader runs from a real script element in the body after marketing consent.
|
|
248
|
+
It loads `cdn.claydar.com/releases/latest/radar.min.js`, which sends data to
|
|
249
|
+
`api.claydar.com`. Include those hosts in the matching CSP directives.
|
|
250
|
+
Measurement consent alone loads nothing. Clay's own CMP detection does not cover
|
|
251
|
+
c15t.
|
|
252
|
+
|
|
253
|
+
On load, the helper queues `giveCookieConsent`. On withdrawal it calls
|
|
254
|
+
`denyCookieConsent` when available. These methods were verified in the served
|
|
255
|
+
tracker, but Clay does not document them. Denial moves identifiers from persistent
|
|
256
|
+
storage into session storage. It does not stop requests. Keep c15t's default
|
|
257
|
+
`reloadOnConsentRevoked` behavior enabled. With reload disabled, the tracker can
|
|
258
|
+
continue sending events until navigation. Removing its loader cannot unload the
|
|
259
|
+
tracker or its child scripts.
|
|
260
|
+
|
|
261
|
+
The served tracker uses `claydar_*` cookies and local storage, including a device
|
|
262
|
+
ID cookie with a one-year lifetime. It also uses `radar_sn_*` session keys for
|
|
263
|
+
fingerprints, `spotter_data` for company lookup and a temporary `__sn_tld_probe`
|
|
264
|
+
cookie. Account settings and future vendor versions can change this inventory.
|
|
265
|
+
|
|
266
|
+
## Verify Clay
|
|
267
|
+
|
|
268
|
+
Filter Network by `claydar.com`. Denial and measurement-only consent must show no
|
|
269
|
+
requests, no `Claydar` global and no vendor storage. Grant marketing and confirm
|
|
270
|
+
one `init.v1.js?id=<siteId>` loader plus the tracker. Withdraw consent and confirm
|
|
271
|
+
the page reloads, then confirm Clay stays blocked on the new page.
|
|
272
|
+
|
|
273
|
+
The monitor uses a placeholder site ID. Successful loader and tracker execution
|
|
274
|
+
does not establish account configuration or successful company identification.
|
|
275
|
+
|
|
276
|
+
Sources: [Clay Web intent](https://university.clay.com/docs/website-tracking),
|
|
277
|
+
[Clay's Web intent announcement](https://www.clay.com/blog/web-intent),
|
|
278
|
+
[loader](https://static.claydar.com/init.v1.js), and
|
|
279
|
+
[served tracker](https://cdn.claydar.com/releases/latest/radar.min.js).
|
|
280
|
+
|
|
281
|
+
Test in a private window with an opt-in policy. Open DevTools Network, disable
|
|
282
|
+
the cache and filter by the vendor's domain:
|
|
283
|
+
|
|
284
|
+
1. Load the page. No request goes to the vendor before you choose.
|
|
285
|
+
2. Click Reject, then reload. There is still no vendor request.
|
|
286
|
+
3. Open Privacy settings and allow the helper's category. The vendor script
|
|
287
|
+
loads without a page reload.
|
|
288
|
+
4. Turn the category off again and save. c15t reloads the page, and the new
|
|
289
|
+
page makes no vendor request.
|
|
290
|
+
|
|
291
|
+
c15t reloads on revocation because removing a script element does not stop
|
|
292
|
+
code that already ran. The vendor's listeners, timers and queued events stay
|
|
293
|
+
alive until the page unloads. If you set `reloadOnConsentRevoked: false`, stop
|
|
294
|
+
the vendor yourself. Register a callback-only script whose `onConsentChange`
|
|
295
|
+
calls the vendor's opt-out API, as shown in
|
|
296
|
+
[custom integrations](./building-integrations.md), and check the
|
|
297
|
+
permission before each of your own event calls. The reload does not delete
|
|
298
|
+
cookies the vendor already set; see
|
|
299
|
+
[clear on revocation for your framework](./overview.md#vendor-switches-and-cookie-cleanup).
|
|
300
|
+
|
|
301
|
+
The helper lists its vendor by name in the preference dialog, so a visitor can
|
|
302
|
+
turn it off inside an allowed category. See
|
|
303
|
+
[vendor consent for your framework](./overview.md#vendor-switches-and-cookie-cleanup). The
|
|
304
|
+
[consent verification guide](../guides/verify-consent.md) covers navigation,
|
|
305
|
+
expiry and hosting checks.
|
|
@@ -165,7 +165,7 @@ pass them as a top-level prop:
|
|
|
165
165
|
|
|
166
166
|
```svelte title="src/App.svelte"
|
|
167
167
|
<script lang="ts">
|
|
168
|
-
import { ConsentProvider, manifest } from '
|
|
168
|
+
import { ConsentProvider, manifest } from 'c15t/svelte';
|
|
169
169
|
import { scripts } from './consent-scripts';
|
|
170
170
|
</script>
|
|
171
171
|
|
|
@@ -184,7 +184,7 @@ handle and the layout load from the [SvelteKit quickstart](https://c15t.com/docs
|
|
|
184
184
|
|
|
185
185
|
```svelte title="src/routes/+layout.svelte"
|
|
186
186
|
<script lang="ts">
|
|
187
|
-
import { ConsentRoot } from '
|
|
187
|
+
import { ConsentRoot } from 'c15t/svelte';
|
|
188
188
|
import { scripts } from '../consent-scripts';
|
|
189
189
|
|
|
190
190
|
let { children, data } = $props();
|
|
@@ -249,7 +249,7 @@ A kernel you create yourself needs a loader from
|
|
|
249
249
|
|
|
250
250
|
`clearbit` uses the `marketing` category, not `measurement`. Clearbit
|
|
251
251
|
identifies visitors and their companies for enrichment, so c15t treats it as
|
|
252
|
-
marketing
|
|
252
|
+
marketing. The `tags.js` script
|
|
253
253
|
loads with `referrerpolicy="strict-origin-when-cross-origin"` only while
|
|
254
254
|
marketing is allowed. On revocation the helper removes the script element and
|
|
255
255
|
calls no Clearbit API.
|
|
@@ -166,7 +166,7 @@ pass them as a top-level prop:
|
|
|
166
166
|
|
|
167
167
|
```svelte title="src/App.svelte"
|
|
168
168
|
<script lang="ts">
|
|
169
|
-
import { ConsentProvider, manifest } from '
|
|
169
|
+
import { ConsentProvider, manifest } from 'c15t/svelte';
|
|
170
170
|
import { scripts } from './consent-scripts';
|
|
171
171
|
</script>
|
|
172
172
|
|
|
@@ -185,7 +185,7 @@ handle and the layout load from the [SvelteKit quickstart](https://c15t.com/docs
|
|
|
185
185
|
|
|
186
186
|
```svelte title="src/routes/+layout.svelte"
|
|
187
187
|
<script lang="ts">
|
|
188
|
-
import { ConsentRoot } from '
|
|
188
|
+
import { ConsentRoot } from 'c15t/svelte';
|
|
189
189
|
import { scripts } from '../consent-scripts';
|
|
190
190
|
|
|
191
191
|
let { children, data } = $props();
|
|
@@ -206,7 +206,7 @@ pass them as a top-level prop:
|
|
|
206
206
|
|
|
207
207
|
```svelte title="src/App.svelte"
|
|
208
208
|
<script lang="ts">
|
|
209
|
-
import { ConsentProvider, manifest } from '
|
|
209
|
+
import { ConsentProvider, manifest } from 'c15t/svelte';
|
|
210
210
|
import { scripts } from './consent-scripts';
|
|
211
211
|
</script>
|
|
212
212
|
|
|
@@ -225,7 +225,7 @@ handle and the layout load from the [SvelteKit quickstart](https://c15t.com/docs
|
|
|
225
225
|
|
|
226
226
|
```svelte title="src/routes/+layout.svelte"
|
|
227
227
|
<script lang="ts">
|
|
228
|
-
import { ConsentRoot } from '
|
|
228
|
+
import { ConsentRoot } from 'c15t/svelte';
|
|
229
229
|
import { scripts } from '../consent-scripts';
|
|
230
230
|
|
|
231
231
|
let { children, data } = $props();
|
|
@@ -164,7 +164,7 @@ pass them as a top-level prop:
|
|
|
164
164
|
|
|
165
165
|
```svelte title="src/App.svelte"
|
|
166
166
|
<script lang="ts">
|
|
167
|
-
import { ConsentProvider, manifest } from '
|
|
167
|
+
import { ConsentProvider, manifest } from 'c15t/svelte';
|
|
168
168
|
import { scripts } from './consent-scripts';
|
|
169
169
|
</script>
|
|
170
170
|
|
|
@@ -183,7 +183,7 @@ handle and the layout load from the [SvelteKit quickstart](https://c15t.com/docs
|
|
|
183
183
|
|
|
184
184
|
```svelte title="src/routes/+layout.svelte"
|
|
185
185
|
<script lang="ts">
|
|
186
|
-
import { ConsentRoot } from '
|
|
186
|
+
import { ConsentRoot } from 'c15t/svelte';
|
|
187
187
|
import { scripts } from '../consent-scripts';
|
|
188
188
|
|
|
189
189
|
let { children, data } = $props();
|