@c15t/scripts 2.2.0 → 3.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (197) hide show
  1. package/AGENTS.md +74 -48
  2. package/README.md +3 -3
  3. package/dist/e2e-test-utils.js +60 -24
  4. package/dist/engine/compile.js +45 -45
  5. package/dist/engine/runtime.js +119 -119
  6. package/dist/registry.js +186 -176
  7. package/dist/resolve.js +12 -12
  8. package/dist/vendors/_shared/attributes.js +5 -5
  9. package/dist/vendors/_shared/google-consent.js +10 -10
  10. package/dist/vendors/_shared/install-builders.js +9 -9
  11. package/dist/vendors/_shared/script-url.js +12 -12
  12. package/dist/vendors/ads-and-pixels/linkedin-insights.js +16 -16
  13. package/dist/vendors/ads-and-pixels/meta-pixel.js +82 -82
  14. package/dist/vendors/ads-and-pixels/microsoft-uet.js +57 -57
  15. package/dist/vendors/ads-and-pixels/openai-pixel.js +88 -0
  16. package/dist/vendors/ads-and-pixels/reddit-pixel.js +39 -39
  17. package/dist/vendors/ads-and-pixels/snapchat-pixel.js +25 -25
  18. package/dist/vendors/ads-and-pixels/tiktok-pixel.js +31 -31
  19. package/dist/vendors/ads-and-pixels/x-pixel.js +17 -17
  20. package/dist/vendors/analytics/adobe-analytics.js +17 -17
  21. package/dist/vendors/analytics/ahrefs-analytics.js +8 -8
  22. package/dist/vendors/analytics/amplitude.js +39 -39
  23. package/dist/vendors/analytics/clearbit.js +11 -11
  24. package/dist/vendors/analytics/cloudflare-web-analytics.js +13 -13
  25. package/dist/vendors/analytics/databuddy.js +45 -45
  26. package/dist/vendors/analytics/fathom-analytics.js +15 -15
  27. package/dist/vendors/analytics/google-tag.js +23 -23
  28. package/dist/vendors/analytics/heap.js +37 -37
  29. package/dist/vendors/analytics/hightouch.js +30 -30
  30. package/dist/vendors/analytics/hotjar.js +14 -14
  31. package/dist/vendors/analytics/logrocket.js +24 -24
  32. package/dist/vendors/analytics/matomo-analytics.js +51 -51
  33. package/dist/vendors/analytics/microsoft-clarity.js +31 -31
  34. package/dist/vendors/analytics/mixpanel-analytics.js +31 -31
  35. package/dist/vendors/analytics/pirsch.js +27 -27
  36. package/dist/vendors/analytics/plausible-analytics.js +24 -24
  37. package/dist/vendors/analytics/posthog.js +84 -79
  38. package/dist/vendors/analytics/promptwatch.js +8 -8
  39. package/dist/vendors/analytics/rudderstack.js +50 -50
  40. package/dist/vendors/analytics/rybbit-analytics.js +30 -30
  41. package/dist/vendors/analytics/segment.js +16 -16
  42. package/dist/vendors/analytics/umami-analytics.js +16 -16
  43. package/dist/vendors/analytics/vercel-analytics.js +22 -22
  44. package/dist/vendors/functional/crisp.js +49 -51
  45. package/dist/vendors/functional/intercom.js +18 -18
  46. package/dist/vendors/tag-managers/google-tag-manager.js +20 -20
  47. package/dist-types/__tests__/helpers.d.ts +10 -10
  48. package/dist-types/engine/compile.d.ts +2 -2
  49. package/dist-types/engine/runtime.d.ts +3 -3
  50. package/dist-types/registry.d.ts +182 -173
  51. package/dist-types/resolve.d.ts +2 -2
  52. package/dist-types/types.d.ts +2 -2
  53. package/dist-types/vendors/_shared/attributes.d.ts +2 -2
  54. package/dist-types/vendors/_shared/google-consent.d.ts +2 -2
  55. package/dist-types/vendors/_shared/install-builders.d.ts +1 -1
  56. package/dist-types/vendors/_shared/script-url.d.ts +6 -6
  57. package/dist-types/vendors/ads-and-pixels/linkedin-insights.d.ts +14 -14
  58. package/dist-types/vendors/ads-and-pixels/meta-pixel.d.ts +27 -27
  59. package/dist-types/vendors/ads-and-pixels/microsoft-uet.d.ts +40 -40
  60. package/dist-types/vendors/ads-and-pixels/openai-pixel.d.ts +211 -0
  61. package/dist-types/vendors/ads-and-pixels/reddit-pixel.d.ts +28 -29
  62. package/dist-types/vendors/ads-and-pixels/snapchat-pixel.d.ts +23 -23
  63. package/dist-types/vendors/ads-and-pixels/tiktok-pixel.d.ts +22 -22
  64. package/dist-types/vendors/ads-and-pixels/x-pixel.d.ts +15 -15
  65. package/dist-types/vendors/analytics/adobe-analytics.d.ts +3 -3
  66. package/dist-types/vendors/analytics/ahrefs-analytics.d.ts +5 -5
  67. package/dist-types/vendors/analytics/amplitude.d.ts +24 -24
  68. package/dist-types/vendors/analytics/clearbit.d.ts +5 -5
  69. package/dist-types/vendors/analytics/cloudflare-web-analytics.d.ts +6 -6
  70. package/dist-types/vendors/analytics/databuddy.d.ts +34 -31
  71. package/dist-types/vendors/analytics/fathom-analytics.d.ts +8 -8
  72. package/dist-types/vendors/analytics/google-tag.d.ts +17 -17
  73. package/dist-types/vendors/analytics/heap.d.ts +17 -17
  74. package/dist-types/vendors/analytics/hightouch.d.ts +15 -15
  75. package/dist-types/vendors/analytics/hotjar.d.ts +9 -9
  76. package/dist-types/vendors/analytics/logrocket.d.ts +11 -11
  77. package/dist-types/vendors/analytics/matomo-analytics.d.ts +3 -3
  78. package/dist-types/vendors/analytics/microsoft-clarity.d.ts +12 -13
  79. package/dist-types/vendors/analytics/mixpanel-analytics.d.ts +20 -20
  80. package/dist-types/vendors/analytics/pirsch.d.ts +10 -10
  81. package/dist-types/vendors/analytics/plausible-analytics.d.ts +13 -13
  82. package/dist-types/vendors/analytics/posthog.d.ts +35 -32
  83. package/dist-types/vendors/analytics/promptwatch.d.ts +5 -5
  84. package/dist-types/vendors/analytics/rudderstack.d.ts +16 -16
  85. package/dist-types/vendors/analytics/rybbit-analytics.d.ts +15 -15
  86. package/dist-types/vendors/analytics/segment.d.ts +11 -11
  87. package/dist-types/vendors/analytics/umami-analytics.d.ts +9 -9
  88. package/dist-types/vendors/analytics/vercel-analytics.d.ts +13 -13
  89. package/dist-types/vendors/functional/crisp.d.ts +9 -9
  90. package/dist-types/vendors/functional/intercom.d.ts +12 -12
  91. package/dist-types/vendors/tag-managers/google-tag-manager.d.ts +16 -16
  92. package/docs/README.md +74 -48
  93. package/docs/assets/v3/brand-bar.png +0 -0
  94. package/docs/assets/v3/brand-card.png +0 -0
  95. package/docs/assets/v3/choice-wall.png +0 -0
  96. package/docs/assets/v3/mobile-card.png +0 -0
  97. package/docs/assets/v3/preferences.png +0 -0
  98. package/docs/customization/overview.md +45 -0
  99. package/docs/customization/recipes.md +79 -0
  100. package/docs/customization/slots.md +55 -0
  101. package/docs/customization/tokens.md +76 -0
  102. package/docs/customization/translations.md +49 -0
  103. package/docs/frameworks/javascript/script-loader.md +30 -339
  104. package/docs/frameworks/next/script-loader.md +134 -467
  105. package/docs/frameworks/react/script-loader.md +35 -535
  106. package/docs/guides/consent-state.md +60 -0
  107. package/docs/guides/data-fetching.md +163 -0
  108. package/docs/guides/deployment-modes.md +63 -0
  109. package/docs/guides/troubleshooting.md +68 -0
  110. package/docs/guides/verify-consent.md +62 -0
  111. package/docs/integrations/adobe-analytics.md +239 -105
  112. package/docs/integrations/ahrefs-analytics.md +238 -104
  113. package/docs/integrations/amplitude.md +219 -157
  114. package/docs/integrations/building-integrations.md +32 -224
  115. package/docs/integrations/clearbit.md +247 -86
  116. package/docs/integrations/cloudflare-web-analytics.md +250 -84
  117. package/docs/integrations/crisp.md +251 -97
  118. package/docs/integrations/databuddy.md +259 -153
  119. package/docs/integrations/fathom-analytics.md +239 -96
  120. package/docs/integrations/google-maps.md +328 -207
  121. package/docs/integrations/google-tag-manager.md +248 -96
  122. package/docs/integrations/google-tag.md +261 -90
  123. package/docs/integrations/heap.md +222 -149
  124. package/docs/integrations/hightouch.md +225 -131
  125. package/docs/integrations/hotjar.md +239 -90
  126. package/docs/integrations/intercom.md +239 -98
  127. package/docs/integrations/linkedin-insights.md +243 -113
  128. package/docs/integrations/logrocket.md +241 -123
  129. package/docs/integrations/matomo-analytics.md +256 -111
  130. package/docs/integrations/meta-pixel.md +197 -324
  131. package/docs/integrations/microsoft-clarity.md +233 -114
  132. package/docs/integrations/microsoft-uet.md +245 -110
  133. package/docs/integrations/mixpanel-analytics.md +252 -87
  134. package/docs/integrations/openai-pixel.md +441 -0
  135. package/docs/integrations/overview.md +95 -133
  136. package/docs/integrations/pirsch.md +249 -96
  137. package/docs/integrations/plausible-analytics.md +241 -100
  138. package/docs/integrations/posthog.md +353 -214
  139. package/docs/integrations/promptwatch.md +251 -81
  140. package/docs/integrations/reddit-pixel.md +226 -173
  141. package/docs/integrations/rudderstack.md +244 -187
  142. package/docs/integrations/rybbit-analytics.md +244 -91
  143. package/docs/integrations/segment.md +238 -92
  144. package/docs/integrations/snapchat-pixel.md +240 -110
  145. package/docs/integrations/tiktok-pixel.md +249 -81
  146. package/docs/integrations/umami-analytics.md +242 -95
  147. package/docs/integrations/vercel-analytics.md +242 -90
  148. package/docs/integrations/x-pixel.md +238 -104
  149. package/docs/integrations/youtube.md +354 -142
  150. package/docs/upgrade-v3.md +334 -0
  151. package/package.json +85 -78
  152. package/readme.json +2 -2
  153. package/dist/e2e-test-utils.cjs +0 -166
  154. package/dist/engine/compile.cjs +0 -130
  155. package/dist/engine/runtime.cjs +0 -475
  156. package/dist/registry.cjs +0 -423
  157. package/dist/resolve.cjs +0 -71
  158. package/dist/types.cjs +0 -69
  159. package/dist/vendors/_shared/attributes.cjs +0 -55
  160. package/dist/vendors/_shared/google-consent.cjs +0 -69
  161. package/dist/vendors/_shared/install-builders.cjs +0 -59
  162. package/dist/vendors/_shared/script-url.cjs +0 -78
  163. package/dist/vendors/ads-and-pixels/linkedin-insights.cjs +0 -89
  164. package/dist/vendors/ads-and-pixels/meta-pixel.cjs +0 -206
  165. package/dist/vendors/ads-and-pixels/microsoft-uet.cjs +0 -151
  166. package/dist/vendors/ads-and-pixels/reddit-pixel.cjs +0 -151
  167. package/dist/vendors/ads-and-pixels/snapchat-pixel.cjs +0 -131
  168. package/dist/vendors/ads-and-pixels/tiktok-pixel.cjs +0 -130
  169. package/dist/vendors/ads-and-pixels/x-pixel.cjs +0 -92
  170. package/dist/vendors/analytics/adobe-analytics.cjs +0 -90
  171. package/dist/vendors/analytics/ahrefs-analytics.cjs +0 -68
  172. package/dist/vendors/analytics/amplitude.cjs +0 -193
  173. package/dist/vendors/analytics/clearbit.cjs +0 -69
  174. package/dist/vendors/analytics/cloudflare-web-analytics.cjs +0 -73
  175. package/dist/vendors/analytics/databuddy.cjs +0 -144
  176. package/dist/vendors/analytics/fathom-analytics.cjs +0 -76
  177. package/dist/vendors/analytics/google-tag.cjs +0 -107
  178. package/dist/vendors/analytics/heap.cjs +0 -181
  179. package/dist/vendors/analytics/hightouch.cjs +0 -153
  180. package/dist/vendors/analytics/hotjar.cjs +0 -85
  181. package/dist/vendors/analytics/logrocket.cjs +0 -99
  182. package/dist/vendors/analytics/matomo-analytics.cjs +0 -232
  183. package/dist/vendors/analytics/microsoft-clarity.cjs +0 -138
  184. package/dist/vendors/analytics/mixpanel-analytics.cjs +0 -134
  185. package/dist/vendors/analytics/pirsch.cjs +0 -108
  186. package/dist/vendors/analytics/plausible-analytics.cjs +0 -122
  187. package/dist/vendors/analytics/posthog.cjs +0 -236
  188. package/dist/vendors/analytics/promptwatch.cjs +0 -70
  189. package/dist/vendors/analytics/rudderstack.cjs +0 -227
  190. package/dist/vendors/analytics/rybbit-analytics.cjs +0 -104
  191. package/dist/vendors/analytics/segment.cjs +0 -97
  192. package/dist/vendors/analytics/umami-analytics.cjs +0 -80
  193. package/dist/vendors/analytics/vercel-analytics.cjs +0 -94
  194. package/dist/vendors/functional/crisp.cjs +0 -143
  195. package/dist/vendors/functional/intercom.cjs +0 -89
  196. package/dist/vendors/tag-managers/google-tag-manager.cjs +0 -100
  197. package/docs/shared/react/guides/script-loader.md +0 -311
