@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
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Dynamic Yield
|
|
3
|
+
description: Load Dynamic Yield personalization scripts after experience
|
|
4
|
+
consent, set the page context and synchronize Active Cookie Consent with c15t.
|
|
5
|
+
seoTitle: Dynamic Yield cookie consent with c15t
|
|
6
|
+
seoDescription: Gate both Dynamic Yield scripts on experience consent, select a
|
|
7
|
+
US or EU section, and send Active Cookie Consent updates with c15t.
|
|
8
|
+
icon: sparkles
|
|
9
|
+
group: integrations
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
The c15t `dynamicYield` helper loads Dynamic Yield after `experience` consent.
|
|
13
|
+
It sets `DY.userActiveConsent` before loading `api_dynamic.js`, then loads
|
|
14
|
+
`api_static.js` after the first script finishes. No Dynamic Yield global,
|
|
15
|
+
preconnect, loader request or storage is created before the helper's consent
|
|
16
|
+
gate opens.
|
|
17
|
+
|
|
18
|
+
Dynamic Yield recommends synchronous scripts directly in the page's `<head>`
|
|
19
|
+
to avoid flicker. Waiting for consent and loading the scripts in sequence
|
|
20
|
+
changes that timing, so visitors can see the original page before a campaign
|
|
21
|
+
applies. Check your campaigns and page rendering with Dynamic Yield before
|
|
22
|
+
using this helper for experiments that need to run before paint.
|
|
23
|
+
|
|
24
|
+
## Configure Dynamic Yield
|
|
25
|
+
|
|
26
|
+
Copy the section ID and data center from your section's
|
|
27
|
+
[installation snippet](https://dy.dev/docs/implement-script). Enable
|
|
28
|
+
[Active Cookie Consent](https://dy.dev/docs/active-cookie-consent) with Dynamic
|
|
29
|
+
Yield Support. Preview mode lets you check it first. Dynamic Yield ignores the
|
|
30
|
+
consent API until this setting is enabled for your section.
|
|
31
|
+
|
|
32
|
+
Remove existing Dynamic Yield snippets, tag-manager tags and preconnects.
|
|
33
|
+
c15t gates only the scripts registered with it.
|
|
34
|
+
|
|
35
|
+
| Package manager | Command |
|
|
36
|
+
| :-------------- | :------------------------------- |
|
|
37
|
+
| npm | `npm install @c15t/integrations` |
|
|
38
|
+
| pnpm | `pnpm add @c15t/integrations` |
|
|
39
|
+
| yarn | `yarn add @c15t/integrations` |
|
|
40
|
+
| bun | `bun add @c15t/integrations` |
|
|
41
|
+
|
|
42
|
+
```ts title="src/consent-scripts.ts"
|
|
43
|
+
import { dynamicYield } from '@c15t/integrations/dynamic-yield';
|
|
44
|
+
|
|
45
|
+
export const scripts = [
|
|
46
|
+
dynamicYield({
|
|
47
|
+
recommendationContext: { lng: 'en_GB', type: 'HOMEPAGE' },
|
|
48
|
+
region: 'eu',
|
|
49
|
+
sectionId: 'YOUR_SECTION_ID',
|
|
50
|
+
}),
|
|
51
|
+
];
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Register the scripts
|
|
55
|
+
|
|
56
|
+
Complete your [framework quickstart](https://c15t.com/docs/frameworks) first. Keep its Inth
|
|
57
|
+
endpoint, policy, styles and consent UI. Remove the vendor's original script,
|
|
58
|
+
SDK initializer or tag-manager entry, so the vendor loads only through c15t.
|
|
59
|
+
|
|
60
|
+
The vendor pages put the helper in `src/consent-scripts.ts`. If your framework
|
|
61
|
+
quickstart already has a `scripts` array, such as the one in `c15t.config.ts`
|
|
62
|
+
in the Next.js guide, add the helper to that array instead of creating a
|
|
63
|
+
second file.
|
|
64
|
+
The `scripts` export is a configuration, not an initializer. Add it to the c15t provider you already have, at the registration
|
|
65
|
+
point for your framework below. These are edits to that provider, not a second
|
|
66
|
+
provider.
|
|
67
|
+
|
|
68
|
+
**Next.js**
|
|
69
|
+
|
|
70
|
+
Add the configuration to `scripts` in `c15t.config.ts`, next to
|
|
71
|
+
`next.config.ts`:
|
|
72
|
+
|
|
73
|
+
```ts title="c15t.config.ts"
|
|
74
|
+
import { defineConsentConfig } from 'c15t/next';
|
|
75
|
+
import { scripts } from './src/consent-scripts';
|
|
76
|
+
|
|
77
|
+
export default defineConsentConfig({ scripts });
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Keep the rest of your config, such as `mode` and `routePrefix`, in the
|
|
81
|
+
same call. `ConsentRoot` reads the config in the browser, so the layout
|
|
82
|
+
keeps passing only `state`. App Router, Pages Router and static export all
|
|
83
|
+
read the same file. See
|
|
84
|
+
[Next.js scripts and embeds](https://c15t.com/docs/frameworks/next/scripts).
|
|
85
|
+
|
|
86
|
+
**TanStack Start**
|
|
87
|
+
|
|
88
|
+
Import the configuration into your root route and pass it to the existing
|
|
89
|
+
`ConsentRoot` as a top-level prop. Keep the loader from the
|
|
90
|
+
[TanStack Start quickstart](https://c15t.com/docs/frameworks/tanstack-start/quickstart):
|
|
91
|
+
|
|
92
|
+
```tsx title="src/routes/__root.tsx"
|
|
93
|
+
import { scripts } from '../consent-scripts';
|
|
94
|
+
|
|
95
|
+
<ConsentRoot state={consent} scripts={scripts}>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Import vendor helpers in the root route module, not in a server function.
|
|
99
|
+
A server function's return value must be serializable, and script
|
|
100
|
+
configurations carry callbacks. See
|
|
101
|
+
[TanStack Start scripts](https://c15t.com/docs/frameworks/tanstack-start/scripts).
|
|
102
|
+
|
|
103
|
+
**React**
|
|
104
|
+
|
|
105
|
+
Add the configuration to the existing `ConsentProvider` options, next to
|
|
106
|
+
`mode`:
|
|
107
|
+
|
|
108
|
+
```tsx title="src/consent.tsx"
|
|
109
|
+
import { scripts } from './consent-scripts';
|
|
110
|
+
|
|
111
|
+
<ConsentProvider options={{ mode, scripts }}>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
`mode` is the `manifest()` value from the
|
|
115
|
+
[React quickstart](../frameworks/react/quickstart.md). Keep the banner,
|
|
116
|
+
dialog and preferences link inside the provider. See
|
|
117
|
+
[React scripts and embeds](../frameworks/react/scripts.md).
|
|
118
|
+
|
|
119
|
+
**Nuxt**
|
|
120
|
+
|
|
121
|
+
Register the scripts under the `c15t` key in `app/app.config.ts`. Adjust the
|
|
122
|
+
relative import to where you created `consent-scripts.ts`:
|
|
123
|
+
|
|
124
|
+
```ts title="app/app.config.ts"
|
|
125
|
+
import { scripts } from '../src/consent-scripts';
|
|
126
|
+
|
|
127
|
+
export default defineAppConfig({
|
|
128
|
+
c15t: { scripts },
|
|
129
|
+
});
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
The Nuxt module merges this over its options in `nuxt.config.ts` and starts
|
|
133
|
+
one script loader in the browser after hydration, once it has applied the
|
|
134
|
+
visitor's stored choice and privacy signals. Keep `scripts` out of
|
|
135
|
+
`nuxt.config.ts`, which reaches the browser as JSON and drops the vendor
|
|
136
|
+
callbacks. Write the vendor IDs into `consent-scripts.ts`. See
|
|
137
|
+
[Nuxt scripts and embeds](https://c15t.com/docs/frameworks/nuxt/scripts).
|
|
138
|
+
|
|
139
|
+
**Vue**
|
|
140
|
+
|
|
141
|
+
Pass the scripts to the existing `c15tVue` plugin call in `src/main.ts`:
|
|
142
|
+
|
|
143
|
+
```ts title="src/main.ts"
|
|
144
|
+
import { c15tVue, manifest } from 'c15t/vue/vue-plugin';
|
|
145
|
+
import { scripts } from './consent-scripts';
|
|
146
|
+
|
|
147
|
+
app.use(c15tVue, {
|
|
148
|
+
mode: manifest(),
|
|
149
|
+
scripts,
|
|
150
|
+
});
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Keep your existing `mode` and other options. The plugin starts one
|
|
154
|
+
script loader when the app mounts, after it has applied the visitor's stored
|
|
155
|
+
choice. Do not also call `createScriptLoader` from a component. See
|
|
156
|
+
[Vue scripts and embeds](https://c15t.com/docs/frameworks/vue/scripts).
|
|
157
|
+
|
|
158
|
+
**Astro**
|
|
159
|
+
|
|
160
|
+
Add the scripts to the client entrypoint from the
|
|
161
|
+
[Astro quickstart](https://c15t.com/docs/frameworks/astro/quickstart), `src/c15t.client.ts`,
|
|
162
|
+
which the integration finds on its own. Keep `astro.config.mjs` as it is.
|
|
163
|
+
If the module already exports scripts, combine the two arrays.
|
|
164
|
+
|
|
165
|
+
```ts title="src/c15t.client.ts"
|
|
166
|
+
import type { C15tClientOptionsExtension } from 'c15t/astro';
|
|
167
|
+
import { scripts } from './consent-scripts';
|
|
168
|
+
|
|
169
|
+
export default { scripts } satisfies C15tClientOptionsExtension;
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Vendor helpers contain callbacks, and the integration options in
|
|
173
|
+
`astro.config.mjs` are serialized into the page, so do not put helpers in
|
|
174
|
+
the integration's `scripts` option. The integration passes the client
|
|
175
|
+
entrypoint to the one runtime every page shares, including across
|
|
176
|
+
`ClientRouter` navigation.
|
|
177
|
+
|
|
178
|
+
**Svelte**
|
|
179
|
+
|
|
180
|
+
Import the scripts in the component that owns your existing provider and
|
|
181
|
+
pass them as a top-level prop:
|
|
182
|
+
|
|
183
|
+
```svelte title="src/App.svelte"
|
|
184
|
+
<script lang="ts">
|
|
185
|
+
import { ConsentProvider, manifest } from 'c15t/svelte';
|
|
186
|
+
import { scripts } from './consent-scripts';
|
|
187
|
+
</script>
|
|
188
|
+
|
|
189
|
+
<ConsentProvider mode={manifest()} {scripts}>
|
|
190
|
+
<!-- Keep your application, consent UI and preferences link here. -->
|
|
191
|
+
</ConsentProvider>
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Retain the styles and consent UI from the [Svelte quickstart](https://c15t.com/docs/frameworks/svelte/quickstart).
|
|
195
|
+
The provider owns the loader and disposes it on unmount.
|
|
196
|
+
|
|
197
|
+
**SvelteKit**
|
|
198
|
+
|
|
199
|
+
Add the scripts to the existing `ConsentRoot` in the root layout. Keep the
|
|
200
|
+
handle and the layout load from the [SvelteKit quickstart](https://c15t.com/docs/frameworks/sveltekit/quickstart).
|
|
201
|
+
|
|
202
|
+
```svelte title="src/routes/+layout.svelte"
|
|
203
|
+
<script lang="ts">
|
|
204
|
+
import { ConsentRoot } from 'c15t/svelte';
|
|
205
|
+
import { scripts } from '../consent-scripts';
|
|
206
|
+
|
|
207
|
+
let { children, data } = $props();
|
|
208
|
+
</script>
|
|
209
|
+
|
|
210
|
+
<ConsentRoot state={data.consent} {scripts}>
|
|
211
|
+
{@render children()}
|
|
212
|
+
<!-- Keep your consent UI and preferences link here. -->
|
|
213
|
+
</ConsentRoot>
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Import vendor helpers in the layout component, not in `+layout.server.ts`:
|
|
217
|
+
a server load cannot send functions to the browser. Prerendered, static and
|
|
218
|
+
SPA-mode pages use the same `scripts` prop. If you pass an externally owned
|
|
219
|
+
`runtime` to the provider, register scripts when creating that runtime instead.
|
|
220
|
+
|
|
221
|
+
**HTML**
|
|
222
|
+
|
|
223
|
+
The helpers in `@c15t/integrations` are ES modules that need a bundler. On a
|
|
224
|
+
page that loads the c15t script tag, paste the vendor's own snippet instead
|
|
225
|
+
and keep it inert until its category is allowed:
|
|
226
|
+
|
|
227
|
+
```html
|
|
228
|
+
<script type="text/plain" data-c15t-category="measurement">
|
|
229
|
+
// The vendor's snippet, unchanged
|
|
230
|
+
</script>
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Use the category this guide names for the vendor. c15t runs the snippet
|
|
234
|
+
once that category is allowed, and reloads the page when the visitor
|
|
235
|
+
withdraws it. Helper options on this page, such as `loadMode`, do not apply
|
|
236
|
+
to a pasted snippet. See [HTML scripts](https://c15t.com/docs/frameworks/html/scripts).
|
|
237
|
+
|
|
238
|
+
**JavaScript**
|
|
239
|
+
|
|
240
|
+
Pass the scripts to `init()` from `@c15t/browser`, next to your mode:
|
|
241
|
+
|
|
242
|
+
```ts
|
|
243
|
+
import { init, manifest } from '@c15t/browser';
|
|
244
|
+
import { scripts } from './consent-scripts';
|
|
245
|
+
|
|
246
|
+
const consent = init({
|
|
247
|
+
mode: manifest(),
|
|
248
|
+
scripts,
|
|
249
|
+
});
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
Keep the mode from your quickstart. With
|
|
253
|
+
`createConsentRuntime` from `c15t/runtime`, pass `scripts` to it instead.
|
|
254
|
+
A kernel you create yourself needs a loader from
|
|
255
|
+
`c15t/modules/script-loader`. Attach one loader per kernel. See
|
|
256
|
+
[JavaScript scripts](https://c15t.com/docs/frameworks/javascript/scripts).
|
|
257
|
+
|
|
258
|
+
## Options
|
|
259
|
+
|
|
260
|
+
| Option | Default | Behavior |
|
|
261
|
+
| ----------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------ |
|
|
262
|
+
| `sectionId` | Required | Public section ID. Trimmed and URL-encoded as one path segment. Missing or blank values log an error and skip the integration. |
|
|
263
|
+
| `region` | `'us'` | `'us'` uses `cdn.dynamicyield.com`; `'eu'` uses `cdn-eu.dynamicyield.com`. Match the section's data center. |
|
|
264
|
+
| `recommendationContext` | Not set | Page context assigned before either loader runs. Omit to preserve a context your app already set. |
|
|
265
|
+
| `category` | `'experience'` | c15t consent category or condition that gates both loaders and the consent signal. |
|
|
266
|
+
| `nonce` | None | CSP nonce for both loaders. A nonce supplied by your consent provider is forwarded to the second loader too. |
|
|
267
|
+
|
|
268
|
+
`recommendationContext.type` accepts `HOMEPAGE`, `CATEGORY`, `PRODUCT`, `CART`,
|
|
269
|
+
`POST` and `OTHER`. `data` contains the category hierarchy, product SKUs, post ID
|
|
270
|
+
or page identifier. `lng` selects a feed locale such as `en_GB`. Match values
|
|
271
|
+
to the section's product or content feed. See Dynamic Yield's
|
|
272
|
+
[page context guide](https://dy.dev/docs/page-context).
|
|
273
|
+
|
|
274
|
+
The helper seeds the initial context. Your application owns context updates
|
|
275
|
+
on client-side navigation. Follow Dynamic Yield's
|
|
276
|
+
[context implementation guide](https://dy.dev/docs/code-context) and check
|
|
277
|
+
consent before making your own Dynamic Yield calls.
|
|
278
|
+
|
|
279
|
+
## Loading and revocation
|
|
280
|
+
|
|
281
|
+
Before consent, neither loader runs and `window.DY` stays absent unless another
|
|
282
|
+
part of your app created it. Granting the mapped consent creates `DY` if
|
|
283
|
+
needed, sets `DY.userActiveConsent = { accepted: true }`, and starts the
|
|
284
|
+
dynamic loader. The static loader starts after the dynamic loader finishes.
|
|
285
|
+
|
|
286
|
+
Equivalent helper options reuse the same scripts across framework renders.
|
|
287
|
+
Registrations that share the dynamic loader also share its static loader.
|
|
288
|
+
Sharing is scoped to the same section ID and region; different sections or
|
|
289
|
+
regions request their own loader URLs. Dynamic Yield's consent and page
|
|
290
|
+
context still use the page-global `window.DY`, so configure one section and
|
|
291
|
+
region per page.
|
|
292
|
+
|
|
293
|
+
The consent signal is page-global too. It stays granted while any Dynamic
|
|
294
|
+
Yield registration has consent, including registrations with different
|
|
295
|
+
sections or regions. Revoking or removing one registration keeps both loader
|
|
296
|
+
elements while another granted registration uses the same URLs. When a
|
|
297
|
+
section's last granted registration is revoked or removed, the helper removes
|
|
298
|
+
its loader elements. When no registration on the page has consent, it sets
|
|
299
|
+
`DY.userActiveConsent = { accepted: false }`.
|
|
300
|
+
|
|
301
|
+
If consent is withdrawn while the dynamic loader is downloading, the helper
|
|
302
|
+
skips the static loader. Granting consent again starts a new loader sequence.
|
|
303
|
+
|
|
304
|
+
The SDK's consent setter applies only when Active Cookie Consent is enabled
|
|
305
|
+
for the section. It changes data collection and personalization behavior. It
|
|
306
|
+
does not unload the SDK or guarantee zero requests from code that already
|
|
307
|
+
ran. Keep c15t's default `reloadOnConsentRevoked` behavior enabled.
|
|
308
|
+
|
|
309
|
+
Dynamic Yield's denied mode can serve limited experiences. This helper waits
|
|
310
|
+
for consent before loading either script, so it does not use denied-mode
|
|
311
|
+
campaign delivery before consent. There is no `alwaysLoad` option.
|
|
312
|
+
|
|
313
|
+
## Cookies and storage
|
|
314
|
+
|
|
315
|
+
Dynamic Yield's [cookie and storage inventory](https://dy.dev/docs/cookie-management)
|
|
316
|
+
includes these cookies. Your section and campaigns determine which appear.
|
|
317
|
+
|
|
318
|
+
| Cookie | Documented lifetime |
|
|
319
|
+
| ---------------------- | ------------------- |
|
|
320
|
+
| `_dyid` | 30 days |
|
|
321
|
+
| `_dyjsession` | Browser session |
|
|
322
|
+
| `_dy_soct` | 1 year |
|
|
323
|
+
| `dy_fs_page` | Browser session |
|
|
324
|
+
| `_dy_cs_storage_items` | 30 days |
|
|
325
|
+
| `_dy_cs_cookie_items` | 30 days |
|
|
326
|
+
|
|
327
|
+
Dynamic Yield caps cookie storage at 365 days. Its browser storage also
|
|
328
|
+
includes `_dyuss_`, `_dy_tsrc`, `_dyaud_nchc`, `_dyaud_page`, `_dy_device`,
|
|
329
|
+
`_dycst`, `_dy_csc`, `_dyrc`, `_dybatch`, `_dy_cs_session_items` and
|
|
330
|
+
`_dy_cs_local_items`. `_dyaud_sess` uses session storage. Check the vendor
|
|
331
|
+
inventory and your browser for the keys used by your section.
|
|
332
|
+
|
|
333
|
+
The helper does not delete previously stored cookies or browser storage.
|
|
334
|
+
Configure cleanup for your deployment and verify it after withdrawal.
|
|
335
|
+
|
|
336
|
+
## Verify Dynamic Yield
|
|
337
|
+
|
|
338
|
+
Filter DevTools Network by `dynamicyield.com`. Grant `experience` and check
|
|
339
|
+
that `api_dynamic.js` finishes before the helper appends `api_static.js`.
|
|
340
|
+
Inspect `DY.userActiveConsent.accepted` and your page context. Revoke consent
|
|
341
|
+
and check the next page makes no Dynamic Yield request. Test vendor-specific
|
|
342
|
+
switches and the category override if your app uses them.
|
|
343
|
+
|
|
344
|
+
Sources: [Implement the Dynamic Yield script](https://dy.dev/docs/implement-script),
|
|
345
|
+
[Active Cookie Consent API](https://dy.dev/docs/active-cookie-consent),
|
|
346
|
+
[Active Cookie Consent mode and limited experiences](https://support.dynamicyield.com/hc/en-us/articles/360014728858-Active-Cookie-Consent-Mode-for-User-Data-Privacy-Management),
|
|
347
|
+
and [cookies and local storage](https://dy.dev/docs/cookie-management).
|
|
348
|
+
|
|
349
|
+
Test in a private window with an opt-in policy. Open DevTools Network, disable
|
|
350
|
+
the cache and filter by the vendor's domain:
|
|
351
|
+
|
|
352
|
+
1. Load the page. No request goes to the vendor before you choose.
|
|
353
|
+
2. Click Reject, then reload. There is still no vendor request.
|
|
354
|
+
3. Open Privacy settings and allow the helper's category. The vendor script
|
|
355
|
+
loads without a page reload.
|
|
356
|
+
4. Turn the category off again and save. c15t reloads the page, and the new
|
|
357
|
+
page makes no vendor request.
|
|
358
|
+
|
|
359
|
+
c15t reloads on revocation because removing a script element does not stop
|
|
360
|
+
code that already ran. The vendor's listeners, timers and queued events stay
|
|
361
|
+
alive until the page unloads. If you set `reloadOnConsentRevoked: false`, stop
|
|
362
|
+
the vendor yourself. Register a callback-only script whose `onConsentChange`
|
|
363
|
+
calls the vendor's opt-out API, as shown in
|
|
364
|
+
[custom integrations](./building-integrations.md), and check the
|
|
365
|
+
permission before each of your own event calls. The reload does not delete
|
|
366
|
+
cookies the vendor already set; see
|
|
367
|
+
[clear on revocation for your framework](./overview.md#vendor-switches-and-cookie-cleanup).
|
|
368
|
+
|
|
369
|
+
The helper lists its vendor by name in the preference dialog, so a visitor can
|
|
370
|
+
turn it off inside an allowed category. See
|
|
371
|
+
[vendor consent for your framework](./overview.md#vendor-switches-and-cookie-cleanup). The
|
|
372
|
+
[consent verification guide](../guides/verify-consent.md) covers navigation,
|
|
373
|
+
expiry and hosting checks.
|
|
@@ -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();
|
|
@@ -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();
|