@c15t/nextjs 2.0.4 → 2.1.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 (32) hide show
  1. package/dist/version.cjs +1 -1
  2. package/dist/version.js +1 -1
  3. package/dist-types/version.d.ts +1 -1
  4. package/docs/integrations/ahrefs-analytics.md +224 -0
  5. package/docs/integrations/cloudflare-web-analytics.md +194 -0
  6. package/docs/integrations/crisp.md +214 -0
  7. package/docs/integrations/databuddy.md +136 -65
  8. package/docs/integrations/fathom-analytics.md +221 -0
  9. package/docs/integrations/google-tag-manager.md +84 -15
  10. package/docs/integrations/google-tag.md +89 -8
  11. package/docs/integrations/hotjar.md +211 -0
  12. package/docs/integrations/intercom.md +214 -0
  13. package/docs/integrations/linkedin-insights.md +130 -11
  14. package/docs/integrations/matomo-analytics.md +246 -0
  15. package/docs/integrations/meta-pixel.md +377 -24
  16. package/docs/integrations/microsoft-clarity.md +241 -0
  17. package/docs/integrations/microsoft-uet.md +120 -9
  18. package/docs/integrations/mixpanel-analytics.md +198 -0
  19. package/docs/integrations/overview.md +69 -74
  20. package/docs/integrations/plausible-analytics.md +237 -0
  21. package/docs/integrations/posthog.md +172 -41
  22. package/docs/integrations/promptwatch.md +187 -0
  23. package/docs/integrations/reddit-pixel.md +336 -0
  24. package/docs/integrations/rybbit-analytics.md +222 -0
  25. package/docs/integrations/segment.md +213 -0
  26. package/docs/integrations/snapchat-pixel.md +244 -0
  27. package/docs/integrations/tiktok-pixel.md +88 -10
  28. package/docs/integrations/umami-analytics.md +220 -0
  29. package/docs/integrations/vercel-analytics.md +213 -0
  30. package/docs/integrations/x-pixel.md +99 -10
  31. package/docs/script-loader.md +261 -63
  32. package/package.json +4 -4