@@ -0,0 +1,163 @@
1
+ ---
2
+ title: Data fetching and transports
3
+ description: Choose cached manifests, backend init or offline policy resolution,
4
+ and understand where consent records are saved.
5
+ group: guides
6
+ ---
7
+
8
+ ## Start with Inth and a cached manifest
9
+
10
+ Use Inth for managed policy and consent records. For a Next.js application with
11
+ a server, use a cached manifest to resolve policy in your application. Route
12
+ browser consent traffic directly to Inth, or optionally use a Next.js rewrite
13
+ to keep those requests on your app's origin. Follow the
14
+ [Next.js manifest setup](https://c15t.com/docs/frameworks/next/data-fetching).
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.
21
+
22
+ | Fetching path | Where policy resolves | Where choices are submitted | Choose it when |
23
+ | ------------------------------ | ------------------------------------------------------------------------------------- | --------------------------- | ------------------------------------------------------------------------------------------------------ |
24
+ | Cached manifest on your server | Your application resolves public policy data with each request's location and signals | Inth or your c15t backend | Your host has a runtime server and you want to reuse policy data across requests |
25
+ | Regular backend `/init` | The consent backend | The same backend | You want the fewest moving parts, need backend-owned request resolution, or have no application server |
26
+ | Manifest in the browser | The browser, using supplied or unknown location | Inth or your c15t backend | You deliberately want client resolution and have planned geography, bundle size and policy refresh |
27
+ | Offline | The browser or local runtime, using bundled rules | No backend submission | Local development and tests. Not recommended for production environments. |
28
+ | Custom transport | Your implementation | Your implementation | An existing service cannot use the c15t backend protocol |
29
+
30
+ ## What is a consent manifest?
31
+
32
+ A manifest is a versioned policy document served by `GET /manifest`. It contains
33
+ policy rules, translation configuration and related consent configuration. It
34
+ is public configuration, not a visitor's saved choices. A resolver combines the
35
+ manifest with country, region, language and privacy signals to produce an init
36
+ result for one visitor.
37
+
38
+ Reusing the public document avoids asking the consent backend to resolve policy
39
+ for every application request. Cache misses and revalidation still fetch the
40
+ manifest, and consent writes still need the backend. Measure the deployed
41
+ request path before promising a latency improvement.
42
+
43
+ Do not put secrets, visitor identifiers or consent records into a manifest.
44
+ Keep personalized init responses out of shared caches. Changing a policy also
45
+ requires a refresh strategy for cached or build-time manifests.
46
+
47
+ ## What does regular `/init` do?
48
+
49
+ `hosted({ url })` uses `${url}/init` for initialization and `${url}/subjects` for
50
+ consent submissions. The name `hosted` describes the transport protocol; the URL
51
+ can belong to Inth or your own c15t backend.
52
+
53
+ ```ts title="src/consent-mode.ts"
54
+ import { hosted } from 'c15t';
55
+
56
+ export function createConsentMode(backendURL: string) {
57
+ return hosted({ url: backendURL });
58
+ }
59
+ ```
60
+
61
+ Pass the factory to your adapter's `mode` option. For request rendering, use the
62
+ adapter's server helper and forward its prepared result to the browser. For
63
+ static output, initialize in the browser with a reachable external URL.
64
+
65
+ A regular backend `/init` request lets the backend resolve the visitor context.
66
+ A same-origin URL named `/api/c15t/init` can instead resolve from a cached
67
+ manifest in your application. The URL name alone does not tell you which path
68
+ runs.
69
+
70
+ ## How do transports and proxies differ?
71
+
72
+ A transport implements initialization, saving and optional record operations.
73
+ A proxy changes where HTTP requests travel. It does not change the policy
74
+ resolver or make personalized responses safe to cache.
75
+
76
+ For a same-origin init route that resolves a manifest, the hosted transport can
77
+ separate policy reads and record writes. With a backend rewrite mounted at
78
+ `/api/c15t`, a client mode can use:
79
+
80
+ ```ts title="src/consent-mode.ts"
81
+ import { hosted } from 'c15t';
82
+
83
+ export const mode = hosted({
84
+ url: '/api/c15t',
85
+ initURL: '/api/c15t/init',
86
+ assertDecisionInputs: true,
87
+ });
88
+ ```
89
+
90
+ The route must return the c15t init response contract. `assertDecisionInputs`
91
+ binds saves to the resolved policy when init did not return a signed policy
92
+ snapshot token. The backend can then reject a stale policy decision. Next.js
93
+ sets this option for you when `ConsentRoot` receives a `config` with
94
+ `initURL`.
95
+
96
+ The init route resolves policy; the backend rewrite forwards `/api/c15t/subjects`
97
+ and other record endpoints. Configure both if you choose this optional proxy
98
+ variant. The
99
+ [Next.js rewrite recipe](https://c15t.com/docs/frameworks/next/optimization#keep-browser-consent-requests-on-your-origin)
100
+ shows the configuration. A direct absolute backend URL works
101
+ without a rewrite.
102
+
103
+ This optional optimization keeps c15t requests on the app's origin and avoids a separate browser DNS lookup
104
+ and TLS connection to the consent backend. The app server still connects to
105
+ the upstream backend for manifest refreshes and consent writes. Vendor scripts
106
+ and vendor requests keep their own origins.
107
+
108
+ Set the absolute upstream endpoint through `C15T_BACKEND_URL` in Next.js server
109
+ configuration. The endpoint URL is public connection information, not a secret.
110
+ The browser uses `/api/c15t` without needing the upstream URL. A static export
111
+ cannot serve a Next.js route or rewrite at runtime; use the absolute Inth URL or
112
+ a proxy provided by the static host instead.
113
+
114
+ ## When should I use offline mode?
115
+
116
+ Not recommended for production environments. Use Inth or a self-hosted backend
117
+ for production policy and consent records.
118
+
119
+ `offline()` resolves bundled policy rules without an init request and acknowledges
120
+ saves locally. The runtime's persistence module stores the choice in browser
121
+ storage. There is no backend audit history, cross-device record service or IP
122
+ geolocation supplied by this transport.
123
+
124
+ Use your adapter's offline factory so its translations and provider context are
125
+ included. This React and Next.js example replaces the hosted mode in an existing
126
+ client provider:
127
+
128
+ ```ts title="src/consent-mode.ts"
129
+ import { offline } from 'c15t/react';
130
+
131
+ export const mode = offline();
132
+ ```
133
+
134
+ With no `policyRules`, the current offline transport uses the recommended rule
135
+ pack. Supplying `policyRules` replaces that pack. Unknown country and region are
136
+ real resolution inputs; offline mode does not discover a visitor's location.
137
+ Use [policy rules](https://c15t.com/docs/frameworks/next/concepts/policy-presets) to understand
138
+ matching and defaults, and test the missing-location case.
139
+
140
+ Offline mode is an explicit architecture choice, not an automatic fallback for
141
+ a failed Inth request. If hosted initialization fails before a policy resolves,
142
+ optional permissions remain denied and the stock prompt stays hidden. Observe
143
+ initialization failures instead of silently changing policy sources.
144
+
145
+ ## Can I provide my own transport?
146
+
147
+ `custom(transport)` accepts a `KernelTransport` with the v3 `init` and `save`
148
+ contract. It does not accept v2 endpoint handlers such as `setConsent`. Keep
149
+ policy resolution, record acknowledgments and failure behavior consistent with
150
+ the kernel contract. Prefer a built-in transport when your backend supports it.
151
+
152
+ ## Verify the selected path
153
+
154
+ Inspect browser and server requests separately. A server manifest fetch will
155
+ not appear in the browser's Network panel. On a warm manifest path, check that
156
+ page requests do not call the backend `/init`, a visitor's choice still reaches
157
+ the backend's `/subjects`, and policy changes become visible after the configured
158
+ refresh. In the recommended Next.js setup, the browser should call only
159
+ `/api/c15t` paths for consent HTTP traffic; inspect server logs to verify their
160
+ upstream destinations.
161
+
162
+ Test different locations, missing location headers, GPC, returning choices and
163
+ backend failure. See [verification](./verify-consent.md).
@@ -0,0 +1,63 @@
1
+ ---
2
+ title: Choose a deployment mode
3
+ description: Choose who runs your consent backend, then select manifest, init or
4
+ offline resolution for your deployment.
5
+ group: guides
6
+ ---
7
+
8
+ ## Use Inth for managed policy and records
9
+
10
+ Start with [Inth](https://inth.com) unless you need to operate the consent
11
+ service yourself or deliberately need only local browser records. Configure
12
+ policy rules and trusted origins in the project, then use its exact backend
13
+ endpoint in your framework setup.
14
+
15
+ | Backend ownership | Policy source | Record storage | Use when |
16
+ | ------------------------- | ------------------------------------------------------ | ---------------------------------------- | ------------------------------------------------------------------------- |
17
+ | Inth hosted service | Centrally managed policy through a manifest or `/init` | Browser records plus backend submissions | You want managed policy and consent records |
18
+ | Self-hosted c15t | Your backend's manifest or `/init` | Browser records plus your database | You need to operate the service and its infrastructure |
19
+ | Browser-only offline mode | Bundled `policyRules` | Browser persistence | Local development and tests. Not recommended for production environments. |
20
+
21
+ Hosted and self-hosted c15t use the same transport protocol. Switching who runs
22
+ the backend does not require switching from manifests to `/init`.
23
+
24
+ ## Choose data fetching separately
25
+
26
+ For Next.js deployments with a runtime server, use the
27
+ [manifest setup](https://c15t.com/docs/frameworks/next/data-fetching). It reuses public policy data
28
+ in your application while consent writes still go to Inth. Regular backend
29
+ `/init` is available when you want backend-owned request resolution or a simpler
30
+ browser setup. See [data fetching and transports](./data-fetching.md) for
31
+ the comparison, including custom transports and offline mode.
32
+
33
+ ## Match initialization to your application output
34
+
35
+ | Application output | Initial state | Required setup |
36
+ | ------------------ | ------------------------- | ----------------------------------------------------------- |
37
+ | Request SSR | Prepared for this visitor | Adapter request helper and matching client configuration |
38
+ | Static HTML or SPA | Resolved in the browser | Reachable external URLs or deliberately bundled local rules |
39
+
40
+ Request SSR can include the visitor's prompt in the initial HTML. Pass the
41
+ prepared records and policy resolution through to hydration. Do not convert
42
+ effective permissions into new stored choices.
43
+
44
+ Static HTML is shared across visitors. It cannot contain a choice resolved from
45
+ each visitor's cookies or geography at build time. A static site can still use
46
+ Inth through browser requests. A same-origin `/api/c15t` URL only works if a
47
+ service actually serves it; a Next.js static export does not run API routes.
48
+
49
+ A manifest contains reusable public policy data. A resolved init response and
50
+ personalized consent HTML belong to a request. Do not give them the same shared
51
+ cache treatment.
52
+
53
+ ## Handle initialization and storage failures
54
+
55
+ While no policy resolves, optional permissions stay denied and the stock
56
+ consent UI stays hidden. No banner can mean pending or failed initialization.
57
+ It does not mean permission to load analytics. Observe errors before changing
58
+ presentation, and do not silently switch to offline policy after a hosted
59
+ request fails.
60
+
61
+ Browser storage can also be unavailable. A working in-memory interaction does
62
+ not prove the choice survives reload. Use
63
+ [verification](./verify-consent.md) to test the actual deployment.
@@ -0,0 +1,68 @@
1
+ ---
2
+ title: Troubleshoot consent
3
+ description: Diagnose missing banners, early vendor requests, lost choices and
4
+ hydration differences.
5
+ group: guides
6
+ ---
7
+
8
+ ## Why is there no banner?
9
+
10
+ Inspect `resolution` and `promptRequirement` before changing styles. Pending or
11
+ failed initialization, no matching rule, a valid stored choice and a rule that
12
+ requires no prompt can all produce no banner for different reasons. A missing
13
+ stylesheet can also make rendered controls appear incorrectly.
14
+
15
+ Check the backend URL and Network response, then confirm the active policy for
16
+ the visitor's location. Do not solve missing UI by granting every category or
17
+ setting `enabled: false`: disabling the runtime permits optional loading.
18
+
19
+ ## Why does the UI disappear with a content blocker?
20
+
21
+ Check the browser Network panel for `ERR_BLOCKED_BY_CLIENT` or a failed dynamic
22
+ import. Older c15t builds used component filenames such as
23
+ `consent-dialog-*.js`, which some cookie-annoyance lists block. Update the c15t
24
+ packages and rebuild the app. Current component modules use neutral filenames;
25
+ public component imports stay the same. This also covers Vite development
26
+ requests used by TanStack Start and other Vite integrations.
27
+
28
+ Extensions can separately hide elements with cosmetic filters or block a
29
+ configured backend URL. Check the failed request or hidden element to distinguish
30
+ those cases from a missing component module.
31
+
32
+ ## Why does analytics run before a choice?
33
+
34
+ Check effective permission under the selected policy, then find every loader
35
+ for that vendor. Remove unconditional script tags, framework analytics plugins
36
+ and duplicate tag-manager entries. c15t's script registration only controls the
37
+ scripts registered with it.
38
+
39
+ Google helpers intentionally load with Consent Mode defaults. A Google request
40
+ is not by itself proof that its storage consent was granted. If your requirement
41
+ is no request at all, do not use an always-loaded helper unchanged.
42
+
43
+ ## Why does a choice disappear on reload?
44
+
45
+ Check whether persistence is disabled, browser storage is blocked, the origin
46
+ changed, or the receipt expired or no longer matches the current policy.
47
+ A development example with `persistence: false` deliberately resets on reload.
48
+ Do not "repair" persistence by saving permissions automatically on mount.
49
+
50
+ ## Why does hydration differ from server HTML?
51
+
52
+ Use the adapter's request helper and pass the returned configuration unchanged
53
+ to its boundary. Check that server and browser use the same backend and policy
54
+ inputs. A module-level mutable runtime on a server can share one visitor's state
55
+ with another request; create request-owned state instead.
56
+
57
+ ## Why does static hosting fail when development works?
58
+
59
+ A static host has no app server for init routes, proxies or server functions.
60
+ Use absolute external consent URLs or an explicitly local policy. Test the
61
+ production output with a static file server, not the framework dev server.
62
+
63
+ ## Why does customization do nothing?
64
+
65
+ Check the imported stylesheet, the correct token or slot, and which element
66
+ carries the state attribute. `data-variant` on a banner root is not a matching
67
+ attribute on its child card. Check cascade layers and the Tailwind version
68
+ before adding specificity. See [customization](../customization/overview.md).
@@ -0,0 +1,62 @@
1
+ ---
2
+ title: Verify consent before shipping
3
+ description: Test requests, policy resolution, persistence, navigation and
4
+ preference changes in a production build.
5
+ group: guides
6
+ ---
7
+
8
+ ## Establish the policy under test
9
+
10
+ Use a fresh browser profile and a known policy. For an opt-in choice policy,
11
+ optional requests should be absent before a choice. Opt-out and notice policies
12
+ have different defaults; inspect the resolved rule rather than expecting every
13
+ region to show the same banner. Keep test geography overrides out of production.
14
+
15
+ Inventory scripts in your HTML, application code, tag manager, plugins and
16
+ embeds. A c15t provider cannot make an independently loaded vendor wait for a
17
+ choice. Remove duplicate loaders before interpreting the result.
18
+
19
+ ## Run the visitor flow
20
+
21
+ | Action | Check |
22
+ | ------------------------------------------ | ---------------------------------------------------------------------------------------- |
23
+ | Load without a stored choice | Correct policy and prompt; category-gated vendors stay blocked when permission is denied |
24
+ | Reject optional categories | Prompt closes; denied vendors remain blocked |
25
+ | Reload | Valid rejection persists; no new choice event is emitted by hydration |
26
+ | Reopen preferences | Settings remain reachable after the banner closes |
27
+ | Save one category | Only that category gets a new confirmation time |
28
+ | Navigate without reloading | One runtime remains active; no duplicate vendor initialization |
29
+ | Revoke a grant | Future gated work stops and configured cleanup runs |
30
+ | Load with an expired or incompatible grant | It does not silently restore optional permissions |
31
+ | Block the consent backend | Failed resolution is observable; absence of a banner does not grant permission |
32
+ | Block browser storage | Interaction still works where supported; verify whether the choice survives reload |
33
+
34
+ Inspect Network before the page starts loading, with cache disabled for the test.
35
+ Filter by the vendor's script and collection domains. Hiding an iframe after it
36
+ loads is too late to prevent the initial request.
37
+
38
+ Google Consent Mode integrations intentionally load their scripts and send
39
+ consent signals. Test their default and update commands separately from a
40
+ zero-request gate. See [Google Tag Manager](../integrations/google-tag-manager.md)
41
+ and [Google Tag](../integrations/google-tag.md).
42
+
43
+ ## Test the production hosting shape
44
+
45
+ For static sites, serve the generated files. Confirm no request depends on an
46
+ API route or rewrite that only exists in development. For SSR, inspect the
47
+ initial HTML and check that hydration does not change a valid stored choice.
48
+ Test a direct visit as well as client navigation.
49
+
50
+ For a cross-origin backend, check allowed origins, protocol and reachable URLs.
51
+ A public backend URL is not an API secret. Keep credentials out of client props
52
+ and public environment variables.
53
+
54
+ ## Check the interface
55
+
56
+ Use a narrow viewport, long translated labels and keyboard-only navigation.
57
+ Check that blocking dialogs trap focus, return it to the trigger when closed,
58
+ and do not leave scrolling locked. Non-blocking notices should allow interaction
59
+ with the page. Test contrast and focus indicators after applying a theme.
60
+
61
+ Record the policy, framework, deployment and observed request behavior with the
62
+ test result. "The banner appears" is only one assertion.