@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.
Files changed (146) hide show
  1. package/AGENTS.md +35 -5
  2. package/README.md +2 -2
  3. package/dist/component-hooks/use-consent-gate.js +2 -0
  4. package/dist/component-hooks/use-consent-labels.js +2 -0
  5. package/dist/component-hooks/use-consent-text-direction.js +2 -0
  6. package/dist/component-hooks/use-vendors-listed-under.js +2 -0
  7. package/dist/components/consent-gate/atoms.js +1 -1
  8. package/dist/components/consent-gate/consent-gate.js +1 -1
  9. package/dist/components/iab-prompt/atoms/root.js +1 -1
  10. package/dist/components/panel-trigger/atoms/toolbar.js +1 -1
  11. package/dist/components/preferences/atoms/button.js +1 -1
  12. package/dist/components/preferences/atoms/vendor-list.js +1 -1
  13. package/dist/components/prompt/atoms/root.js +1 -1
  14. package/dist/components/prompt/components.js +1 -1
  15. package/dist/components/prompt/policy-actions.js +1 -1
  16. package/dist/components/prompt/prompt.js +1 -1
  17. package/dist/components/prompt/surface-context.js +1 -1
  18. package/dist/components/prompt/use-banner-copy.js +1 -1
  19. package/dist/components/shared/streamed-surface.js +1 -1
  20. package/dist/headless.js +1 -1
  21. package/dist/index-parts/offline.js +1 -1
  22. package/dist/modes.js +1 -1
  23. package/dist/styles.tw3.css +2 -2
  24. package/dist/transports/offline.js +1 -1
  25. package/dist/version.js +1 -1
  26. package/dist-types/component-hooks/use-consent-gate.d.ts +102 -0
  27. package/dist-types/component-hooks/use-consent-labels.d.ts +32 -0
  28. package/dist-types/component-hooks/use-consent-text-direction.d.ts +22 -0
  29. package/dist-types/component-hooks/use-vendors-listed-under.d.ts +30 -0
  30. package/dist-types/components/prompt/atoms/root.d.ts +3 -3
  31. package/dist-types/components/prompt/prompt.d.ts +4 -3
  32. package/dist-types/components/prompt/surface-context.d.ts +1 -14
  33. package/dist-types/components/prompt/use-banner-copy.d.ts +8 -3
  34. package/dist-types/components/shared/streamed-surface.d.ts +47 -10
  35. package/dist-types/headless.d.ts +10 -1
  36. package/dist-types/hooks/use-iab-policy-guard.d.ts +17 -1
  37. package/dist-types/hooks/use-scroll-lock.d.ts +16 -2
  38. package/dist-types/index-parts/offline.d.ts +1 -1
  39. package/dist-types/modes.d.ts +1 -1
  40. package/dist-types/module-hooks/script-loader.d.ts +9 -0
  41. package/dist-types/provider.d.ts +3 -3
  42. package/dist-types/transports/offline.d.ts +2 -2
  43. package/dist-types/version.d.ts +1 -1
  44. package/docs/README.md +35 -5
  45. package/docs/concepts/choose-your-setup.md +9 -9
  46. package/docs/concepts/consent-state.md +81 -9
  47. package/docs/concepts/data-fetching.md +30 -23
  48. package/docs/concepts/modes.md +87 -35
  49. package/docs/customization/recipes.md +4 -4
  50. package/docs/customization/stylesheets.md +42 -3
  51. package/docs/customization/tailwind.md +17 -34
  52. package/docs/customization/translations.md +18 -12
  53. package/docs/frameworks/react/clear-on-revocation.md +3 -2
  54. package/docs/frameworks/react/components/consent-banner.md +3 -3
  55. package/docs/frameworks/react/components/consent-provider.md +29 -29
  56. package/docs/frameworks/react/gpp.md +1 -1
  57. package/docs/frameworks/react/headless.md +146 -19
  58. package/docs/frameworks/react/hooks.md +2 -1
  59. package/docs/frameworks/react/iab.md +8 -1
  60. package/docs/frameworks/react/quickstart.md +2 -2
  61. package/docs/frameworks/react/rendering.md +1 -1
  62. package/docs/frameworks/react/translations.md +9 -9
  63. package/docs/frameworks/react/troubleshooting.md +1 -1
  64. package/docs/frameworks/react/upgrade-v3.md +39 -32
  65. package/docs/frameworks/react/vendor-consent.md +5 -0
  66. package/docs/guides/banner-experiments.md +3 -3
  67. package/docs/guides/troubleshooting.md +3 -2
  68. package/docs/integrations/activecampaign.md +297 -0
  69. package/docs/integrations/ada.md +396 -0
  70. package/docs/integrations/adobe-analytics.md +2 -2
  71. package/docs/integrations/adobe-target.md +460 -0
  72. package/docs/integrations/adroll.md +336 -0
  73. package/docs/integrations/ahrefs-analytics.md +2 -2
  74. package/docs/integrations/amazon-ads.md +424 -0
  75. package/docs/integrations/amplitude.md +2 -2
  76. package/docs/integrations/appcues.md +368 -0
  77. package/docs/integrations/attentive.md +313 -0
  78. package/docs/integrations/building-integrations.md +29 -16
  79. package/docs/integrations/clay.md +305 -0
  80. package/docs/integrations/clearbit.md +3 -3
  81. package/docs/integrations/cloudflare-web-analytics.md +2 -2
  82. package/docs/integrations/cloudflare-zaraz.md +2 -2
  83. package/docs/integrations/crisp.md +2 -2
  84. package/docs/integrations/customer-io.md +369 -0
  85. package/docs/integrations/databuddy.md +127 -52
  86. package/docs/integrations/default-com.md +497 -0
  87. package/docs/integrations/dynamic-yield.md +373 -0
  88. package/docs/integrations/fathom-analytics.md +2 -2
  89. package/docs/integrations/front-chat.md +2 -2
  90. package/docs/integrations/fullstory.md +298 -0
  91. package/docs/integrations/gainsight-px.md +418 -0
  92. package/docs/integrations/google-maps.md +2 -2
  93. package/docs/integrations/google-tag-manager.md +59 -2
  94. package/docs/integrations/google-tag.md +2 -2
  95. package/docs/integrations/gorgias.md +365 -0
  96. package/docs/integrations/heap.md +2 -2
  97. package/docs/integrations/hightouch.md +2 -2
  98. package/docs/integrations/hotjar.md +40 -26
  99. package/docs/integrations/hubspot.md +529 -0
  100. package/docs/integrations/insider.md +550 -0
  101. package/docs/integrations/intercom.md +2 -2
  102. package/docs/integrations/klaviyo.md +2 -2
  103. package/docs/integrations/linkedin-insights.md +2 -2
  104. package/docs/integrations/liveintent.md +327 -0
  105. package/docs/integrations/logrocket.md +2 -2
  106. package/docs/integrations/lucky-orange.md +336 -0
  107. package/docs/integrations/marketo.md +309 -0
  108. package/docs/integrations/matomo-analytics.md +2 -2
  109. package/docs/integrations/meta-pixel.md +2 -2
  110. package/docs/integrations/microsoft-clarity.md +2 -2
  111. package/docs/integrations/microsoft-uet.md +2 -2
  112. package/docs/integrations/mixpanel-analytics.md +2 -2
  113. package/docs/integrations/one-dollar-stats.md +2 -2
  114. package/docs/integrations/openai-pixel.md +2 -2
  115. package/docs/integrations/optimizely.md +411 -0
  116. package/docs/integrations/oracle-eloqua.md +301 -0
  117. package/docs/integrations/overview.md +128 -81
  118. package/docs/integrations/pendo.md +339 -0
  119. package/docs/integrations/pinterest-tag.md +2 -2
  120. package/docs/integrations/pirsch.md +2 -2
  121. package/docs/integrations/plausible-analytics.md +2 -2
  122. package/docs/integrations/posthog.md +2 -2
  123. package/docs/integrations/promptwatch.md +2 -2
  124. package/docs/integrations/rb2b.md +363 -0
  125. package/docs/integrations/reddit-pixel.md +2 -2
  126. package/docs/integrations/rudderstack.md +2 -2
  127. package/docs/integrations/rybbit-analytics.md +2 -2
  128. package/docs/integrations/salesforce-pardot.md +342 -0
  129. package/docs/integrations/segment.md +2 -2
  130. package/docs/integrations/sentry.md +2 -2
  131. package/docs/integrations/shopify.md +323 -0
  132. package/docs/integrations/snapchat-pixel.md +2 -2
  133. package/docs/integrations/statable-analytics.md +345 -0
  134. package/docs/integrations/the-trade-desk.md +328 -0
  135. package/docs/integrations/tiktok-pixel.md +2 -2
  136. package/docs/integrations/umami-analytics.md +2 -2
  137. package/docs/integrations/vector.md +333 -0
  138. package/docs/integrations/vercel-analytics.md +2 -2
  139. package/docs/integrations/vercel-speed-insights.md +7 -2
  140. package/docs/integrations/wisepops.md +416 -0
  141. package/docs/integrations/x-pixel.md +2 -2
  142. package/docs/integrations/youtube.md +2 -2
  143. package/docs/integrations/zendesk.md +359 -0
  144. package/package.json +10 -32
  145. package/dist/components/prompt/resolve-banner-primary-actions.js +0 -1
  146. package/dist-types/components/prompt/resolve-banner-primary-actions.d.ts +0 -14
