@c15t/scripts 3.0.0-alpha.2 → 3.0.0-alpha.4
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 +129 -63
- package/README.md +8 -29
- package/SKILL.md +33 -0
- package/dist/adobe-analytics.js +2 -0
- package/dist/ahrefs-analytics.js +2 -0
- package/dist/amplitude.js +2 -0
- package/dist/clearbit.js +2 -0
- package/dist/cloudflare-web-analytics.js +2 -0
- package/dist/cloudflare-zaraz.js +2 -0
- package/dist/crisp.js +2 -0
- package/dist/databuddy.js +2 -0
- package/dist/e2e-test-utils.js +2 -139
- package/dist/engine/compile.js +2 -89
- package/dist/engine/runtime.js +2 -448
- package/dist/events.js +2 -218
- package/dist/fathom-analytics.js +2 -0
- package/dist/front-chat.js +2 -0
- package/dist/google-tag-manager.js +2 -0
- package/dist/google-tag.js +2 -0
- package/dist/heap.js +2 -0
- package/dist/hightouch.js +2 -0
- package/dist/hotjar.js +2 -0
- package/dist/intercom.js +2 -0
- package/dist/klaviyo.js +2 -0
- package/dist/linkedin-insights.js +2 -0
- package/dist/logrocket.js +2 -0
- package/dist/matomo-analytics.js +2 -0
- package/dist/meta-pixel.js +2 -0
- package/dist/microsoft-clarity.js +2 -0
- package/dist/microsoft-uet.js +2 -0
- package/dist/mixpanel-analytics.js +2 -0
- package/dist/one-dollar-stats.js +2 -0
- package/dist/openai-pixel.js +2 -0
- package/dist/pinterest-tag.js +2 -0
- package/dist/pirsch.js +2 -0
- package/dist/plausible-analytics.js +2 -0
- package/dist/posthog.js +2 -0
- package/dist/promptwatch.js +2 -0
- package/dist/reddit-pixel.js +2 -0
- package/dist/registry.js +2 -422
- package/dist/resolve.js +2 -33
- package/dist/rudderstack.js +2 -0
- package/dist/rybbit-analytics.js +2 -0
- package/dist/segment.js +2 -0
- package/dist/snapchat-pixel.js +2 -0
- package/dist/tiktok-pixel.js +2 -0
- package/dist/types.js +2 -16
- package/dist/umami-analytics.js +2 -0
- package/dist/vendors/_shared/attributes.js +2 -14
- package/dist/vendors/_shared/google-consent.js +2 -27
- package/dist/vendors/_shared/install-builders.js +2 -21
- package/dist/vendors/_shared/required-id.js +2 -0
- package/dist/vendors/_shared/script-url.js +2 -28
- package/dist/vendors/ads-and-pixels/linkedin-insights.js +2 -48
- package/dist/vendors/ads-and-pixels/meta-pixel.js +2 -153
- package/dist/vendors/ads-and-pixels/microsoft-uet.js +2 -110
- package/dist/vendors/ads-and-pixels/openai-pixel.js +2 -88
- package/dist/vendors/ads-and-pixels/pinterest-tag.js +2 -123
- package/dist/vendors/ads-and-pixels/reddit-pixel.js +2 -107
- package/dist/vendors/ads-and-pixels/snapchat-pixel.js +2 -87
- package/dist/vendors/ads-and-pixels/tiktok-pixel.js +2 -89
- package/dist/vendors/ads-and-pixels/x-pixel.js +2 -48
- package/dist/vendors/analytics/adobe-analytics.js +2 -49
- package/dist/vendors/analytics/ahrefs-analytics.js +2 -27
- package/dist/vendors/analytics/amplitude.js +2 -134
- package/dist/vendors/analytics/clearbit.js +2 -28
- package/dist/vendors/analytics/cloudflare-web-analytics.js +2 -32
- package/dist/vendors/analytics/databuddy.js +2 -103
- package/dist/vendors/analytics/fathom-analytics.js +2 -35
- package/dist/vendors/analytics/google-tag.js +2 -78
- package/dist/vendors/analytics/heap.js +2 -134
- package/dist/vendors/analytics/hightouch.js +2 -109
- package/dist/vendors/analytics/hotjar.js +2 -44
- package/dist/vendors/analytics/logrocket.js +2 -58
- package/dist/vendors/analytics/matomo-analytics.js +2 -191
- package/dist/vendors/analytics/microsoft-clarity.js +2 -100
- package/dist/vendors/analytics/mixpanel-analytics.js +2 -93
- package/dist/vendors/analytics/one-dollar-stats.js +2 -30
- package/dist/vendors/analytics/pirsch.js +2 -67
- package/dist/vendors/analytics/plausible-analytics.js +2 -81
- package/dist/vendors/analytics/posthog.js +2 -200
- package/dist/vendors/analytics/promptwatch.js +2 -29
- package/dist/vendors/analytics/rudderstack.js +2 -183
- package/dist/vendors/analytics/rybbit-analytics.js +2 -63
- package/dist/vendors/analytics/segment.js +2 -65
- package/dist/vendors/analytics/umami-analytics.js +2 -39
- package/dist/vendors/analytics/vercel-analytics.js +2 -53
- package/dist/vendors/email-and-sms/klaviyo.js +2 -0
- package/dist/vendors/functional/crisp.js +2 -100
- package/dist/vendors/functional/front-chat.js +2 -64
- package/dist/vendors/functional/intercom.js +2 -45
- package/dist/vendors/tag-managers/cloudflare-zaraz.js +2 -98
- package/dist/vendors/tag-managers/google-tag-manager.js +2 -73
- package/dist/vercel-analytics.js +2 -0
- package/dist/x-pixel.js +2 -0
- package/dist-types/adobe-analytics.d.ts +2 -0
- package/dist-types/ahrefs-analytics.d.ts +2 -0
- package/dist-types/amplitude.d.ts +2 -0
- package/dist-types/clearbit.d.ts +2 -0
- package/dist-types/cloudflare-web-analytics.d.ts +2 -0
- package/dist-types/cloudflare-zaraz.d.ts +2 -0
- package/dist-types/crisp.d.ts +2 -0
- package/dist-types/databuddy.d.ts +2 -0
- package/dist-types/e2e-test-utils.d.ts +2 -0
- package/dist-types/engine/compile.d.ts +2 -3
- package/dist-types/engine/runtime.d.ts +2 -3
- package/dist-types/events.d.ts +2 -46
- package/dist-types/fathom-analytics.d.ts +2 -0
- package/dist-types/front-chat.d.ts +2 -0
- package/dist-types/google-tag-manager.d.ts +2 -0
- package/dist-types/google-tag.d.ts +2 -0
- package/dist-types/heap.d.ts +2 -0
- package/dist-types/hightouch.d.ts +2 -0
- package/dist-types/hotjar.d.ts +2 -0
- package/dist-types/intercom.d.ts +2 -0
- package/dist-types/klaviyo.d.ts +2 -0
- package/dist-types/linkedin-insights.d.ts +2 -0
- package/dist-types/logrocket.d.ts +2 -0
- package/dist-types/matomo-analytics.d.ts +2 -0
- package/dist-types/meta-pixel.d.ts +2 -0
- package/dist-types/microsoft-clarity.d.ts +2 -0
- package/dist-types/microsoft-uet.d.ts +2 -0
- package/dist-types/mixpanel-analytics.d.ts +2 -0
- package/dist-types/one-dollar-stats.d.ts +2 -0
- package/dist-types/openai-pixel.d.ts +2 -0
- package/dist-types/pinterest-tag.d.ts +2 -0
- package/dist-types/pirsch.d.ts +2 -0
- package/dist-types/plausible-analytics.d.ts +2 -0
- package/dist-types/posthog.d.ts +2 -0
- package/dist-types/promptwatch.d.ts +2 -0
- package/dist-types/reddit-pixel.d.ts +2 -0
- package/dist-types/registry.d.ts +2 -485
- package/dist-types/resolve.d.ts +2 -9
- package/dist-types/rudderstack.d.ts +2 -0
- package/dist-types/rybbit-analytics.d.ts +2 -0
- package/dist-types/segment.d.ts +2 -0
- package/dist-types/snapchat-pixel.d.ts +2 -0
- package/dist-types/tiktok-pixel.d.ts +2 -0
- package/dist-types/types.d.ts +2 -314
- package/dist-types/umami-analytics.d.ts +2 -0
- package/dist-types/vendors/_shared/attributes.d.ts +2 -35
- package/dist-types/vendors/_shared/google-consent.d.ts +2 -47
- package/dist-types/vendors/_shared/install-builders.d.ts +2 -30
- package/dist-types/vendors/_shared/required-id.d.ts +2 -0
- package/dist-types/vendors/_shared/script-url.d.ts +2 -75
- package/dist-types/vendors/ads-and-pixels/linkedin-insights.d.ts +2 -92
- package/dist-types/vendors/ads-and-pixels/meta-pixel.d.ts +2 -289
- package/dist-types/vendors/ads-and-pixels/microsoft-uet.d.ts +2 -105
- package/dist-types/vendors/ads-and-pixels/openai-pixel.d.ts +2 -211
- package/dist-types/vendors/ads-and-pixels/pinterest-tag.d.ts +2 -295
- package/dist-types/vendors/ads-and-pixels/reddit-pixel.d.ts +2 -210
- package/dist-types/vendors/ads-and-pixels/snapchat-pixel.d.ts +2 -171
- package/dist-types/vendors/ads-and-pixels/tiktok-pixel.d.ts +2 -106
- package/dist-types/vendors/ads-and-pixels/x-pixel.d.ts +2 -183
- package/dist-types/vendors/analytics/adobe-analytics.d.ts +2 -75
- package/dist-types/vendors/analytics/ahrefs-analytics.d.ts +2 -62
- package/dist-types/vendors/analytics/amplitude.d.ts +2 -234
- package/dist-types/vendors/analytics/clearbit.d.ts +2 -60
- package/dist-types/vendors/analytics/cloudflare-web-analytics.d.ts +2 -67
- package/dist-types/vendors/analytics/databuddy.d.ts +2 -147
- package/dist-types/vendors/analytics/fathom-analytics.d.ts +2 -90
- package/dist-types/vendors/analytics/google-tag.d.ts +2 -95
- package/dist-types/vendors/analytics/heap.d.ts +2 -316
- package/dist-types/vendors/analytics/hightouch.d.ts +2 -285
- package/dist-types/vendors/analytics/hotjar.d.ts +2 -73
- package/dist-types/vendors/analytics/logrocket.d.ts +2 -101
- package/dist-types/vendors/analytics/matomo-analytics.d.ts +2 -41
- package/dist-types/vendors/analytics/microsoft-clarity.d.ts +2 -97
- package/dist-types/vendors/analytics/mixpanel-analytics.d.ts +2 -113
- package/dist-types/vendors/analytics/one-dollar-stats.d.ts +2 -39
- package/dist-types/vendors/analytics/pirsch.d.ts +2 -96
- package/dist-types/vendors/analytics/plausible-analytics.d.ts +2 -122
- package/dist-types/vendors/analytics/posthog.d.ts +2 -175
- package/dist-types/vendors/analytics/promptwatch.d.ts +2 -36
- package/dist-types/vendors/analytics/rudderstack.d.ts +2 -330
- package/dist-types/vendors/analytics/rybbit-analytics.d.ts +2 -82
- package/dist-types/vendors/analytics/segment.d.ts +2 -164
- package/dist-types/vendors/analytics/umami-analytics.d.ts +2 -93
- package/dist-types/vendors/analytics/vercel-analytics.d.ts +2 -66
- package/dist-types/vendors/email-and-sms/klaviyo.d.ts +2 -0
- package/dist-types/vendors/functional/crisp.d.ts +2 -78
- package/dist-types/vendors/functional/front-chat.d.ts +2 -62
- package/dist-types/vendors/functional/intercom.d.ts +2 -135
- package/dist-types/vendors/tag-managers/cloudflare-zaraz.d.ts +2 -39
- package/dist-types/vendors/tag-managers/google-tag-manager.d.ts +2 -96
- package/dist-types/vercel-analytics.d.ts +2 -0
- package/dist-types/x-pixel.d.ts +2 -0
- package/docs/README.md +129 -63
- package/docs/assets/v3/bottom-bar.png +0 -0
- package/docs/assets/v3/brand-card.png +0 -0
- package/docs/assets/v3/brand-preferences.png +0 -0
- package/docs/assets/v3/choice-wall.png +0 -0
- package/docs/assets/v3/headless-bar-html.png +0 -0
- package/docs/assets/v3/headless-bar-mobile.png +0 -0
- package/docs/assets/v3/headless-bar.png +0 -0
- package/docs/assets/v3/slim-bar.png +0 -0
- package/docs/concepts/choose-your-setup.md +87 -0
- package/docs/concepts/consent-categories.md +84 -0
- package/docs/{guides → concepts}/consent-state.md +89 -105
- package/docs/{guides → concepts}/data-fetching.md +31 -27
- package/docs/concepts/how-consent-works.md +123 -0
- package/docs/concepts/policies.md +71 -0
- package/docs/customization/class-names.md +202 -0
- package/docs/customization/dark-mode.md +157 -0
- package/docs/customization/motion.md +119 -0
- package/docs/customization/overview.md +67 -34
- package/docs/customization/recipes.md +839 -49
- package/docs/customization/slots.md +216 -35
- package/docs/customization/stylesheets.md +147 -0
- package/docs/customization/tailwind.md +842 -0
- package/docs/customization/tokens.md +163 -96
- package/docs/customization/translations.md +60 -3
- package/docs/frameworks/astro/embeds.md +160 -0
- package/docs/frameworks/astro/network-blocker.md +86 -0
- package/docs/frameworks/astro/scripts.md +155 -0
- package/docs/frameworks/html/embeds.md +142 -0
- package/docs/frameworks/html/network-blocker.md +105 -0
- package/docs/frameworks/html/scripts.md +164 -0
- package/docs/frameworks/javascript/scripts.md +137 -0
- package/docs/frameworks/next/embeds.md +90 -0
- package/docs/frameworks/next/network-blocker.md +153 -0
- package/docs/frameworks/next/scripts.md +196 -0
- package/docs/frameworks/nuxt/embeds.md +81 -0
- package/docs/frameworks/nuxt/network-blocker.md +97 -0
- package/docs/frameworks/nuxt/scripts.md +89 -0
- package/docs/frameworks/react/embeds.md +89 -0
- package/docs/frameworks/react/network-blocker.md +140 -0
- package/docs/frameworks/react/scripts.md +115 -0
- package/docs/frameworks/svelte/embeds.md +96 -0
- package/docs/frameworks/svelte/network-blocker.md +141 -0
- package/docs/frameworks/svelte/scripts.md +144 -0
- package/docs/frameworks/sveltekit/embeds.md +103 -0
- package/docs/frameworks/sveltekit/network-blocker.md +159 -0
- package/docs/frameworks/sveltekit/scripts.md +172 -0
- package/docs/frameworks/tanstack-start/embeds.md +96 -0
- package/docs/frameworks/tanstack-start/network-blocker.md +145 -0
- package/docs/frameworks/tanstack-start/scripts.md +103 -0
- package/docs/frameworks/vue/embeds.md +84 -0
- package/docs/frameworks/vue/network-blocker.md +99 -0
- package/docs/frameworks/vue/scripts.md +93 -0
- package/docs/guides/banner-experiments.md +654 -0
- package/docs/guides/troubleshooting.md +120 -47
- package/docs/guides/verify-consent.md +81 -49
- package/docs/integrations/adobe-analytics.md +167 -159
- package/docs/integrations/ahrefs-analytics.md +152 -154
- package/docs/integrations/amplitude.md +162 -156
- package/docs/integrations/building-integrations.md +136 -37
- package/docs/integrations/clearbit.md +154 -154
- package/docs/integrations/cloudflare-web-analytics.md +156 -156
- package/docs/integrations/cloudflare-zaraz.md +209 -261
- package/docs/integrations/crisp.md +164 -158
- package/docs/integrations/databuddy.md +157 -173
- package/docs/integrations/fathom-analytics.md +158 -156
- package/docs/integrations/front-chat.md +167 -167
- package/docs/integrations/google-maps.md +118 -83
- package/docs/integrations/google-tag-manager.md +178 -163
- package/docs/integrations/google-tag.md +163 -160
- package/docs/integrations/heap.md +163 -155
- package/docs/integrations/hightouch.md +161 -157
- package/docs/integrations/hotjar.md +159 -155
- package/docs/integrations/intercom.md +183 -153
- package/docs/integrations/klaviyo.md +486 -0
- package/docs/integrations/linkedin-insights.md +174 -150
- package/docs/integrations/logrocket.md +160 -156
- package/docs/integrations/matomo-analytics.md +188 -178
- package/docs/integrations/meta-pixel.md +188 -150
- package/docs/integrations/microsoft-clarity.md +163 -155
- package/docs/integrations/microsoft-uet.md +148 -154
- package/docs/integrations/mixpanel-analytics.md +155 -160
- package/docs/integrations/one-dollar-stats.md +166 -165
- package/docs/integrations/openai-pixel.md +204 -301
- package/docs/integrations/overview.md +137 -80
- package/docs/integrations/pinterest-tag.md +191 -183
- package/docs/integrations/pirsch.md +169 -159
- package/docs/integrations/plausible-analytics.md +172 -158
- package/docs/integrations/posthog.md +313 -240
- package/docs/integrations/promptwatch.md +154 -154
- package/docs/integrations/reddit-pixel.md +185 -157
- package/docs/integrations/rudderstack.md +201 -186
- package/docs/integrations/rybbit-analytics.md +171 -160
- package/docs/integrations/segment.md +182 -154
- package/docs/integrations/snapchat-pixel.md +186 -156
- package/docs/integrations/tiktok-pixel.md +171 -150
- package/docs/integrations/umami-analytics.md +163 -158
- package/docs/integrations/vercel-analytics.md +166 -157
- package/docs/integrations/x-pixel.md +176 -150
- package/docs/integrations/youtube.md +121 -86
- package/docs/upgrade-v3.md +496 -467
- package/package.json +10 -257
- package/dist-types/__tests__/helpers.d.ts +0 -141
- package/docs/assets/v3/brand-bar.png +0 -0
- package/docs/assets/v3/mobile-card.png +0 -0
- package/docs/assets/v3/preferences.png +0 -0
- package/docs/frameworks/javascript/script-loader.md +0 -100
- package/docs/frameworks/next/script-loader.md +0 -216
- package/docs/frameworks/react/script-loader.md +0 -69
- package/docs/guides/deployment-modes.md +0 -75
- package/docs/guides/shared-consent-controls.md +0 -158
- package/docs/integrations/clear-on-revocation.md +0 -167
- package/docs/integrations/granular-consent.md +0 -210
|
@@ -1,24 +1,14 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
3
|
-
description:
|
|
4
|
-
|
|
5
|
-
group:
|
|
2
|
+
title: Consent state reference
|
|
3
|
+
description: How c15t saves choices, gates IAB vendors, hydrates server records
|
|
4
|
+
and keeps browser tabs and storage in step.
|
|
5
|
+
group: concepts
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
permission can be true before the visitor acts. It is not evidence of a recorded
|
|
13
|
-
grant.
|
|
14
|
-
|
|
15
|
-
| Task | State or API |
|
|
16
|
-
| ------------------------------------------- | ---------------------------------------------------- |
|
|
17
|
-
| Load a script or render an optional feature | `effectivePermissions`, React `useConsent(category)` |
|
|
18
|
-
| Inspect what the visitor confirmed | `explicitChoice` |
|
|
19
|
-
| Decide whether to show a prompt | `promptRequirement` |
|
|
20
|
-
| Explain regional behavior | `policyRule` |
|
|
21
|
-
| Diagnose initialization | `resolution` |
|
|
8
|
+
This reference covers the edge cases behind the model in
|
|
9
|
+
[how consent works](./how-consent-works.md). You need it when you
|
|
10
|
+
build custom consent UI, run c15t across subdomains, or debug a choice that
|
|
11
|
+
changes between tabs.
|
|
22
12
|
|
|
23
13
|
## Gate IAB vendors on the TC string
|
|
24
14
|
|
|
@@ -27,7 +17,7 @@ or IAB purposes is an IAB target. It runs only while a confirmed TC string
|
|
|
27
17
|
grants what it declares: purpose and vendor consent for `iabPurposes`, purpose
|
|
28
18
|
and vendor legitimate interest for `iabLegIntPurposes`, and opt-ins for
|
|
29
19
|
`iabSpecialFeatures`. Every category it names must also be free of
|
|
30
|
-
restrictions, so GPC
|
|
20
|
+
restrictions, so GPC or strict scope blocks it.
|
|
31
21
|
|
|
32
22
|
A refused category is the one exception. It does not block an IAB target that
|
|
33
23
|
processes only on legitimate interest, after publisher restrictions, because
|
|
@@ -37,29 +27,13 @@ itself stays refused: its `effectivePermissions` entry is `false`, and targets
|
|
|
37
27
|
that name only the category, or that also declare a consent purpose or special
|
|
38
28
|
feature, stay blocked.
|
|
39
29
|
|
|
40
|
-
## Record only explicit visitor actions
|
|
41
|
-
|
|
42
|
-
```ts
|
|
43
|
-
// Run in the corresponding click or form-submit handler.
|
|
44
|
-
await kernel.commands.save('all');
|
|
45
|
-
await kernel.commands.save('none');
|
|
46
|
-
await kernel.commands.save({ marketing: false });
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
These are three separate examples: accept, reject and a partial save. A partial
|
|
50
|
-
save confirms only the supplied categories and keeps the other categories'
|
|
51
|
-
confirmation times. Do not call all three in one handler.
|
|
52
|
-
|
|
53
|
-
`onChoiceRecorded` reports an explicit choice. `onPermissionsChanged` reports
|
|
54
|
-
changes in effective permissions, including changes caused by expiry or privacy
|
|
55
|
-
signals. Hydration must not be counted as another visitor choice.
|
|
56
|
-
|
|
57
30
|
## When a choice is saved
|
|
58
31
|
|
|
59
32
|
A save records the choice in the browser first and sends it to the backend
|
|
60
33
|
afterwards. The stock banner, preference dialog and IAB surfaces in every
|
|
61
|
-
framework adapter, and the
|
|
62
|
-
and
|
|
34
|
+
framework adapter, and the `acceptAll()`, `rejectAll()` and `save()` methods
|
|
35
|
+
of the browser and Astro clients, close without waiting for the backend. In
|
|
36
|
+
order:
|
|
63
37
|
|
|
64
38
|
1. In the click task, the explicit choice and effective permissions change,
|
|
65
39
|
`onChoiceRecorded` and `onPermissionsChanged` run, gated scripts, iframes
|
|
@@ -79,9 +53,10 @@ and `save()`, close without waiting for the backend. In order:
|
|
|
79
53
|
|
|
80
54
|
A failed request does not reopen the surface or roll the choice back. The
|
|
81
55
|
kernel emits `command:error`, which reaches the `onError` callback in adapters
|
|
82
|
-
that accept one, and queues the payload in localStorage.
|
|
83
|
-
|
|
84
|
-
|
|
56
|
+
that accept one, and queues the payload in localStorage. Where localStorage is
|
|
57
|
+
unavailable, the queue lives in memory until the page unloads. The queue is
|
|
58
|
+
replayed after the next successful initialization and when the browser comes
|
|
59
|
+
back online, up to 10 attempts over 7 days. A replay carries the original action
|
|
85
60
|
time and policy snapshot token, so the backend records when the visitor
|
|
86
61
|
decided, and a duplicate submission resolves to the same consent record. A
|
|
87
62
|
backend that signs policy snapshot tokens rejects a replay made after the
|
|
@@ -93,17 +68,13 @@ after its TC string is encoded, which can wait for the TCF library to load.
|
|
|
93
68
|
If that local step records nothing, for example because the vendor list
|
|
94
69
|
failed to load, the surface comes back so the visitor can try again.
|
|
95
70
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
A rule with `prompt: 'none'` can still require a persistent preferences entry
|
|
104
|
-
point. Check the policy's rights instead of hiding preferences merely because
|
|
105
|
-
the banner is absent. An unresolved rule is another distinct state; optional
|
|
106
|
-
permissions stay denied until resolution succeeds.
|
|
71
|
+
Every adapter leaves the same surface after a save: the banner while the
|
|
72
|
+
policy still owes a choice or a notice, and nothing once no prompt is owed,
|
|
73
|
+
while the policy is still loading, or after it failed to resolve. A banner
|
|
74
|
+
the visitor reopened closes too. A save that records nothing new, such as an
|
|
75
|
+
unchanged selection, closes the surface when it resolves successfully. Opening
|
|
76
|
+
or closing a surface, or starting another save, before then leaves the surface
|
|
77
|
+
as the visitor set it.
|
|
107
78
|
|
|
108
79
|
## Preserve records during hydration
|
|
109
80
|
|
|
@@ -128,7 +99,8 @@ shows the prompt again.
|
|
|
128
99
|
Tabs on another subdomain that shares the consent cookie do not share
|
|
129
100
|
localStorage, so the browser sends them no `storage` event. They pick up the
|
|
130
101
|
change on their next focus or visibility change, or when you reconcile
|
|
131
|
-
yourself
|
|
102
|
+
yourself as described in
|
|
103
|
+
[Reconcile yourself or turn it off](#reconcile-yourself-or-turn-it-off).
|
|
132
104
|
|
|
133
105
|
The `storage` event only exists for localStorage. When localStorage is
|
|
134
106
|
unavailable (blocked by the browser, a sandboxed frame or a privacy mode) and
|
|
@@ -150,8 +122,8 @@ Several triggers in quick succession run one reconciliation in a later task.
|
|
|
150
122
|
Reconnecting does not read storage, because going online changes nothing in
|
|
151
123
|
browser storage. On reconnect the kernel retries saves the backend did not
|
|
152
124
|
accept and a failed initialization. Save retries do not write the cookie or
|
|
153
|
-
localStorage. A write that follows initialization
|
|
154
|
-
|
|
125
|
+
localStorage. A write that follows initialization obeys the rules in
|
|
126
|
+
[Ordering with pending writes](#ordering-with-pending-writes).
|
|
155
127
|
|
|
156
128
|
Every adapter that mounts browser persistence does this: the React, Next.js and
|
|
157
129
|
TanStack Start providers, Vue, Svelte, Astro, the script tag and
|
|
@@ -164,8 +136,6 @@ Stored records are merged into the ones in memory:
|
|
|
164
136
|
* Category decisions merge per category. Each category keeps the decision with
|
|
165
137
|
the newer confirmation time, so a tab that only changed marketing never
|
|
166
138
|
reverts another tab's newer measurement decision.
|
|
167
|
-
* Privacy directives, such as a Global Privacy Control opt-out, merge as a
|
|
168
|
-
union. A directive only restricts, so none is dropped.
|
|
169
139
|
* The notice dismissal and the vendor record are single decisions. A stored one
|
|
170
140
|
at least as new as the one in memory replaces it; an older one is ignored.
|
|
171
141
|
* When two tabs record decisions in the same millisecond, the one stored first
|
|
@@ -177,38 +147,8 @@ Stored records are merged into the ones in memory:
|
|
|
177
147
|
resolved (at init, from a prefetch or in a save response) is replaced only by
|
|
178
148
|
a strictly newer stored choice, and an identity set with `identify()` is
|
|
179
149
|
never replaced.
|
|
180
|
-
* Under an IAB policy, the
|
|
181
|
-
|
|
182
|
-
so `__tcfapi` and the preference controls show the choice now in force.
|
|
183
|
-
Selections the visitor changed in this tab without saving are kept. A missing
|
|
184
|
-
or older stored TC string leaves the current one in place, unless it conflicts
|
|
185
|
-
with the reconciled choice: then it is withdrawn and `__tcfapi` reports no
|
|
186
|
-
consent until the next save. A category denied after the TC string was saved
|
|
187
|
-
conflicts if the TC string grants any of its purposes. A partial selection
|
|
188
|
-
saved through IAB, which records its category as denied because not every
|
|
189
|
-
purpose is granted, keeps its TC string. A TC string confirmed before the
|
|
190
|
-
choice's newest decision no longer describes it and is withdrawn too, unless
|
|
191
|
-
a newer receipt replaces it. That receipt is adopted even when its TC string
|
|
192
|
-
is identical, since TC strings round their time to the day and custom-vendor
|
|
193
|
-
selections live only in the receipt; its expiry then applies. The TC
|
|
194
|
-
string and its receipt (`euconsent-v2`, `c15t-iab-authority-v1`) belong to one
|
|
195
|
-
origin, so after a save on a sibling subdomain that shares the consent cookie,
|
|
196
|
-
this subdomain reports no consent through `__tcfapi` until it saves again.
|
|
197
|
-
Vendors never receive the stale TC string in between: it is withdrawn, or
|
|
198
|
-
held back, before `__tcfapi` publishes. A tab also reloads the TC string
|
|
199
|
-
when another tab on the same origin stores a new one, which covers a save in
|
|
200
|
-
the same millisecond or one that changed only vendors. When two tabs save in
|
|
201
|
-
the same millisecond with different selections, the more restrictive TC
|
|
202
|
-
string wins in both, so a revoked vendor is never advertised again. If each
|
|
203
|
-
grants something the other denies, neither is published until the next save:
|
|
204
|
-
the stored receipt is removed, so a page opened later does not restore it.
|
|
205
|
-
When another tab removes the receipt, or clears localStorage, the TC string
|
|
206
|
-
is withdrawn here too, since a page opened now would find none, and a
|
|
207
|
-
receipt this tab was still decoding is not installed. The removal after a
|
|
208
|
-
tie checks that the stored receipt is the one it read, but localStorage has
|
|
209
|
-
no conditional removal, so a receipt another tab stored a moment earlier can
|
|
210
|
-
still be removed. Every tab then withdraws its TC string until the next save,
|
|
211
|
-
so the race only ever withholds consent.
|
|
150
|
+
* Under an IAB policy, the TC string follows the reconciled choice. See
|
|
151
|
+
[How the TC string is reconciled](#how-the-tc-string-is-reconciled).
|
|
212
152
|
* A record removed from readable storage since this tab last saw it present is
|
|
213
153
|
cleared, and the active policy decides again. A record this tab never saw in
|
|
214
154
|
storage, such as a receipt merged from the server after `identify()` or a
|
|
@@ -219,8 +159,55 @@ Stored records are merged into the ones in memory:
|
|
|
219
159
|
Expiry is not decided here. The applied records are evaluated at the time of the
|
|
220
160
|
read, the same way as at startup.
|
|
221
161
|
|
|
162
|
+
### How the TC string is reconciled
|
|
163
|
+
|
|
164
|
+
Under an IAB policy, a tab adopts the TC string another tab stored, unless that
|
|
165
|
+
TC string conflicts with the reconciled choice. A conflicting TC string is
|
|
166
|
+
withdrawn, and `__tcfapi` reports no consent until the next save. Vendors never
|
|
167
|
+
receive a stale TC string: c15t withdraws it, or holds it back, before
|
|
168
|
+
`__tcfapi` publishes.
|
|
169
|
+
|
|
170
|
+
1. The `@c15t/iab` module loads the TC string the other tab stored, with its
|
|
171
|
+
purpose, vendor and special-feature selections, so `__tcfapi` and the
|
|
172
|
+
preference controls show the choice now in force. Selections the visitor
|
|
173
|
+
changed in this tab without saving are kept.
|
|
174
|
+
2. A missing or older stored TC string leaves the current one in place, unless
|
|
175
|
+
the current one conflicts with the reconciled choice. Then it is withdrawn.
|
|
176
|
+
3. A category denied after the TC string was saved conflicts if the TC string
|
|
177
|
+
grants any of its purposes. A partial selection saved through IAB, which
|
|
178
|
+
records its category as denied because not every purpose is granted, keeps
|
|
179
|
+
its TC string.
|
|
180
|
+
4. A TC string confirmed before the choice's newest decision no longer
|
|
181
|
+
describes it and is withdrawn, unless a newer receipt replaces it. That
|
|
182
|
+
receipt is adopted even when its TC string is identical, because TC strings
|
|
183
|
+
round their time to the day and custom-vendor selections live only in the
|
|
184
|
+
receipt. The receipt's expiry then applies.
|
|
185
|
+
5. The TC string and its receipt (`euconsent-v2`, `c15t-iab-authority-v1`)
|
|
186
|
+
belong to one origin. After a save on a sibling subdomain that shares the
|
|
187
|
+
consent cookie, this subdomain reports no consent through `__tcfapi` until
|
|
188
|
+
it saves again.
|
|
189
|
+
6. A tab reloads the TC string when another tab on the same origin stores a
|
|
190
|
+
new one. This covers a save in the same millisecond, or one that changed
|
|
191
|
+
only vendors.
|
|
192
|
+
7. When two tabs save in the same millisecond with different selections, the
|
|
193
|
+
more restrictive TC string wins in both, so a revoked vendor is never
|
|
194
|
+
advertised again. If each grants something the other denies, neither is
|
|
195
|
+
published until the next save, and the stored receipt is removed so a page
|
|
196
|
+
opened later does not restore it.
|
|
197
|
+
8. When another tab removes the receipt or clears localStorage, this tab
|
|
198
|
+
withdraws its TC string too, because a page opened now would find none. A
|
|
199
|
+
receipt this tab was still decoding is not installed.
|
|
200
|
+
9. The removal after a tie checks that the stored receipt is the one it read.
|
|
201
|
+
localStorage has no conditional removal, so a receipt another tab stored a
|
|
202
|
+
moment earlier can still be removed. Every tab then withdraws its TC string
|
|
203
|
+
until the next save, so the race only ever withholds consent.
|
|
204
|
+
|
|
222
205
|
### Clearing records across tabs
|
|
223
206
|
|
|
207
|
+
`clearRecords()` also drops every save queued for replay, with or without
|
|
208
|
+
browser persistence, so nothing the visitor decided before the clear reaches
|
|
209
|
+
the backend afterwards.
|
|
210
|
+
|
|
224
211
|
`clearRecords()` removes every record and then stores the time of the clear,
|
|
225
212
|
the clear epoch, under its own key: `c15t-epoch` in localStorage and a cookie
|
|
226
213
|
of the same name (`<storageKey>-epoch` with a custom `storageKey`). Clearing
|
|
@@ -295,15 +282,14 @@ cookie takes, for example because storage is full, the older localStorage copy
|
|
|
295
282
|
is removed.
|
|
296
283
|
|
|
297
284
|
When a server render seeded the page from the consent cookie
|
|
298
|
-
(`skipHydration`), that seed stays authoritative. A denial
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
The notice dismissal
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
one the cookie holds; a copy confirmed before the last clear is ignored, so its
|
|
285
|
+
(`skipHydration`), that seed stays authoritative. A denial that reached only
|
|
286
|
+
localStorage is still applied on top of it when the page mounts, since it can
|
|
287
|
+
only restrict, if it is newer than the seeded decision or from the same
|
|
288
|
+
millisecond as a seeded grant. A stored grant is not.
|
|
289
|
+
|
|
290
|
+
The notice dismissal and vendor denials are stored twice as well. A vendor
|
|
291
|
+
list in localStorage at least as new as the cookie's adds its denials but never
|
|
292
|
+
lifts one the cookie holds; a copy confirmed before the last clear is ignored, so its
|
|
307
293
|
denials never come back. The newer notice dismissal applies; it still only hides a
|
|
308
294
|
notice with the fingerprint it names. The consent record follows the rules
|
|
309
295
|
below.
|
|
@@ -343,20 +329,18 @@ A tab writes its own choices in a later task, not during the click. Before it
|
|
|
343
329
|
reads storage, it lands its own queued writes, so a reconciliation never undoes
|
|
344
330
|
the visitor's latest action in that tab. A queued write follows the same rules
|
|
345
331
|
as a read: it stores the per-category merge of its choice and the stored one,
|
|
346
|
-
|
|
347
|
-
|
|
332
|
+
and never replaces a newer notice or vendor record. It keeps the stored subject
|
|
333
|
+
unless this tab identified a different user.
|
|
348
334
|
When a slow save response returns a server subject id, the tab adds it only to
|
|
349
335
|
the record it wrote; it does not recreate records another tab cleared or
|
|
350
336
|
overwrite another tab's newer choice.
|
|
351
337
|
|
|
352
338
|
Two tabs that write at the same moment can both read storage before either
|
|
353
|
-
writes, and the later write can then drop the other tab's category
|
|
354
|
-
|
|
339
|
+
writes, and the later write can then drop the other tab's category decision.
|
|
340
|
+
The tab whose decision was dropped still holds it, and on its next
|
|
355
341
|
reconciliation it writes it back, merged with what storage holds. It does so
|
|
356
342
|
only for decisions it actually stored itself, never for one a clear voided or
|
|
357
|
-
another tab replaced with a newer one.
|
|
358
|
-
it kept from storage too, so if another write drops one of those, this tab
|
|
359
|
-
restores it and applies it as well.
|
|
343
|
+
another tab replaced with a newer one.
|
|
360
344
|
|
|
361
345
|
If another tab's change reaches this tab while one of its saves is pending, the
|
|
362
346
|
save depends on how far it got. A save not yet sent is dropped. A request
|
|
@@ -1,23 +1,17 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: Data fetching
|
|
3
|
-
description:
|
|
4
|
-
and
|
|
5
|
-
group:
|
|
2
|
+
title: Data fetching
|
|
3
|
+
description: How c15t gets policy data through a cached manifest, backend /init,
|
|
4
|
+
the browser or offline rules, and where consent choices are saved.
|
|
5
|
+
group: concepts
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## Compare the fetching paths
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
[
|
|
15
|
-
|
|
16
|
-
Backend ownership and data fetching are separate decisions. Inth manages the
|
|
17
|
-
backend for you. A [self-hosted backend](https://c15t.com/docs/self-host/quickstart) uses the same
|
|
18
|
-
protocol while you operate its database, policies and availability. A static
|
|
19
|
-
site can still call Inth. Only `offline()` deliberately removes consent backend
|
|
20
|
-
requests and stores choices locally.
|
|
10
|
+
Where policy resolves and where choices are saved are separate from who runs
|
|
11
|
+
the backend. Inth and a [self-hosted backend](https://c15t.com/docs/self-host/quickstart) speak
|
|
12
|
+
the same protocol, so every path below works with either. Only `offline()`
|
|
13
|
+
removes backend requests. For a recommendation by framework, start with
|
|
14
|
+
[choose your setup](./choose-your-setup.md).
|
|
21
15
|
|
|
22
16
|
| Fetching path | Where policy resolves | Where choices are submitted | Choose it when |
|
|
23
17
|
| ------------------------------ | ------------------------------------------------------------------------------------- | --------------------------- | ------------------------------------------------------------------------------------------------------ |
|
|
@@ -44,6 +38,16 @@ Do not put secrets, visitor identifiers or consent records into a manifest.
|
|
|
44
38
|
Keep personalized init responses out of shared caches. Changing a policy also
|
|
45
39
|
requires a refresh strategy for cached or build-time manifests.
|
|
46
40
|
|
|
41
|
+
## How manifest mode counts visitors
|
|
42
|
+
|
|
43
|
+
The backend counts visitors from `/init` requests, and manifest resolution
|
|
44
|
+
skips them. To keep the count, the server adapters send a session report after
|
|
45
|
+
each resolution: the host posts to the backend's `POST /sessions` from the
|
|
46
|
+
server, after the response. The browser sends nothing, and the report stores
|
|
47
|
+
no identity; the visitor's IP address and user agent are forwarded under the
|
|
48
|
+
backend's usual IP handling. Static output resolves in the browser and sends
|
|
49
|
+
no report. Set `reportSessions: false` on an adapter to turn it off.
|
|
50
|
+
|
|
47
51
|
## What does regular `/init` do?
|
|
48
52
|
|
|
49
53
|
`hosted({ url })` uses `${url}/init` for initialization and `${url}/subjects` for
|
|
@@ -54,7 +58,7 @@ can belong to Inth or your own c15t backend.
|
|
|
54
58
|
import { hosted } from 'c15t';
|
|
55
59
|
|
|
56
60
|
export function createConsentMode(backendURL: string) {
|
|
57
|
-
|
|
61
|
+
return hosted({ url: backendURL });
|
|
58
62
|
}
|
|
59
63
|
```
|
|
60
64
|
|
|
@@ -81,9 +85,9 @@ separate policy reads and record writes. With a backend rewrite mounted at
|
|
|
81
85
|
import { hosted } from 'c15t';
|
|
82
86
|
|
|
83
87
|
export const mode = hosted({
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
88
|
+
url: '/api/c15t',
|
|
89
|
+
initURL: '/api/c15t/init',
|
|
90
|
+
assertDecisionInputs: true,
|
|
87
91
|
});
|
|
88
92
|
```
|
|
89
93
|
|
|
@@ -105,11 +109,11 @@ and TLS connection to the consent backend. The app server still connects to
|
|
|
105
109
|
the upstream backend for manifest refreshes and consent writes. Vendor scripts
|
|
106
110
|
and vendor requests keep their own origins.
|
|
107
111
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
112
|
+
The rewrite destination and the init route use the absolute upstream endpoint,
|
|
113
|
+
such as `https://your-project.inth.app`. The browser uses `/api/c15t` without
|
|
114
|
+
needing the upstream URL. A static export cannot serve a Next.js route or
|
|
115
|
+
rewrite at runtime; use the absolute Inth URL or a proxy provided by the static
|
|
116
|
+
host instead.
|
|
113
117
|
|
|
114
118
|
## When should I use offline mode?
|
|
115
119
|
|
|
@@ -134,7 +138,7 @@ export const mode = offline();
|
|
|
134
138
|
With no `policyRules`, the current offline transport uses the recommended rule
|
|
135
139
|
pack. Supplying `policyRules` replaces that pack. Unknown country and region are
|
|
136
140
|
real resolution inputs; offline mode does not discover a visitor's location.
|
|
137
|
-
Use [policy rules](
|
|
141
|
+
Use [policy rules](./policies.md) to understand
|
|
138
142
|
matching and defaults, and test the missing-location case.
|
|
139
143
|
|
|
140
144
|
Offline mode is an explicit architecture choice, not an automatic fallback for
|
|
@@ -160,4 +164,4 @@ refresh. In the recommended Next.js setup, the browser should call only
|
|
|
160
164
|
upstream destinations.
|
|
161
165
|
|
|
162
166
|
Test different locations, missing location headers, GPC, returning choices and
|
|
163
|
-
backend failure. See [verification](
|
|
167
|
+
backend failure. See [verification](../guides/verify-consent.md).
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: How consent works
|
|
3
|
+
description: What c15t decides on each page load, the difference between a
|
|
4
|
+
permission and a recorded choice, and what happens when a visitor saves.
|
|
5
|
+
group: concepts
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## What c15t decides on each page load
|
|
9
|
+
|
|
10
|
+
On every page load c15t answers one question for each consent category: is
|
|
11
|
+
this allowed right now? To answer it, c15t:
|
|
12
|
+
|
|
13
|
+
1. Selects a **policy** for the visitor, usually by country and region. The
|
|
14
|
+
policy says whether optional categories start denied (opt-in) or allowed
|
|
15
|
+
(opt-out), and whether to show a banner.
|
|
16
|
+
2. Reads the visitor's **stored choice** from a cookie and localStorage, if
|
|
17
|
+
there is one that still matches the policy.
|
|
18
|
+
3. Reads **privacy signals** such as Global Privacy Control (GPC).
|
|
19
|
+
|
|
20
|
+
The result is a set of **permissions**, one per category. Components, script
|
|
21
|
+
loaders, embeds and your own code read those permissions. Nothing optional
|
|
22
|
+
runs until the policy has resolved: while it loads, and if it fails, every
|
|
23
|
+
optional category is denied.
|
|
24
|
+
|
|
25
|
+
A banner is only the interface. It does not stop a script you load with a
|
|
26
|
+
plain `<script>` tag or a vendor SDK you initialize yourself. To gate that code,
|
|
27
|
+
register it with c15t. See [integrations](../integrations/overview.md).
|
|
28
|
+
|
|
29
|
+
## Categories
|
|
30
|
+
|
|
31
|
+
| Category | Use it for |
|
|
32
|
+
| --------------- | -------------------------------------------------- |
|
|
33
|
+
| `necessary` | Code the site cannot work without. Always allowed. |
|
|
34
|
+
| `functionality` | Optional features such as support chat. |
|
|
35
|
+
| `measurement` | Analytics and usage measurement. |
|
|
36
|
+
| `experience` | Personalization. |
|
|
37
|
+
| `marketing` | Advertising, retargeting and pixels. |
|
|
38
|
+
|
|
39
|
+
Assign a category by what the code does, not by what would be convenient.
|
|
40
|
+
Calling analytics `necessary` does not make it necessary.
|
|
41
|
+
[Consent categories](./consent-categories.md) explains which
|
|
42
|
+
categories the preference dialog shows and how policy scope affects them.
|
|
43
|
+
|
|
44
|
+
## Policies
|
|
45
|
+
|
|
46
|
+
A policy has a **model** and a **prompt**:
|
|
47
|
+
|
|
48
|
+
| Model | Optional categories before a choice |
|
|
49
|
+
| --------- | ----------------------------------------------------------------- |
|
|
50
|
+
| `opt-in` | Denied until the visitor allows them. |
|
|
51
|
+
| `opt-out` | Allowed until the visitor refuses them or sends a privacy signal. |
|
|
52
|
+
| `iab` | Controlled by an IAB TCF consent string. |
|
|
53
|
+
| `none` | Allowed, with no prompt. |
|
|
54
|
+
|
|
55
|
+
| Prompt | What the visitor sees |
|
|
56
|
+
| -------- | ------------------------------------------------------------------------------ |
|
|
57
|
+
| `choice` | A banner asking for a decision. |
|
|
58
|
+
| `notice` | A notice they can dismiss. Dismissing records an acknowledgement, not consent. |
|
|
59
|
+
| `none` | Nothing on load. The policy can still require a way to open preferences. |
|
|
60
|
+
|
|
61
|
+
With [Inth](https://inth.com) you manage policies in your project, and the app
|
|
62
|
+
receives them from the backend. Changing a stylesheet or importing a preset in
|
|
63
|
+
the browser does not override a hosted policy.
|
|
64
|
+
[Policies](./policies.md) covers presets, scope, and why a banner may
|
|
65
|
+
not appear.
|
|
66
|
+
|
|
67
|
+
## A permission is not a recorded choice
|
|
68
|
+
|
|
69
|
+
These two values answer different questions, and mixing them up is the most
|
|
70
|
+
common integration bug:
|
|
71
|
+
|
|
72
|
+
* **Permission** (`effectivePermissions`, `useConsent('measurement')`) answers
|
|
73
|
+
"may this run now?" Under an opt-out policy it can be `true` before the
|
|
74
|
+
visitor has done anything.
|
|
75
|
+
* **Recorded choice** (`explicitChoice`) answers "what did the visitor decide?"
|
|
76
|
+
It only changes when the visitor accepts, rejects or saves preferences.
|
|
77
|
+
|
|
78
|
+
| Task | Read |
|
|
79
|
+
| ---------------------------------------------------- | ------------------- |
|
|
80
|
+
| Load a script or render an optional feature | Permission |
|
|
81
|
+
| Show what the visitor chose, or report consent rates | Recorded choice |
|
|
82
|
+
| Decide whether a prompt is needed | `promptRequirement` |
|
|
83
|
+
| Find out why a region behaves differently | `policyRule` |
|
|
84
|
+
| Check that the policy loaded | `resolution.status` |
|
|
85
|
+
|
|
86
|
+
Never turn a permission into a saved choice. Hydrating server state, reading a
|
|
87
|
+
cookie or rendering a component does not count as a visitor action.
|
|
88
|
+
`onChoiceRecorded` fires only for a visitor's action; `onPermissionsChanged`
|
|
89
|
+
also fires when a choice expires or a privacy signal changes.
|
|
90
|
+
|
|
91
|
+
## Notices and privacy signals
|
|
92
|
+
|
|
93
|
+
Dismissing a notice acknowledges it. It grants nothing and leaves earlier
|
|
94
|
+
refusals in place.
|
|
95
|
+
|
|
96
|
+
GPC is a browser setting that asks sites not to sell or share data. c15t reads
|
|
97
|
+
it live on every evaluation and applies the restrictions your policy configures
|
|
98
|
+
for it. It never becomes a stored refusal: when the browser stops sending GPC,
|
|
99
|
+
the restriction ends. The backend also sees the current value.
|
|
100
|
+
|
|
101
|
+
## What happens when a visitor saves
|
|
102
|
+
|
|
103
|
+
When a visitor clicks Accept, Reject or Save, c15t:
|
|
104
|
+
|
|
105
|
+
1. Updates permissions and closes the banner or dialog in the same click.
|
|
106
|
+
Scripts, embeds and network rules follow the new permissions immediately.
|
|
107
|
+
2. Writes the choice to the cookie and localStorage.
|
|
108
|
+
3. Sends the choice to the consent backend. If the request fails, the choice
|
|
109
|
+
stays saved in the browser and the request is retried later.
|
|
110
|
+
4. Reloads the page if the visitor turned off something they had allowed.
|
|
111
|
+
Code that already ran cannot be unloaded, so the reload starts a page with
|
|
112
|
+
only permitted code. Set `reloadOnConsentRevoked: false` to handle revocation
|
|
113
|
+
yourself.
|
|
114
|
+
|
|
115
|
+
The [consent state reference](./consent-state.md) documents the exact
|
|
116
|
+
ordering, retries, server hydration and how open tabs stay in step.
|
|
117
|
+
|
|
118
|
+
## Where consent data comes from
|
|
119
|
+
|
|
120
|
+
A consent backend supplies policies and stores consent records. Use Inth, run
|
|
121
|
+
the [c15t backend](https://c15t.com/docs/self-host/overview) yourself, or keep policies in the
|
|
122
|
+
browser for local development. [Choose your setup](./choose-your-setup.md)
|
|
123
|
+
walks through the options for your framework and hosting.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Policies
|
|
3
|
+
description: How policy models, prompts and scope decide what c15t asks
|
|
4
|
+
visitors, where to change the rules, and why a banner may not appear.
|
|
5
|
+
group: concepts
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## What the policy controls
|
|
9
|
+
|
|
10
|
+
A policy rule selects the permission model, categories, prompt and persistent
|
|
11
|
+
privacy controls for a visitor. Your app reads the resolved rule and effective
|
|
12
|
+
permissions. It should not choose a different rule just to hide a banner.
|
|
13
|
+
|
|
14
|
+
| Policy setting | What your app should expect |
|
|
15
|
+
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
16
|
+
| `model: 'opt-in'` | Optional categories in scope wait for consent. |
|
|
17
|
+
| `model: 'opt-out'` | Categories in scope can be allowed before a choice. Saved refusals and privacy signals can restrict them. |
|
|
18
|
+
| `model: 'none'` | Categories in scope are allowed without an initial prompt. Stock consent controls stay hidden unless the rule grants privacy rights. |
|
|
19
|
+
| `prompt: 'choice'` | The banner asks for a choice when the current state requires one. |
|
|
20
|
+
| `prompt: 'notice'` | Dismissing the notice records an acknowledgement, not a consent grant. |
|
|
21
|
+
| `prompt: 'none'` | No automatic prompt. The rule can still require a way to open preferences. |
|
|
22
|
+
| `scopeMode: 'strict'` | Optional categories outside the rule's scope stay denied. |
|
|
23
|
+
|
|
24
|
+
Keep a persistent preferences entry point wherever the policy provides that
|
|
25
|
+
right. A visitor who dismissed a notice or rejected tracking still needs a way
|
|
26
|
+
to revisit their choice. Stock components read the rule's rights; custom UI
|
|
27
|
+
must do the same.
|
|
28
|
+
|
|
29
|
+
Use `effectivePermissions` to gate a script or embed. A `true` value under an
|
|
30
|
+
opt-out rule does not mean the visitor clicked Accept. Read `explicitChoice`
|
|
31
|
+
when you need the visitor's recorded decision. See
|
|
32
|
+
[how consent works](./how-consent-works.md#a-permission-is-not-a-recorded-choice) for these distinctions.
|
|
33
|
+
|
|
34
|
+
## Where to change the rules
|
|
35
|
+
|
|
36
|
+
For Inth, configure policy rules on your hosted project. The app receives those
|
|
37
|
+
rules through the configured [data-fetching path](./data-fetching.md). Importing
|
|
38
|
+
`recommendedPolicyRules()` or changing browser styling does not override the
|
|
39
|
+
hosted policy.
|
|
40
|
+
|
|
41
|
+
For a backend you operate, use the
|
|
42
|
+
[policy packs guide](https://c15t.com/docs/self-host/guides/policy-packs). It covers
|
|
43
|
+
`manifest.policyRules`, preset selection and custom matchers. Browser-only
|
|
44
|
+
setups own their rules locally; see
|
|
45
|
+
[choose your setup](./choose-your-setup.md).
|
|
46
|
+
|
|
47
|
+
Presets are starting configurations. Select them for your actual processing,
|
|
48
|
+
and review their assumptions before allowing optional categories by default.
|
|
49
|
+
A country match does not establish a legal basis for a vendor's data use.
|
|
50
|
+
|
|
51
|
+
## Why the banner may be absent
|
|
52
|
+
|
|
53
|
+
A missing banner can be an expected policy outcome or an initialization problem.
|
|
54
|
+
Check `resolution.status` before interpreting the active model.
|
|
55
|
+
|
|
56
|
+
| State | What to check |
|
|
57
|
+
| ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
|
|
58
|
+
| A policy matched and `promptRequirement.kind` is `none` | The rule does not ask for an initial prompt, or the stored records already satisfy it. Check persistent preferences separately. |
|
|
59
|
+
| A policy matched but a category is denied | Inspect `effectivePermissions`, `explicitChoice`, `privacySignals` and `restrictions`. A saved refusal or GPC can keep it denied. |
|
|
60
|
+
| No policy has matched | Check backend connectivity, location inputs and policy configuration. Optional categories stay denied while resolution is unresolved. |
|
|
61
|
+
|
|
62
|
+
Do not treat `policyRule` alone as proof that a policy resolved. The snapshot
|
|
63
|
+
also carries a safe rule for evaluation while resolution is pending or failed.
|
|
64
|
+
Use `resolution.policy` only after checking for `status: 'matched'`.
|
|
65
|
+
|
|
66
|
+
The local `recommendedPolicyRules()` pack uses opt-in rules for Europe and
|
|
67
|
+
Québec, opt-out for its supported US privacy states, and a no-prompt `none`
|
|
68
|
+
default for other known locations. An unknown country uses its strict opt-in
|
|
69
|
+
fallback. A US country with a missing state gets the US opt-out fallback.
|
|
70
|
+
These are the local pack's defaults, not a promise about your Inth project.
|
|
71
|
+
Browser-only mode does not discover a visitor's country from their IP address.
|