package/dist/version.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";const __rslib_import_meta_url__="u"<typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,_)=>{for(var r in _)__webpack_require__.o(_,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:_[r]})},__webpack_require__.o=(e,_)=>Object.prototype.hasOwnProperty.call(e,_),__webpack_require__.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{version:()=>version});const version="2.0.4";for(var __rspack_i in exports.version=__webpack_exports__.version,__webpack_exports__)-1===["version"].indexOf(__rspack_i)&&(exports[__rspack_i]=__webpack_exports__[__rspack_i]);Object.defineProperty(exports,"__esModule",{value:!0});
1
+ "use strict";const __rslib_import_meta_url__="u"<typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,_)=>{for(var r in _)__webpack_require__.o(_,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:_[r]})},__webpack_require__.o=(e,_)=>Object.prototype.hasOwnProperty.call(e,_),__webpack_require__.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{version:()=>version});const version="2.1.0";for(var __rspack_i in exports.version=__webpack_exports__.version,__webpack_exports__)-1===["version"].indexOf(__rspack_i)&&(exports[__rspack_i]=__webpack_exports__[__rspack_i]);Object.defineProperty(exports,"__esModule",{value:!0});
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- let e="2.0.4";export{e as version};
1
+ let e="2.1.0";export{e as version};
@@ -1 +1 @@
1
- export declare const version = "2.0.4";
1
+ export declare const version = "2.1.0";
@@ -0,0 +1,224 @@
1
+ ---
2
+ title: Ahrefs Analytics
3
+ description: Cookieless web analytics from Ahrefs with a prebuilt helper that wires the project key into a c15t-managed script.
4
+ lastModified: 2026-05-10
5
+ icon: ahrefs
6
+ ---
7
+ Ahrefs Web Analytics is a cookieless analytics product configured with a single project key. The `ahrefsAnalytics()` helper wires that key into the `data-key` attribute that Ahrefs' loader reads at startup.
8
+
9
+ ## Integrate with c15t
10
+
11
+ **React**
12
+
13
+ ```tsx
14
+ import { type ReactNode } from 'react';
15
+ import { ConsentManagerProvider } from '@c15t/react';
16
+ import { ahrefsAnalytics } from '@c15t/scripts/ahrefs-analytics';
17
+
18
+ const scripts = [
19
+ ahrefsAnalytics({
20
+ key: 'your-ahrefs-project-key',
21
+ }),
22
+ ];
23
+
24
+ export function ConsentProvider({ children }: { children: ReactNode }) {
25
+ return (
26
+ <ConsentManagerProvider
27
+ options={{
28
+ mode: 'hosted',
29
+ backendURL: 'https://your-instance.c15t.dev',
30
+ scripts,
31
+ }}
32
+ >
33
+ {children}
34
+ </ConsentManagerProvider>
35
+ );
36
+ }
37
+ ```
38
+
39
+ **Next.js**
40
+
41
+ ```tsx
42
+ 'use client';
43
+
44
+ import { type ReactNode } from 'react';
45
+ import { ConsentManagerProvider } from '@c15t/nextjs';
46
+ import { ahrefsAnalytics } from '@c15t/scripts/ahrefs-analytics';
47
+
48
+ const scripts = [
49
+ ahrefsAnalytics({
50
+ key: 'your-ahrefs-project-key',
51
+ }),
52
+ ];
53
+
54
+ export function ConsentProvider({ children }: { children: ReactNode }) {
55
+ return (
56
+ <ConsentManagerProvider
57
+ options={{
58
+ mode: 'hosted',
59
+ backendURL: '/api/c15t',
60
+ scripts,
61
+ }}
62
+ >
63
+ {children}
64
+ </ConsentManagerProvider>
65
+ );
66
+ }
67
+ ```
68
+
69
+ **JavaScript**
70
+
71
+ ```ts
72
+ import { getOrCreateConsentRuntime } from 'c15t';
73
+ import { ahrefsAnalytics } from '@c15t/scripts/ahrefs-analytics';
74
+
75
+ getOrCreateConsentRuntime({
76
+ mode: 'hosted',
77
+ backendURL: 'https://your-instance.c15t.dev',
78
+ scripts: [
79
+ ahrefsAnalytics({
80
+ key: 'your-ahrefs-project-key',
81
+ }),
82
+ ],
83
+ });
84
+ ```
85
+
86
+ ## How c15t loads it
87
+
88
+ * **Category:** `measurement` (Analytics)
89
+ * **Loads when:** measurement consent is granted
90
+ * **On revocation:** unloaded — c15t removes the script element from the DOM. Ahrefs Web Analytics is cookieless, so no client-side state needs clearing.
91
+
92
+ To run from a custom loader URL (for example a self-hosted proxy):
93
+
94
+ ```ts
95
+ ahrefsAnalytics({
96
+ key: 'your-ahrefs-project-key',
97
+ scriptUrl: 'https://analytics.example.com/analytics.js',
98
+ })
99
+ ```
100
+
101
+ Once loaded, Ahrefs exposes its runtime API on `window.AhrefsAnalytics`. The c15t helper only models the serializable script configuration — calls to `window.AhrefsAnalytics.sendEvent(...)` happen in your application code as needed.
102
+
103
+ ## Tracking events in your app
104
+
105
+ c15t gates the Ahrefs Analytics script from loading until `measurement` consent is granted. Your application code that calls Ahrefs' runtime API (`window.AhrefsAnalytics.sendEvent`) is **not** automatically gated — `window.AhrefsAnalytics` does not exist until the script is loaded, so unguarded calls before consent throw.
106
+
107
+ Guard event calls by checking consent state. From React:
108
+
109
+ ```tsx
110
+ import { useCallback } from 'react';
111
+ import { useConsentManager } from '@c15t/react';
112
+
113
+ function SignupExample() {
114
+ const { has } = useConsentManager();
115
+
116
+ const trackSignup = useCallback(() => {
117
+ if (has('measurement')) {
118
+ window.AhrefsAnalytics?.sendEvent('signup');
119
+ }
120
+ }, [has]);
121
+
122
+ // Call trackSignup() from an event handler after signup succeeds.
123
+ }
124
+ ```
125
+
126
+ From plain JavaScript:
127
+
128
+ ```ts
129
+ import { getOrCreateConsentRuntime } from 'c15t';
130
+
131
+ const { consentStore } = getOrCreateConsentRuntime();
132
+
133
+ if (consentStore.getState().has('measurement')) {
134
+ window.AhrefsAnalytics?.sendEvent('signup');
135
+ }
136
+ ```
137
+
138
+ ## Types
139
+
140
+ ### AhrefsAnalyticsOptions
141
+
142
+ |Property|Type|Description|Default|Required|
143
+ |:--|:--|:--|:--|:--:|
144
+ |key|string|Your Ahrefs Web Analytics project key.|-|✅ Required|
145
+ |scriptUrl|string \|undefined|Custom loader URL.|'https\://analytics.ahrefs.com/analytics.js'|Optional|
146
+
147
+ ### Script
148
+
149
+ |Property|Type|Description|Default|Required|
150
+ |:--|:--|:--|:--|:--:|
151
+ |id|string|Unique identifier for the script|-|✅ Required|
152
+ |src|string \|undefined|URL of the script to load|-|Optional|
153
+ |textContent|string \|undefined|Inline JavaScript code to execute|-|Optional|
154
+ |category|HasCondition\<AllConsentNames>|Consent category or condition required to load this script|-|✅ Required|
155
+ |callbackOnly|boolean \|undefined|Whether this is a callback-only script that doesn't need to load an external resource. When true, no script tag will be added to the DOM, only callbacks will be executed.|false|Optional|
156
+ |persistAfterConsentRevoked|boolean \|undefined|Whether the script should persist after consent is revoked.|false|Optional|
157
+ |alwaysLoad|boolean \|undefined|Whether the script should always load regardless of consent state. This is useful for scripts like Google Tag Manager or PostHog that manage their own consent state internally. The script will load immediately and never be unloaded based on consent changes. Note: When using this option, you are responsible for ensuring the script itself respects user consent preferences through its own consent management.|false|Optional|
158
+ |fetchPriority|"high" \|"low" \|"auto" \|undefined|Priority hint for browser resource loading|-|Optional|
159
+ |attributes|Record\<string, string> \|undefined|Additional attributes to add to the script element|-|Optional|
160
+ |async|boolean \|undefined|Whether to use async loading|-|Optional|
161
+ |defer|boolean \|undefined|Whether to defer script loading|-|Optional|
162
+ |nonce|string \|undefined|Content Security Policy nonce|-|Optional|
163
+ |anonymizeId|boolean \|undefined|Whether to use an anonymized ID for the script element, this helps ensure the script is not blocked by ad blockers|true|Optional|
164
+ |target|"head" \|"body" \|undefined|Where to inject the script element in the DOM. Options: \`'head'\`: Scripts are appended to \`\<head>\` (default); \`'body'\`: Scripts are appended to \`\<body>\`|'head'|Optional|
165
+ |onBeforeLoad|Object \|undefined|Callback executed before the script is loaded|-|Optional|
166
+ |onLoad|Object \|undefined|Callback executed when the script loads successfully|-|Optional|
167
+ |onError|Object \|undefined|Callback executed if the script fails to load|-|Optional|
168
+ |onConsentChange|Object \|undefined|Callback executed whenever the consent store is changed. This callback only applies to scripts already loaded.|-|Optional|
169
+ |vendorId|string \|number \|undefined|IAB TCF vendor ID - links script to a registered vendor. When in IAB mode, the script will only load if this vendor has consent. Takes precedence over \`category\` when in IAB mode. Use custom vendor IDs (string or number) to gate non-IAB vendors too.|-|Optional|
170
+ |iabPurposes|number\[] \|undefined|IAB TCF purpose IDs this script requires consent for. When in IAB mode and no vendorId is set, the script will only load if ALL specified purposes have consent.|-|Optional|
171
+ |iabLegIntPurposes|number\[] \|undefined|IAB TCF legitimate interest purpose IDs. These purposes can operate under legitimate interest instead of consent. The script loads if all iabPurposes have consent OR all iabLegIntPurposes have legitimate interest established.|-|Optional|
172
+ |iabSpecialFeatures|number\[] \|undefined|IAB TCF special feature IDs this script requires. Options: 1: Use precise geolocation data; 2: Actively scan device characteristics for identification|-|Optional|
173
+
174
+ #### `onBeforeLoad`
175
+
176
+ Callback executed before the script is loaded
177
+
178
+ |Property|Type|Description|Default|Required|
179
+ |:--|:--|:--|:--|:--:|
180
+ |id|string|The original script ID|-|✅ Required|
181
+ |elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
182
+ |hasConsent|boolean|Has consent|-|✅ Required|
183
+ |consents|ConsentState|The current consent state|-|✅ Required|
184
+ |element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
185
+ |error|Error \|undefined|Error information (for error callbacks)|-|Optional|
186
+
187
+ #### `onLoad`
188
+
189
+ Callback executed when the script loads successfully
190
+
191
+ |Property|Type|Description|Default|Required|
192
+ |:--|:--|:--|:--|:--:|
193
+ |id|string|The original script ID|-|✅ Required|
194
+ |elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
195
+ |hasConsent|boolean|Has consent|-|✅ Required|
196
+ |consents|ConsentState|The current consent state|-|✅ Required|
197
+ |element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
198
+ |error|Error \|undefined|Error information (for error callbacks)|-|Optional|
199
+
200
+ #### `onError`
201
+
202
+ Callback executed if the script fails to load
203
+
204
+ |Property|Type|Description|Default|Required|
205
+ |:--|:--|:--|:--|:--:|
206
+ |id|string|The original script ID|-|✅ Required|
207
+ |elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
208
+ |hasConsent|boolean|Has consent|-|✅ Required|
209
+ |consents|ConsentState|The current consent state|-|✅ Required|
210
+ |element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
211
+ |error|Error \|undefined|Error information (for error callbacks)|-|Optional|
212
+
213
+ #### `onConsentChange`
214
+
215
+ Callback executed whenever the consent store is changed. This callback only applies to scripts already loaded.
216
+
217
+ |Property|Type|Description|Default|Required|
218
+ |:--|:--|:--|:--|:--:|
219
+ |id|string|The original script ID|-|✅ Required|
220
+ |elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
221
+ |hasConsent|boolean|Has consent|-|✅ Required|
222
+ |consents|ConsentState|The current consent state|-|✅ Required|
223
+ |element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
224
+ |error|Error \|undefined|Error information (for error callbacks)|-|Optional|
@@ -0,0 +1,194 @@
1
+ ---
2
+ title: Cloudflare Web Analytics
3
+ description: Cookieless analytics from Cloudflare with a prebuilt helper that serializes the beacon config into the `data-cf-beacon` attribute.
4
+ lastModified: 2026-05-10
5
+ icon: cloudflare-web-analytics
6
+ ---
7
+ Cloudflare Web Analytics is a cookieless analytics product configured through a single `data-cf-beacon` attribute on its loader. The `cloudflareWebAnalytics()` helper serializes your token and single-page application (SPA) preference into that attribute and hands the result to c15t's script loader.
8
+
9
+ ## Integrate with c15t
10
+
11
+ **React**
12
+
13
+ ```tsx
14
+ import { type ReactNode } from 'react';
15
+ import { ConsentManagerProvider } from '@c15t/react';
16
+ import { cloudflareWebAnalytics } from '@c15t/scripts/cloudflare-web-analytics';
17
+
18
+ const scripts = [
19
+ cloudflareWebAnalytics({
20
+ token: 'your-cloudflare-token',
21
+ }),
22
+ ];
23
+
24
+ export function ConsentProvider({ children }: { children: ReactNode }) {
25
+ return (
26
+ <ConsentManagerProvider
27
+ options={{
28
+ mode: 'hosted',
29
+ backendURL: 'https://your-instance.c15t.dev',
30
+ scripts,
31
+ }}
32
+ >
33
+ {children}
34
+ </ConsentManagerProvider>
35
+ );
36
+ }
37
+ ```
38
+
39
+ **Next.js**
40
+
41
+ ```tsx
42
+ 'use client';
43
+
44
+ import { type ReactNode } from 'react';
45
+ import { ConsentManagerProvider } from '@c15t/nextjs';
46
+ import { cloudflareWebAnalytics } from '@c15t/scripts/cloudflare-web-analytics';
47
+
48
+ const scripts = [
49
+ cloudflareWebAnalytics({
50
+ token: 'your-cloudflare-token',
51
+ }),
52
+ ];
53
+
54
+ export function ConsentProvider({ children }: { children: ReactNode }) {
55
+ return (
56
+ <ConsentManagerProvider
57
+ options={{
58
+ mode: 'hosted',
59
+ backendURL: '/api/c15t',
60
+ scripts,
61
+ }}
62
+ >
63
+ {children}
64
+ </ConsentManagerProvider>
65
+ );
66
+ }
67
+ ```
68
+
69
+ **JavaScript**
70
+
71
+ ```ts
72
+ import { getOrCreateConsentRuntime } from 'c15t';
73
+ import { cloudflareWebAnalytics } from '@c15t/scripts/cloudflare-web-analytics';
74
+
75
+ getOrCreateConsentRuntime({
76
+ mode: 'hosted',
77
+ backendURL: 'https://your-instance.c15t.dev',
78
+ scripts: [
79
+ cloudflareWebAnalytics({
80
+ token: 'your-cloudflare-token',
81
+ }),
82
+ ],
83
+ });
84
+ ```
85
+
86
+ ## How c15t loads it
87
+
88
+ * **Category:** `measurement` (Analytics)
89
+ * **Loads when:** measurement consent is granted
90
+ * **On revocation:** unloaded — c15t removes the script element from the DOM. Cloudflare Web Analytics is cookieless, so no client-side state needs clearing.
91
+
92
+ SPA route tracking is enabled by default. Disable it for traditional multi-page apps:
93
+
94
+ ```ts
95
+ cloudflareWebAnalytics({
96
+ token: 'your-cloudflare-token',
97
+ spa: false,
98
+ })
99
+ ```
100
+
101
+ The helper JSON-encodes `{ token, spa }` into the `data-cf-beacon` attribute that Cloudflare's loader reads at startup, matching Cloudflare's recommended embed.
102
+
103
+ ## Tracking events in your app
104
+
105
+ Cloudflare Web Analytics has no app-facing event API — the beacon tracks pageviews automatically once the script is loaded. There are no event calls in your application code to guard, so c15t's consent gating fully controls when and whether tracking happens.
106
+
107
+ ## Types
108
+
109
+ ### CloudflareWebAnalyticsOptions
110
+
111
+ |Property|Type|Description|Default|Required|
112
+ |:--|:--|:--|:--|:--:|
113
+ |token|string|Your Cloudflare Web Analytics token.|-|✅ Required|
114
+ |spa|boolean \|undefined|Enable Cloudflare's SPA route tracking.|true|Optional|
115
+ |scriptUrl|string \|undefined|Custom loader URL.|'https\://static.cloudflareinsights.com/beacon.min.js'|Optional|
116
+
117
+ ### Script
118
+
119
+ |Property|Type|Description|Default|Required|
120
+ |:--|:--|:--|:--|:--:|
121
+ |id|string|Unique identifier for the script|-|✅ Required|
122
+ |src|string \|undefined|URL of the script to load|-|Optional|
123
+ |textContent|string \|undefined|Inline JavaScript code to execute|-|Optional|
124
+ |category|HasCondition\<AllConsentNames>|Consent category or condition required to load this script|-|✅ Required|
125
+ |callbackOnly|boolean \|undefined|Whether this is a callback-only script that doesn't need to load an external resource. When true, no script tag will be added to the DOM, only callbacks will be executed.|false|Optional|
126
+ |persistAfterConsentRevoked|boolean \|undefined|Whether the script should persist after consent is revoked.|false|Optional|
127
+ |alwaysLoad|boolean \|undefined|Whether the script should always load regardless of consent state. This is useful for scripts like Google Tag Manager or PostHog that manage their own consent state internally. The script will load immediately and never be unloaded based on consent changes. Note: When using this option, you are responsible for ensuring the script itself respects user consent preferences through its own consent management.|false|Optional|
128
+ |fetchPriority|"high" \|"low" \|"auto" \|undefined|Priority hint for browser resource loading|-|Optional|
129
+ |attributes|Record\<string, string> \|undefined|Additional attributes to add to the script element|-|Optional|
130
+ |async|boolean \|undefined|Whether to use async loading|-|Optional|
131
+ |defer|boolean \|undefined|Whether to defer script loading|-|Optional|
132
+ |nonce|string \|undefined|Content Security Policy nonce|-|Optional|
133
+ |anonymizeId|boolean \|undefined|Whether to use an anonymized ID for the script element, this helps ensure the script is not blocked by ad blockers|true|Optional|
134
+ |target|"head" \|"body" \|undefined|Where to inject the script element in the DOM. Options: \`'head'\`: Scripts are appended to \`\<head>\` (default); \`'body'\`: Scripts are appended to \`\<body>\`|'head'|Optional|
135
+ |onBeforeLoad|Object \|undefined|Callback executed before the script is loaded|-|Optional|
136
+ |onLoad|Object \|undefined|Callback executed when the script loads successfully|-|Optional|
137
+ |onError|Object \|undefined|Callback executed if the script fails to load|-|Optional|
138
+ |onConsentChange|Object \|undefined|Callback executed whenever the consent store is changed. This callback only applies to scripts already loaded.|-|Optional|
139
+ |vendorId|string \|number \|undefined|IAB TCF vendor ID - links script to a registered vendor. When in IAB mode, the script will only load if this vendor has consent. Takes precedence over \`category\` when in IAB mode. Use custom vendor IDs (string or number) to gate non-IAB vendors too.|-|Optional|
140
+ |iabPurposes|number\[] \|undefined|IAB TCF purpose IDs this script requires consent for. When in IAB mode and no vendorId is set, the script will only load if ALL specified purposes have consent.|-|Optional|
141
+ |iabLegIntPurposes|number\[] \|undefined|IAB TCF legitimate interest purpose IDs. These purposes can operate under legitimate interest instead of consent. The script loads if all iabPurposes have consent OR all iabLegIntPurposes have legitimate interest established.|-|Optional|
142
+ |iabSpecialFeatures|number\[] \|undefined|IAB TCF special feature IDs this script requires. Options: 1: Use precise geolocation data; 2: Actively scan device characteristics for identification|-|Optional|
143
+
144
+ #### `onBeforeLoad`
145
+
146
+ Callback executed before the script is loaded
147
+
148
+ |Property|Type|Description|Default|Required|
149
+ |:--|:--|:--|:--|:--:|
150
+ |id|string|The original script ID|-|✅ Required|
151
+ |elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
152
+ |hasConsent|boolean|Has consent|-|✅ Required|
153
+ |consents|ConsentState|The current consent state|-|✅ Required|
154
+ |element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
155
+ |error|Error \|undefined|Error information (for error callbacks)|-|Optional|
156
+
157
+ #### `onLoad`
158
+
159
+ Callback executed when the script loads successfully
160
+
161
+ |Property|Type|Description|Default|Required|
162
+ |:--|:--|:--|:--|:--:|
163
+ |id|string|The original script ID|-|✅ Required|
164
+ |elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
165
+ |hasConsent|boolean|Has consent|-|✅ Required|
166
+ |consents|ConsentState|The current consent state|-|✅ Required|
167
+ |element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
168
+ |error|Error \|undefined|Error information (for error callbacks)|-|Optional|
169
+
170
+ #### `onError`
171
+
172
+ Callback executed if the script fails to load
173
+
174
+ |Property|Type|Description|Default|Required|
175
+ |:--|:--|:--|:--|:--:|
176
+ |id|string|The original script ID|-|✅ Required|
177
+ |elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
178
+ |hasConsent|boolean|Has consent|-|✅ Required|
179
+ |consents|ConsentState|The current consent state|-|✅ Required|
180
+ |element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
181
+ |error|Error \|undefined|Error information (for error callbacks)|-|Optional|
182
+
183
+ #### `onConsentChange`
184
+
185
+ Callback executed whenever the consent store is changed. This callback only applies to scripts already loaded.
186
+
187
+ |Property|Type|Description|Default|Required|
188
+ |:--|:--|:--|:--|:--:|
189
+ |id|string|The original script ID|-|✅ Required|
190
+ |elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
191
+ |hasConsent|boolean|Has consent|-|✅ Required|
192
+ |consents|ConsentState|The current consent state|-|✅ Required|
193
+ |element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
194
+ |error|Error \|undefined|Error information (for error callbacks)|-|Optional|
@@ -0,0 +1,214 @@
1
+ ---
2
+ title: Crisp
3
+ description: Load Crisp live chat with website ID, runtime, cookie, and session options.
4
+ lastModified: 2026-05-11
5
+ icon: crisp
6
+ ---
7
+ Crisp adds the Crisp live chat widget and exposes the `$crisp` queue for
8
+ chatbox actions such as opening the chat, setting user details, and resetting
9
+ sessions.
10
+
11
+ ## Official Crisp documentation
12
+
13
+ * [Web Chat SDK](https://docs.crisp.chat/guides/chatbox-sdks/web-sdk/)
14
+ * [$crisp methods](https://docs.crisp.chat/guides/chatbox-sdks/web-sdk/dollar-crisp/)
15
+ * [Identity verification](https://docs.crisp.chat/guides/chatbox-sdks/web-sdk/identity-verification/)
16
+ * [Cookie policies](https://docs.crisp.chat/guides/chatbox-sdks/web-sdk/cookie-policies/)
17
+ * [Session continuity](https://docs.crisp.chat/guides/chatbox-sdks/web-sdk/session-continuity/)
18
+ * [Language customization](https://docs.crisp.chat/guides/chatbox-sdks/web-sdk/language-customization/)
19
+
20
+ ## Integrate with c15t
21
+
22
+ **React**
23
+
24
+ ```tsx
25
+ import { type ReactNode } from 'react';
26
+ import { ConsentManagerProvider } from '@c15t/react';
27
+ import { crisp } from '@c15t/scripts/crisp';
28
+
29
+ const scripts = [crisp({ websiteId: 'crisp-123' })];
30
+
31
+ export function ConsentProvider({ children }: { children: ReactNode }) {
32
+ return (
33
+ <ConsentManagerProvider
34
+ options={{
35
+ mode: 'hosted',
36
+ backendURL: 'https://your-instance.c15t.dev',
37
+ scripts,
38
+ }}
39
+ >
40
+ {children}
41
+ </ConsentManagerProvider>
42
+ );
43
+ }
44
+ ```
45
+
46
+ **Next.js**
47
+
48
+ ```tsx
49
+ 'use client';
50
+
51
+ import { type ReactNode } from 'react';
52
+ import { ConsentManagerProvider } from '@c15t/nextjs';
53
+ import { crisp } from '@c15t/scripts/crisp';
54
+
55
+ const scripts = [crisp({ websiteId: 'crisp-123' })];
56
+
57
+ export function ConsentProvider({ children }: { children: ReactNode }) {
58
+ return (
59
+ <ConsentManagerProvider
60
+ options={{
61
+ mode: 'hosted',
62
+ backendURL: '/api/c15t',
63
+ scripts,
64
+ }}
65
+ >
66
+ {children}
67
+ </ConsentManagerProvider>
68
+ );
69
+ }
70
+ ```
71
+
72
+ **JavaScript**
73
+
74
+ ```ts
75
+ import { getOrCreateConsentRuntime } from 'c15t';
76
+ import { crisp } from '@c15t/scripts/crisp';
77
+
78
+ getOrCreateConsentRuntime({
79
+ mode: 'hosted',
80
+ backendURL: 'https://your-instance.c15t.dev',
81
+ scripts: [crisp({ websiteId: 'crisp-123' })],
82
+ });
83
+ ```
84
+
85
+ ## How c15t loads it
86
+
87
+ * **Category:** `functionality` (Functional)
88
+ * **Loads when:** functionality consent is granted
89
+ * **Before load:** c15t seeds `window.$crisp`, `CRISP_WEBSITE_ID`, and any
90
+ optional Crisp runtime globals
91
+ * **On revocation:** c15t follows the default script loader behavior for
92
+ non-persistent scripts
93
+
94
+ ## Configure the integration
95
+
96
+ The helper seeds Crisp's documented globals before loading
97
+ `https://client.crisp.chat/l.js`.
98
+
99
+ ```ts
100
+ crisp({
101
+ websiteId: 'crisp-123',
102
+ locale: 'fr',
103
+ cookieDomain: 'app.example.com',
104
+ cookieExpiry: 3600,
105
+ tokenId: 'secure-user-token',
106
+ sessionMerge: true,
107
+ safeMode: true,
108
+ })
109
+ ```
110
+
111
+ `locale` and `sessionMerge` are written to `CRISP_RUNTIME_CONFIG`.
112
+ `cookieDomain` maps to `CRISP_COOKIE_DOMAIN`, `cookieExpiry` maps to
113
+ `CRISP_COOKIE_EXPIRE`, and `tokenId` maps to `CRISP_TOKEN_ID`. `safeMode`
114
+ queues `['safe', true]` on `window.$crisp` before the loader runs so Crisp
115
+ starts in safe mode.
116
+
117
+ For session continuity, generate `tokenId` on your backend with a secure random
118
+ value. Do not use emails, hashes of emails, timestamps, or incrementing IDs as
119
+ Crisp session tokens. If you verify user emails, generate the HMAC signature on
120
+ your backend and set it with Crisp's `$crisp` API after the helper loads.
121
+
122
+ ## Types
123
+
124
+ ### CrispOptions
125
+
126
+ |Property|Type|Description|Default|Required|
127
+ |:--|:--|:--|:--|:--:|
128
+ |websiteId|string|Your Crisp website ID.|-|✅ Required|
129
+ |locale|string \|undefined|Optional locale passed through \`window\.CRISP\_RUNTIME\_CONFIG\`.|-|Optional|
130
+ |cookieDomain|string \|undefined|Optional cookie domain override for Crisp.|-|Optional|
131
+ |cookieExpiry|number \|undefined|Optional cookie expiration in seconds.|-|Optional|
132
+ |tokenId|string \|undefined|Optional Crisp token ID for session continuity.|-|Optional|
133
+ |sessionMerge|boolean \|undefined|Whether to merge anonymous sessions into token-backed sessions.|-|Optional|
134
+ |safeMode|boolean \|undefined|Whether to enable \`$crisp\` safe mode before other queued calls.|-|Optional|
135
+ |scriptSrc|string \|undefined|Crisp loader URL.|-|Optional|
136
+
137
+ ### Script
138
+
139
+ |Property|Type|Description|Default|Required|
140
+ |:--|:--|:--|:--|:--:|
141
+ |id|string|Unique identifier for the script|-|✅ Required|
142
+ |src|string \|undefined|URL of the script to load|-|Optional|
143
+ |textContent|string \|undefined|Inline JavaScript code to execute|-|Optional|
144
+ |category|HasCondition\<AllConsentNames>|Consent category or condition required to load this script|-|✅ Required|
145
+ |callbackOnly|boolean \|undefined|Whether this is a callback-only script that doesn't need to load an external resource. When true, no script tag will be added to the DOM, only callbacks will be executed.|false|Optional|
146
+ |persistAfterConsentRevoked|boolean \|undefined|Whether the script should persist after consent is revoked.|false|Optional|
147
+ |alwaysLoad|boolean \|undefined|Whether the script should always load regardless of consent state. This is useful for scripts like Google Tag Manager or PostHog that manage their own consent state internally. The script will load immediately and never be unloaded based on consent changes. Note: When using this option, you are responsible for ensuring the script itself respects user consent preferences through its own consent management.|false|Optional|
148
+ |fetchPriority|"high" \|"low" \|"auto" \|undefined|Priority hint for browser resource loading|-|Optional|
149
+ |attributes|Record\<string, string> \|undefined|Additional attributes to add to the script element|-|Optional|
150
+ |async|boolean \|undefined|Whether to use async loading|-|Optional|
151
+ |defer|boolean \|undefined|Whether to defer script loading|-|Optional|
152
+ |nonce|string \|undefined|Content Security Policy nonce|-|Optional|
153
+ |anonymizeId|boolean \|undefined|Whether to use an anonymized ID for the script element, this helps ensure the script is not blocked by ad blockers|true|Optional|
154
+ |target|"head" \|"body" \|undefined|Where to inject the script element in the DOM. Options: \`'head'\`: Scripts are appended to \`\<head>\` (default); \`'body'\`: Scripts are appended to \`\<body>\`|'head'|Optional|
155
+ |onBeforeLoad|Object \|undefined|Callback executed before the script is loaded|-|Optional|
156
+ |onLoad|Object \|undefined|Callback executed when the script loads successfully|-|Optional|
157
+ |onError|Object \|undefined|Callback executed if the script fails to load|-|Optional|
158
+ |onConsentChange|Object \|undefined|Callback executed whenever the consent store is changed. This callback only applies to scripts already loaded.|-|Optional|
159
+ |vendorId|string \|number \|undefined|IAB TCF vendor ID - links script to a registered vendor. When in IAB mode, the script will only load if this vendor has consent. Takes precedence over \`category\` when in IAB mode. Use custom vendor IDs (string or number) to gate non-IAB vendors too.|-|Optional|
160
+ |iabPurposes|number\[] \|undefined|IAB TCF purpose IDs this script requires consent for. When in IAB mode and no vendorId is set, the script will only load if ALL specified purposes have consent.|-|Optional|
161
+ |iabLegIntPurposes|number\[] \|undefined|IAB TCF legitimate interest purpose IDs. These purposes can operate under legitimate interest instead of consent. The script loads if all iabPurposes have consent OR all iabLegIntPurposes have legitimate interest established.|-|Optional|
162
+ |iabSpecialFeatures|number\[] \|undefined|IAB TCF special feature IDs this script requires. Options: 1: Use precise geolocation data; 2: Actively scan device characteristics for identification|-|Optional|
163
+
164
+ #### `onBeforeLoad`
165
+
166
+ Callback executed before the script is loaded
167
+
168
+ |Property|Type|Description|Default|Required|
169
+ |:--|:--|:--|:--|:--:|
170
+ |id|string|The original script ID|-|✅ Required|
171
+ |elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
172
+ |hasConsent|boolean|Has consent|-|✅ Required|
173
+ |consents|ConsentState|The current consent state|-|✅ Required|
174
+ |element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
175
+ |error|Error \|undefined|Error information (for error callbacks)|-|Optional|
176
+
177
+ #### `onLoad`
178
+
179
+ Callback executed when the script loads successfully
180
+
181
+ |Property|Type|Description|Default|Required|
182
+ |:--|:--|:--|:--|:--:|
183
+ |id|string|The original script ID|-|✅ Required|
184
+ |elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
185
+ |hasConsent|boolean|Has consent|-|✅ Required|
186
+ |consents|ConsentState|The current consent state|-|✅ Required|
187
+ |element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
188
+ |error|Error \|undefined|Error information (for error callbacks)|-|Optional|
189
+
190
+ #### `onError`
191
+
192
+ Callback executed if the script fails to load
193
+
194
+ |Property|Type|Description|Default|Required|
195
+ |:--|:--|:--|:--|:--:|
196
+ |id|string|The original script ID|-|✅ Required|
197
+ |elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
198
+ |hasConsent|boolean|Has consent|-|✅ Required|
199
+ |consents|ConsentState|The current consent state|-|✅ Required|
200
+ |element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
201
+ |error|Error \|undefined|Error information (for error callbacks)|-|Optional|
202
+
203
+ #### `onConsentChange`
204
+
205
+ Callback executed whenever the consent store is changed. This callback only applies to scripts already loaded.
206
+
207
+ |Property|Type|Description|Default|Required|
208
+ |:--|:--|:--|:--|:--:|
209
+ |id|string|The original script ID|-|✅ Required|
210
+ |elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
211
+ |hasConsent|boolean|Has consent|-|✅ Required|
212
+ |consents|ConsentState|The current consent state|-|✅ Required|
213
+ |element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
214
+ |error|Error \|undefined|Error information (for error callbacks)|-|Optional|