@@ -0,0 +1,411 @@
1
+ ---
2
+ title: Optimizely
3
+ description: Load Optimizely Web Experimentation and Personalization after
4
+ experience consent with c15t, choose a consent category and understand
5
+ revocation limits.
6
+ seoTitle: Optimizely cookie consent with c15t
7
+ seoDescription: Gate Optimizely Web Experimentation on experience consent with
8
+ c15t. Configure the project snippet, handle page flicker and understand reload
9
+ limits.
10
+ icon: flask-conical
11
+ group: integrations
12
+ ---
13
+
14
+ Optimizely Web runs A/B tests and personalization by changing the page in the
15
+ browser. The c15t `optimizelyWeb` helper waits for `experience` consent before
16
+ it loads the Optimizely Web Experimentation or Personalization snippet. Until
17
+ then, the helper creates no Optimizely global and makes no Optimizely request.
18
+
19
+ On withdrawal, c15t removes the snippet and reloads the page. The running SDK
20
+ can't be unloaded, so without the reload it keeps changing the page and
21
+ sending events.
22
+
23
+ ## Configure Optimizely
24
+
25
+ In Optimizely, open **Settings > Implementation** and copy the project number
26
+ just before `.js` in the snippet URL. Replace the example project number below
27
+ with yours. Use one Optimizely snippet per page. Remove the original
28
+ Optimizely snippet and any tag-manager copy so c15t controls when it loads.
29
+
30
+ | Package manager | Command |
31
+ | :-------------- | :------------------------------- |
32
+ | npm | `npm install @c15t/integrations` |
33
+ | pnpm | `pnpm add @c15t/integrations` |
34
+ | yarn | `yarn add @c15t/integrations` |
35
+ | bun | `bun add @c15t/integrations` |
36
+
37
+ ```ts title="src/consent-scripts.ts"
38
+ import { optimizelyWeb } from '@c15t/integrations/optimizely';
39
+
40
+ export const scripts = [optimizelyWeb({ projectId: '12345678' })];
41
+ ```
42
+
43
+ The default loader URL is `https://cdn.optimizely.com/js/<projectId>.js`.
44
+
45
+ ## Register the scripts
46
+
47
+ Complete your [framework quickstart](https://c15t.com/docs/frameworks) first. Keep its Inth
48
+ endpoint, policy, styles and consent UI. Remove the vendor's original script,
49
+ SDK initializer or tag-manager entry, so the vendor loads only through c15t.
50
+
51
+ The vendor pages put the helper in `src/consent-scripts.ts`. If your framework
52
+ quickstart already has a `scripts` array, such as the one in `c15t.config.ts`
53
+ in the Next.js guide, add the helper to that array instead of creating a
54
+ second file.
55
+ The `scripts` export is a configuration, not an initializer. Add it to the c15t provider you already have, at the registration
56
+ point for your framework below. These are edits to that provider, not a second
57
+ provider.
58
+
59
+ **Next.js**
60
+
61
+ Add the configuration to `scripts` in `c15t.config.ts`, next to
62
+ `next.config.ts`:
63
+
64
+ ```ts title="c15t.config.ts"
65
+ import { defineConsentConfig } from 'c15t/next';
66
+ import { scripts } from './src/consent-scripts';
67
+
68
+ export default defineConsentConfig({ scripts });
69
+ ```
70
+
71
+ Keep the rest of your config, such as `mode` and `routePrefix`, in the
72
+ same call. `ConsentRoot` reads the config in the browser, so the layout
73
+ keeps passing only `state`. App Router, Pages Router and static export all
74
+ read the same file. See
75
+ [Next.js scripts and embeds](https://c15t.com/docs/frameworks/next/scripts).
76
+
77
+ **TanStack Start**
78
+
79
+ Import the configuration into your root route and pass it to the existing
80
+ `ConsentRoot` as a top-level prop. Keep the loader from the
81
+ [TanStack Start quickstart](https://c15t.com/docs/frameworks/tanstack-start/quickstart):
82
+
83
+ ```tsx title="src/routes/__root.tsx"
84
+ import { scripts } from '../consent-scripts';
85
+
86
+ <ConsentRoot state={consent} scripts={scripts}>
87
+ ```
88
+
89
+ Import vendor helpers in the root route module, not in a server function.
90
+ A server function's return value must be serializable, and script
91
+ configurations carry callbacks. See
92
+ [TanStack Start scripts](https://c15t.com/docs/frameworks/tanstack-start/scripts).
93
+
94
+ **React**
95
+
96
+ Add the configuration to the existing `ConsentProvider` options, next to
97
+ `mode`:
98
+
99
+ ```tsx title="src/consent.tsx"
100
+ import { scripts } from './consent-scripts';
101
+
102
+ <ConsentProvider options={{ mode, scripts }}>
103
+ ```
104
+
105
+ `mode` is the `manifest()` value from the
106
+ [React quickstart](../frameworks/react/quickstart.md). Keep the banner,
107
+ dialog and preferences link inside the provider. See
108
+ [React scripts and embeds](../frameworks/react/scripts.md).
109
+
110
+ **Nuxt**
111
+
112
+ Register the scripts under the `c15t` key in `app/app.config.ts`. Adjust the
113
+ relative import to where you created `consent-scripts.ts`:
114
+
115
+ ```ts title="app/app.config.ts"
116
+ import { scripts } from '../src/consent-scripts';
117
+
118
+ export default defineAppConfig({
119
+ c15t: { scripts },
120
+ });
121
+ ```
122
+
123
+ The Nuxt module merges this over its options in `nuxt.config.ts` and starts
124
+ one script loader in the browser after hydration, once it has applied the
125
+ visitor's stored choice and privacy signals. Keep `scripts` out of
126
+ `nuxt.config.ts`, which reaches the browser as JSON and drops the vendor
127
+ callbacks. Write the vendor IDs into `consent-scripts.ts`. See
128
+ [Nuxt scripts and embeds](https://c15t.com/docs/frameworks/nuxt/scripts).
129
+
130
+ **Vue**
131
+
132
+ Pass the scripts to the existing `c15tVue` plugin call in `src/main.ts`:
133
+
134
+ ```ts title="src/main.ts"
135
+ import { c15tVue, manifest } from 'c15t/vue/vue-plugin';
136
+ import { scripts } from './consent-scripts';
137
+
138
+ app.use(c15tVue, {
139
+ mode: manifest(),
140
+ scripts,
141
+ });
142
+ ```
143
+
144
+ Keep your existing `mode` and other options. The plugin starts one
145
+ script loader when the app mounts, after it has applied the visitor's stored
146
+ choice. Do not also call `createScriptLoader` from a component. See
147
+ [Vue scripts and embeds](https://c15t.com/docs/frameworks/vue/scripts).
148
+
149
+ **Astro**
150
+
151
+ Add the scripts to the client entrypoint from the
152
+ [Astro quickstart](https://c15t.com/docs/frameworks/astro/quickstart), `src/c15t.client.ts`,
153
+ which the integration finds on its own. Keep `astro.config.mjs` as it is.
154
+ If the module already exports scripts, combine the two arrays.
155
+
156
+ ```ts title="src/c15t.client.ts"
157
+ import type { C15tClientOptionsExtension } from 'c15t/astro';
158
+ import { scripts } from './consent-scripts';
159
+
160
+ export default { scripts } satisfies C15tClientOptionsExtension;
161
+ ```
162
+
163
+ Vendor helpers contain callbacks, and the integration options in
164
+ `astro.config.mjs` are serialized into the page, so do not put helpers in
165
+ the integration's `scripts` option. The integration passes the client
166
+ entrypoint to the one runtime every page shares, including across
167
+ `ClientRouter` navigation.
168
+
169
+ **Svelte**
170
+
171
+ Import the scripts in the component that owns your existing provider and
172
+ pass them as a top-level prop:
173
+
174
+ ```svelte title="src/App.svelte"
175
+ <script lang="ts">
176
+ import { ConsentProvider, manifest } from 'c15t/svelte';
177
+ import { scripts } from './consent-scripts';
178
+ </script>
179
+
180
+ <ConsentProvider mode={manifest()} {scripts}>
181
+ <!-- Keep your application, consent UI and preferences link here. -->
182
+ </ConsentProvider>
183
+ ```
184
+
185
+ Retain the styles and consent UI from the [Svelte quickstart](https://c15t.com/docs/frameworks/svelte/quickstart).
186
+ The provider owns the loader and disposes it on unmount.
187
+
188
+ **SvelteKit**
189
+
190
+ Add the scripts to the existing `ConsentRoot` in the root layout. Keep the
191
+ handle and the layout load from the [SvelteKit quickstart](https://c15t.com/docs/frameworks/sveltekit/quickstart).
192
+
193
+ ```svelte title="src/routes/+layout.svelte"
194
+ <script lang="ts">
195
+ import { ConsentRoot } from 'c15t/svelte';
196
+ import { scripts } from '../consent-scripts';
197
+
198
+ let { children, data } = $props();
199
+ </script>
200
+
201
+ <ConsentRoot state={data.consent} {scripts}>
202
+ {@render children()}
203
+ <!-- Keep your consent UI and preferences link here. -->
204
+ </ConsentRoot>
205
+ ```
206
+
207
+ Import vendor helpers in the layout component, not in `+layout.server.ts`:
208
+ a server load cannot send functions to the browser. Prerendered, static and
209
+ SPA-mode pages use the same `scripts` prop. If you pass an externally owned
210
+ `runtime` to the provider, register scripts when creating that runtime instead.
211
+
212
+ **HTML**
213
+
214
+ The helpers in `@c15t/integrations` are ES modules that need a bundler. On a
215
+ page that loads the c15t script tag, paste the vendor's own snippet instead
216
+ and keep it inert until its category is allowed:
217
+
218
+ ```html
219
+ <script type="text/plain" data-c15t-category="measurement">
220
+ // The vendor's snippet, unchanged
221
+ </script>
222
+ ```
223
+
224
+ Use the category this guide names for the vendor. c15t runs the snippet
225
+ once that category is allowed, and reloads the page when the visitor
226
+ withdraws it. Helper options on this page, such as `loadMode`, do not apply
227
+ to a pasted snippet. See [HTML scripts](https://c15t.com/docs/frameworks/html/scripts).
228
+
229
+ **JavaScript**
230
+
231
+ Pass the scripts to `init()` from `@c15t/browser`, next to your mode:
232
+
233
+ ```ts
234
+ import { init, manifest } from '@c15t/browser';
235
+ import { scripts } from './consent-scripts';
236
+
237
+ const consent = init({
238
+ mode: manifest(),
239
+ scripts,
240
+ });
241
+ ```
242
+
243
+ Keep the mode from your quickstart. With
244
+ `createConsentRuntime` from `c15t/runtime`, pass `scripts` to it instead.
245
+ A kernel you create yourself needs a loader from
246
+ `c15t/modules/script-loader`. Attach one loader per kernel. See
247
+ [JavaScript scripts](https://c15t.com/docs/frameworks/javascript/scripts).
248
+
249
+ ## Options
250
+
251
+ | Option | Default | Behavior |
252
+ | ----------- | ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
253
+ | `projectId` | Required | Public project number as a string or safe integer. Surrounding whitespace is trimmed. Use a string above `Number.MAX_SAFE_INTEGER`. Missing, blank, nonnumeric or unsafe numeric values log an error and skip the loader. |
254
+ | `category` | `'experience'` | Consent category or condition required before loading, such as `'measurement'` or `{ and: ['experience', 'measurement'] }`. |
255
+ | `scriptSrc` | `https://cdn.optimizely.com/js/<projectId>.js` | Custom snippet or proxy URL. The project ID is still required. A blank override uses the default. This doesn't proxy the SDK's other requests. |
256
+ | `nonce` | None | CSP nonce for the loader element. Surrounding whitespace is trimmed. You can also supply the nonce through your consent provider. |
257
+
258
+ Optimizely leaves cookie classification to the site owner. The helper uses
259
+ `experience` because the snippet changes and tests user experiences. If your
260
+ policy also requires measurement consent, pass both categories in an `and`
261
+ condition.
262
+
263
+ ## Loading and revocation
264
+
265
+ ### Page flicker
266
+
267
+ After consent, c15t inserts the loader into `<head>` with `async: false`.
268
+ Optimizely activates the configured experiments when the snippet runs. The
269
+ helper doesn't call `sendEvents`, start a second SDK or replace an existing
270
+ `window.optimizely`.
271
+
272
+ Optimizely recommends a synchronous snippet near the start of `<head>` and
273
+ warns against loading it through a tag manager. A script inserted at runtime
274
+ with `async: false` doesn't block the HTML parser. While c15t waits for
275
+ consent, visitors can see the original page before Optimizely applies a
276
+ variation. Plan your experiments for this flicker and for visitors who don't
277
+ grant consent.
278
+
279
+ The helper has no early-load or event-holding mode. Optimizely's `holdEvents`
280
+ API holds event delivery, but the SDK still runs and queues events in
281
+ localStorage. `sendEvents` releases those queued events, including events
282
+ stored on earlier pages. Loading the snippet early would break this helper's
283
+ consent gate.
284
+
285
+ ### Revocation
286
+
287
+ Keep your provider's `reloadOnConsentRevoked` enabled. When a visitor revokes
288
+ the mapped category or turns off the Optimizely vendor, c15t removes the
289
+ loader and reloads the page after pending saves settle. The new page keeps the
290
+ snippet blocked until consent is granted again.
291
+
292
+ The standalone core `createScriptLoader` removes script elements but doesn't
293
+ reload the page. If you use it directly, your app must persist the denied
294
+ choice and reload. Permission changes caused by expiry or policy updates also
295
+ don't trigger the provider's visitor-action reload.
296
+
297
+ Removing the loader doesn't unload the running SDK, undo its page changes or
298
+ delete its cookies and localStorage. A browser can also finish running an
299
+ in-flight script after its element is removed. Optimizely can keep running
300
+ until the page unloads, including while c15t waits for a save to finish. The
301
+ reload ends it in the current document. If you turn reloads off, the helper
302
+ can't make Optimizely stop tracking or changing the page after revocation.
303
+
304
+ Optimizely documents `disable` for calls made before the snippet loads. It
305
+ isn't a documented way to stop a snippet that is already running.
306
+ `holdEvents` also leaves local collection active, so it isn't a full stop API.
307
+
308
+ ## Persistent Optimizely opt-out
309
+
310
+ For a deliberate persistent opt-out, import `optOutOptimizely` from
311
+ `@c15t/integrations/optimizely` and call `optOutOptimizely()`. It sends
312
+ `window.optimizely.push({ type: 'optOut', isOptOut: true })` through an
313
+ existing SDK or queue, and does nothing if neither exists.
314
+
315
+ Optimizely records this choice in the ten-year `optimizelyOptOut` cookie.
316
+ Granting consent again in c15t doesn't clear that cookie, so the helper never
317
+ calls this utility on ordinary revocation. The command returns no completion
318
+ promise and doesn't undo changes already applied to the page. Keep the page
319
+ reload enabled when you use it.
320
+
321
+ To reverse an explicit opt-out after the visitor grants consent, follow
322
+ Optimizely's [cookie implementation guidance](https://support.optimizely.com/hc/en-us/articles/22060116282509-Cookie-implementation-options):
323
+ delete `optimizelyOptOut` or set its value to `false`, using the cookie's
324
+ existing domain and path, then reload or navigate to another page. On that
325
+ page, c15t must allow the snippet to load. Optimizely's API reference warns
326
+ that an opt-in command alone can't restart a snippet blocked by the opt-out
327
+ cookie. Your app must reset the cookie; `optimizelyWeb` and `optOutOptimizely`
328
+ don't.
329
+
330
+ ## Cookies and localStorage
331
+
332
+ Optimizely's [storage reference](https://docs.optimizely.com/web-experimentation/docs/cookies-and-localstorage-in-snippets)
333
+ lists these first-party cookies. Browser policies can shorten their lifetimes.
334
+
335
+ | Cookie | Documented lifetime | Purpose |
336
+ | ---------------------------- | -------------------------------------------- | ------------------------------------------------------------------------ |
337
+ | `optimizelyEndUserId` | Six months from the last visit, configurable | Visitor identifier. |
338
+ | `optimizelySession` | Six months | New or returning session detection. |
339
+ | `optimizelyRedirectData` | Five seconds | Data passed across redirect experiments. |
340
+ | `optimizelyDomainTestCookie` | Removed right after a successful test | Domain detection. |
341
+ | `optimizelyOptOut` | Ten years | Persistent Optimizely opt-out. The helper sets no opt-out cookie itself. |
342
+
343
+ The SDK stores events, experiment assignments, visitor profiles and pending
344
+ requests under localStorage keys that start with `optimizely_data$$`. The full
345
+ key includes the visitor ID and the project or account namespace, followed by
346
+ a name such as `events`, `event_queue`, `variation_map`, `session_state`,
347
+ `visitor_profile`, `layer_states`, `layer_map`, `tracker_optimizely`,
348
+ `pending_events` or `contextual_mab`.
349
+
350
+ Cross-origin tracking can use origin-specific prefixes and sync through an
351
+ account-specific `cdn.optimizely.com` origin. Edge Delivery can add
352
+ `OPTY$$...$$VPROF` and `OPTY$$...$$VMAP` cookies with six-month lifetimes.
353
+ Sampled Real User Monitoring uses session cookies on `rum.optimizely.com`,
354
+ including `AWSELB`, `AWSELBCORS` and `optimizelyRumLB`. This helper loads the
355
+ browser snippet. It doesn't configure an Edge Delivery worker.
356
+
357
+ A reload keeps existing storage. Use your framework's clear-on-revocation
358
+ configuration to remove the storage your site uses. Check the actual names and
359
+ domains in DevTools. Cleanup on your origin can't clear cookies or
360
+ localStorage on an Optimizely-owned origin. Optimizely warns that cookie and
361
+ localStorage formats can change, so don't read them as an app API.
362
+
363
+ ## Verify Optimizely
364
+
365
+ Use your own test project. With consent denied in a clean browser profile,
366
+ filter Network by `optimizely.com` and check that the snippet doesn't load.
367
+ The `optimizely` global, Optimizely cookies and localStorage keys should be
368
+ absent.
369
+
370
+ Grant the mapped consent and check for the project `.js` request. After a
371
+ valid snippet runs, `window.optimizely.get` is a function. That shows an SDK
372
+ API exists, not that a particular experiment activated or an event was
373
+ accepted. Check experiment targeting and behavior in your test project. Deny
374
+ the vendor inside an allowed category and confirm that the reload blocks its
375
+ snippet too. Grant again to confirm that ordinary revocation hasn't created a
376
+ persistent opt-out. If you use `optOutOptimizely`, also test the cookie reset
377
+ and reload described above before you expect a later grant to resume
378
+ experiments.
379
+
380
+ Sources:
381
+ [implement the one-line snippet](https://docs.optimizely.com/web-experimentation/docs/implement-the-one-line-javascript-snippet),
382
+ [hold and send event timing](https://docs.optimizely.com/web-experimentation/docs/control-the-timing-of-optimizely-web-experimentation-event-dispatch-with-holdevents-and-sendevents),
383
+ [disable API](https://docs.optimizely.com/web-experimentation/api/Ops8-disable)
384
+ and
385
+ [persistent opt-out API](https://docs.optimizely.com/web-experimentation/api/d8Gy-opt-out).
386
+
387
+ Test in a private window with an opt-in policy. Open DevTools Network, disable
388
+ the cache and filter by the vendor's domain:
389
+
390
+ 1. Load the page. No request goes to the vendor before you choose.
391
+ 2. Click Reject, then reload. There is still no vendor request.
392
+ 3. Open Privacy settings and allow the helper's category. The vendor script
393
+ loads without a page reload.
394
+ 4. Turn the category off again and save. c15t reloads the page, and the new
395
+ page makes no vendor request.
396
+
397
+ c15t reloads on revocation because removing a script element does not stop
398
+ code that already ran. The vendor's listeners, timers and queued events stay
399
+ alive until the page unloads. If you set `reloadOnConsentRevoked: false`, stop
400
+ the vendor yourself. Register a callback-only script whose `onConsentChange`
401
+ calls the vendor's opt-out API, as shown in
402
+ [custom integrations](./building-integrations.md), and check the
403
+ permission before each of your own event calls. The reload does not delete
404
+ cookies the vendor already set; see
405
+ [clear on revocation for your framework](./overview.md#vendor-switches-and-cookie-cleanup).
406
+
407
+ The helper lists its vendor by name in the preference dialog, so a visitor can
408
+ turn it off inside an allowed category. See
409
+ [vendor consent for your framework](./overview.md#vendor-switches-and-cookie-cleanup). The
410
+ [consent verification guide](../guides/verify-consent.md) covers navigation,
411
+ expiry and hosting checks.