c15t 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 (34) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/index.cjs +2 -2
  3. package/dist/index.js +2 -2
  4. package/dist-types/index.d.ts +1 -1
  5. package/dist-types/version.d.ts +1 -1
  6. package/docs/integrations/ahrefs-analytics.md +224 -0
  7. package/docs/integrations/cloudflare-web-analytics.md +194 -0
  8. package/docs/integrations/crisp.md +214 -0
  9. package/docs/integrations/databuddy.md +136 -65
  10. package/docs/integrations/fathom-analytics.md +221 -0
  11. package/docs/integrations/google-tag-manager.md +84 -15
  12. package/docs/integrations/google-tag.md +89 -8
  13. package/docs/integrations/hotjar.md +211 -0
  14. package/docs/integrations/intercom.md +214 -0
  15. package/docs/integrations/linkedin-insights.md +130 -11
  16. package/docs/integrations/matomo-analytics.md +246 -0
  17. package/docs/integrations/meta-pixel.md +377 -24
  18. package/docs/integrations/microsoft-clarity.md +241 -0
  19. package/docs/integrations/microsoft-uet.md +120 -9
  20. package/docs/integrations/mixpanel-analytics.md +198 -0
  21. package/docs/integrations/overview.md +69 -74
  22. package/docs/integrations/plausible-analytics.md +237 -0
  23. package/docs/integrations/posthog.md +172 -41
  24. package/docs/integrations/promptwatch.md +187 -0
  25. package/docs/integrations/reddit-pixel.md +336 -0
  26. package/docs/integrations/rybbit-analytics.md +222 -0
  27. package/docs/integrations/segment.md +213 -0
  28. package/docs/integrations/snapchat-pixel.md +244 -0
  29. package/docs/integrations/tiktok-pixel.md +88 -10
  30. package/docs/integrations/umami-analytics.md +220 -0
  31. package/docs/integrations/vercel-analytics.md +213 -0
  32. package/docs/integrations/x-pixel.md +99 -10
  33. package/docs/script-loader.md +168 -51
  34. package/package.json +3 -3
@@ -0,0 +1,336 @@
1
+ ---
2
+ title: Reddit Pixel
3
+ description: Track conversions and build retargeting audiences for Reddit advertising campaigns.
4
+ lastModified: 2026-05-11
5
+ icon: reddit
6
+ ---
7
+ Reddit Pixel is Reddit's conversion tracking tool for ads and remarketing. It seeds the standard `rdt` queue before the vendor bundle loads, initializes your pixel, and by default records a `PageVisit` event once consent for `marketing` is available.
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 { redditPixel } from '@c15t/scripts/reddit-pixel';
17
+
18
+ const scripts = [redditPixel({ pixelId: 't2_abcdef' })];
19
+
20
+ export function ConsentProvider({ children }: { children: ReactNode }) {
21
+ return (
22
+ <ConsentManagerProvider
23
+ options={{
24
+ mode: 'hosted',
25
+ backendURL: 'https://your-instance.c15t.dev',
26
+ scripts,
27
+ }}
28
+ >
29
+ {children}
30
+ </ConsentManagerProvider>
31
+ );
32
+ }
33
+ ```
34
+
35
+ **Next.js**
36
+
37
+ ```tsx
38
+ 'use client';
39
+
40
+ import { type ReactNode } from 'react';
41
+ import { ConsentManagerProvider } from '@c15t/nextjs';
42
+ import { redditPixel } from '@c15t/scripts/reddit-pixel';
43
+
44
+ const scripts = [redditPixel({ pixelId: 't2_abcdef' })];
45
+
46
+ export function ConsentProvider({ children }: { children: ReactNode }) {
47
+ return (
48
+ <ConsentManagerProvider
49
+ options={{
50
+ mode: 'hosted',
51
+ backendURL: '/api/c15t',
52
+ scripts,
53
+ }}
54
+ >
55
+ {children}
56
+ </ConsentManagerProvider>
57
+ );
58
+ }
59
+ ```
60
+
61
+ **JavaScript**
62
+
63
+ ```ts
64
+ import { getOrCreateConsentRuntime } from 'c15t';
65
+ import { redditPixel } from '@c15t/scripts/reddit-pixel';
66
+
67
+ getOrCreateConsentRuntime({
68
+ mode: 'hosted',
69
+ backendURL: 'https://your-instance.c15t.dev',
70
+ scripts: [redditPixel({ pixelId: 't2_abcdef' })],
71
+ });
72
+ ```
73
+
74
+ ## How c15t loads it
75
+
76
+ * **Category:** `marketing` (Ads & Pixels)
77
+ * **Loads when:** marketing consent is granted
78
+ * **On revocation:** retained in the DOM so c15t can call Reddit's
79
+ first-party-cookie controls. c15t calls `rdt('disableFirstPartyCookies')`
80
+ when marketing consent is denied and `rdt('enableFirstPartyCookies')` when
81
+ it is granted again.
82
+
83
+ If you prefer to control page-view tracking yourself, disable the default `PageVisit` call:
84
+
85
+ ```ts
86
+ redditPixel({
87
+ pixelId: 't2_abcdef',
88
+ trackPageVisit: false,
89
+ })
90
+ ```
91
+
92
+ ## Tracking events in your app
93
+
94
+ c15t gates the Reddit Pixel script from loading until `marketing` consent is granted. Your application code that calls Reddit's runtime API (`window.rdt(...)`) is **not** automatically gated - `window.rdt` does not exist until the script is loaded, so unguarded calls before consent throw.
95
+
96
+ Guard event calls by checking consent state. From React:
97
+
98
+ ```tsx
99
+ import { useCallback } from 'react';
100
+ import { useConsentManager } from '@c15t/react';
101
+ import { redditPixelEvent } from '@c15t/scripts/reddit-pixel';
102
+
103
+ function CheckoutExample() {
104
+ const { has } = useConsentManager();
105
+
106
+ const trackPurchase = useCallback(() => {
107
+ if (has('marketing')) {
108
+ redditPixelEvent('Purchase', {
109
+ currency: 'USD',
110
+ value: 99,
111
+ conversionId: 'order-123',
112
+ });
113
+ }
114
+ }, [has]);
115
+
116
+ // Call trackPurchase() from your conversion success path.
117
+ }
118
+ ```
119
+
120
+ From plain JavaScript:
121
+
122
+ ```ts
123
+ import { getOrCreateConsentRuntime } from 'c15t';
124
+
125
+ const { consentStore } = getOrCreateConsentRuntime();
126
+
127
+ if (consentStore.getState().has('marketing')) {
128
+ window.rdt?.('track', 'Purchase', {
129
+ currency: 'USD',
130
+ value: 99,
131
+ conversionId: 'order-123',
132
+ });
133
+ }
134
+ ```
135
+
136
+ When you use Reddit Pixel and Conversions API together, send the same
137
+ `conversionId` in the browser event and the server event so Reddit can
138
+ deduplicate them.
139
+
140
+ ## Consent and privacy
141
+
142
+ c15t keeps Reddit Pixel behind `marketing` consent. Before marketing consent,
143
+ the Reddit script is not loaded. After marketing consent is granted, c15t loads
144
+ the script and queues the Reddit `init` call.
145
+
146
+ For stricter first-party-cookie behavior, disable Reddit first-party cookies
147
+ during initialization:
148
+
149
+ ```ts
150
+ redditPixel({
151
+ pixelId: 't2_abcdef',
152
+ disableFirstPartyCookies: true,
153
+ })
154
+ ```
155
+
156
+ You can also pass Reddit's initialization options directly:
157
+
158
+ ```ts
159
+ redditPixel({
160
+ pixelId: 't2_abcdef',
161
+ initOptions: {
162
+ optOut: true,
163
+ disableFirstPartyCookies: true,
164
+ },
165
+ })
166
+ ```
167
+
168
+ Reddit supports a Limited Data Use flag through data processing fields. Use the
169
+ values required by your policy and jurisdiction:
170
+
171
+ ```ts
172
+ redditPixel({
173
+ pixelId: 't2_abcdef',
174
+ initOptions: {
175
+ dpm: ['LDU'],
176
+ dpcc: 'US',
177
+ dprc: 'CA',
178
+ },
179
+ })
180
+ ```
181
+
182
+ Reddit can also receive attribution matching signals such as `email`,
183
+ `phoneNumber`, `externalId`, `aaid`, and `idfa`. Only pass those fields after
184
+ you have the right consent or legal basis for your use case:
185
+
186
+ ```ts
187
+ redditPixel({
188
+ pixelId: 't2_abcdef',
189
+ initOptions: {
190
+ email: 'person@example.com',
191
+ externalId: 'customer-123',
192
+ aam: {
193
+ email: false,
194
+ phone_number: false,
195
+ },
196
+ },
197
+ })
198
+ ```
199
+
200
+ See Reddit's docs for [Limited Data Use](https://business.reddithelp.com/s/article/Limited-Data-Use),
201
+ [event metadata](https://business.reddithelp.com/s/article/about-event-metadata),
202
+ and [event deduplication](https://business.reddithelp.com/s/article/event-deduplication).
203
+
204
+ ## Types
205
+
206
+ ### RedditPixelOptions
207
+
208
+ |Property|Type|Description|Default|Required|
209
+ |:--|:--|:--|:--|:--:|
210
+ |pixelId|string|Your Reddit Pixel ID.|-|✅ Required|
211
+ |trackPageVisit|boolean \|undefined|Queue the standard \`PageVisit\` event during setup.|true|Optional|
212
+ |initOptions|RedditPixelInitOptions \|undefined|Optional payload passed as the third argument to \`rdt('init', ...)\`.|-|Optional|
213
+ |disableFirstPartyCookies|boolean \|undefined|Disable Reddit first-party cookies during setup. This is merged into \`initOptions.disableFirstPartyCookies\`.|-|Optional|
214
+ |scriptUrl|string \|undefined|Reddit Pixel loader URL.|-|Optional|
215
+
216
+ ### RedditPixelInitOptions
217
+
218
+ |Property|Type|Description|Default|Required|
219
+ |:--|:--|:--|:--|:--:|
220
+ |optOut|boolean \|undefined|Opt the user out of Reddit Pixel tracking. Reddit sends this as \`opt\_out=1\` on pixel requests.|-|Optional|
221
+ |disableFirstPartyCookies|boolean \|undefined|Disable Reddit first-party cookies during initialization.|-|Optional|
222
+ |email|string \|undefined|Email address or SHA-256 email hash for attribution matching.|-|Optional|
223
+ |phoneNumber|string \|undefined|Phone number or SHA-256 phone hash for attribution matching.|-|Optional|
224
+ |externalId|string \|undefined|External user identifier or SHA-256 hash for attribution matching.|-|Optional|
225
+ |aaid|string \|undefined|Android Advertising ID or SHA-256 hash.|-|Optional|
226
+ |idfa|string \|undefined|iOS Identifier for Advertisers or SHA-256 hash.|-|Optional|
227
+ |aam|RedditPixelAdvancedMatchingOptions \|undefined|Automatic advanced matching controls.|-|Optional|
228
+ |dpm|string \|string\[] \|undefined|Data processing mode, including Reddit Limited Data Use values. See \|Reddit Limited Data Use: https\://business.reddithelp.com/s/article/Limited-Data-Use|-|Optional|
229
+ |dpcc|string \|undefined|Data processing country code. See \|Reddit Limited Data Use: https\://business.reddithelp.com/s/article/Limited-Data-Use|-|Optional|
230
+ |dprc|string \|undefined|Data processing region code. See \|Reddit Limited Data Use: https\://business.reddithelp.com/s/article/Limited-Data-Use|-|Optional|
231
+ |partner|string \|undefined|Integration partner name.|-|Optional|
232
+ |partner\_version|string \|undefined|Integration partner version.|-|Optional|
233
+ |integration|"reddit" \|"gtm" \|(string & \{}) \|undefined|Source integration name reported to Reddit.|-|Optional|
234
+ |debug|boolean \|undefined|Enable Reddit Pixel debug logging.|-|Optional|
235
+ |useDecimalCurrencyValues|boolean \|undefined|Send monetary \`value\` metadata as \`valueDecimal\`.|true|Optional|
236
+
237
+ #### `aam` RedditPixelAdvancedMatchingOptions
238
+
239
+ Automatic advanced matching controls.
240
+
241
+ |Property|Type|Description|Default|Required|
242
+ |:--|:--|:--|:--|:--:|
243
+ |email|boolean \|undefined|Automatically scan page content for email addresses.|-|Optional|
244
+ |phone\_number|boolean \|undefined|Automatically scan page content for phone numbers.|-|Optional|
245
+
246
+ ### RedditPixelEventMetadata
247
+
248
+ |Property|Type|Description|Default|Required|
249
+ |:--|:--|:--|:--|:--:|
250
+ |itemCount|string \|number \|undefined|-|-|Optional|
251
+ |value|string \|number \|undefined|-|-|Optional|
252
+ |valueDecimal|string \|number \|undefined|-|-|Optional|
253
+ |currency|string \|undefined|-|-|Optional|
254
+ |transactionId|string \|undefined|-|-|Optional|
255
+ |customEventName|string \|undefined|-|-|Optional|
256
+ |products|Array\<Object> \|undefined|-|-|Optional|
257
+ |conversionId|string \|undefined|Conversion ID used to deduplicate Pixel events against Conversions API events. See \|Reddit event deduplication: https\://business.reddithelp.com/s/article/event-deduplication|-|Optional|
258
+
259
+ ### Script
260
+
261
+ |Property|Type|Description|Default|Required|
262
+ |:--|:--|:--|:--|:--:|
263
+ |id|string|Unique identifier for the script|-|✅ Required|
264
+ |src|string \|undefined|URL of the script to load|-|Optional|
265
+ |textContent|string \|undefined|Inline JavaScript code to execute|-|Optional|
266
+ |category|HasCondition\<AllConsentNames>|Consent category or condition required to load this script|-|✅ Required|
267
+ |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|
268
+ |persistAfterConsentRevoked|boolean \|undefined|Whether the script should persist after consent is revoked.|false|Optional|
269
+ |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|
270
+ |fetchPriority|"high" \|"low" \|"auto" \|undefined|Priority hint for browser resource loading|-|Optional|
271
+ |attributes|Record\<string, string> \|undefined|Additional attributes to add to the script element|-|Optional|
272
+ |async|boolean \|undefined|Whether to use async loading|-|Optional|
273
+ |defer|boolean \|undefined|Whether to defer script loading|-|Optional|
274
+ |nonce|string \|undefined|Content Security Policy nonce|-|Optional|
275
+ |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|
276
+ |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|
277
+ |onBeforeLoad|Object \|undefined|Callback executed before the script is loaded|-|Optional|
278
+ |onLoad|Object \|undefined|Callback executed when the script loads successfully|-|Optional|
279
+ |onError|Object \|undefined|Callback executed if the script fails to load|-|Optional|
280
+ |onConsentChange|Object \|undefined|Callback executed whenever the consent store is changed. This callback only applies to scripts already loaded.|-|Optional|
281
+ |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|
282
+ |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|
283
+ |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|
284
+ |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|
285
+
286
+ #### `onBeforeLoad`
287
+
288
+ Callback executed before the script is loaded
289
+
290
+ |Property|Type|Description|Default|Required|
291
+ |:--|:--|:--|:--|:--:|
292
+ |id|string|The original script ID|-|✅ Required|
293
+ |elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
294
+ |hasConsent|boolean|Has consent|-|✅ Required|
295
+ |consents|ConsentState|The current consent state|-|✅ Required|
296
+ |element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
297
+ |error|Error \|undefined|Error information (for error callbacks)|-|Optional|
298
+
299
+ #### `onLoad`
300
+
301
+ Callback executed when the script loads successfully
302
+
303
+ |Property|Type|Description|Default|Required|
304
+ |:--|:--|:--|:--|:--:|
305
+ |id|string|The original script ID|-|✅ Required|
306
+ |elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
307
+ |hasConsent|boolean|Has consent|-|✅ Required|
308
+ |consents|ConsentState|The current consent state|-|✅ Required|
309
+ |element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
310
+ |error|Error \|undefined|Error information (for error callbacks)|-|Optional|
311
+
312
+ #### `onError`
313
+
314
+ Callback executed if the script fails to load
315
+
316
+ |Property|Type|Description|Default|Required|
317
+ |:--|:--|:--|:--|:--:|
318
+ |id|string|The original script ID|-|✅ Required|
319
+ |elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
320
+ |hasConsent|boolean|Has consent|-|✅ Required|
321
+ |consents|ConsentState|The current consent state|-|✅ Required|
322
+ |element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
323
+ |error|Error \|undefined|Error information (for error callbacks)|-|Optional|
324
+
325
+ #### `onConsentChange`
326
+
327
+ Callback executed whenever the consent store is changed. This callback only applies to scripts already loaded.
328
+
329
+ |Property|Type|Description|Default|Required|
330
+ |:--|:--|:--|:--|:--:|
331
+ |id|string|The original script ID|-|✅ Required|
332
+ |elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
333
+ |hasConsent|boolean|Has consent|-|✅ Required|
334
+ |consents|ConsentState|The current consent state|-|✅ Required|
335
+ |element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
336
+ |error|Error \|undefined|Error information (for error callbacks)|-|Optional|
@@ -0,0 +1,222 @@
1
+ ---
2
+ title: Rybbit Analytics
3
+ description: Privacy-friendly analytics with script-tag configuration via Rybbit's data attributes.
4
+ lastModified: 2026-05-10
5
+ icon: rybbit-analytics
6
+ ---
7
+ Rybbit Analytics loads through `@c15t/scripts` and configures tracking behavior via `data-*` attributes on the script element.
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 { rybbitAnalytics } from '@c15t/scripts/rybbit-analytics';
17
+
18
+ const scripts = [rybbitAnalytics({ siteId: 'rybbit-123' })];
19
+
20
+ export function ConsentProvider({ children }: { children: ReactNode }) {
21
+ return (
22
+ <ConsentManagerProvider
23
+ options={{
24
+ mode: 'hosted',
25
+ backendURL: 'https://your-instance.c15t.dev',
26
+ scripts,
27
+ }}
28
+ >
29
+ {children}
30
+ </ConsentManagerProvider>
31
+ );
32
+ }
33
+ ```
34
+
35
+ **Next.js**
36
+
37
+ ```tsx
38
+ 'use client';
39
+
40
+ import { type ReactNode } from 'react';
41
+ import { ConsentManagerProvider } from '@c15t/nextjs';
42
+ import { rybbitAnalytics } from '@c15t/scripts/rybbit-analytics';
43
+
44
+ const scripts = [rybbitAnalytics({ siteId: 'rybbit-123' })];
45
+
46
+ export function ConsentProvider({ children }: { children: ReactNode }) {
47
+ return (
48
+ <ConsentManagerProvider
49
+ options={{
50
+ mode: 'hosted',
51
+ backendURL: '/api/c15t',
52
+ scripts,
53
+ }}
54
+ >
55
+ {children}
56
+ </ConsentManagerProvider>
57
+ );
58
+ }
59
+ ```
60
+
61
+ **JavaScript**
62
+
63
+ ```ts
64
+ import { getOrCreateConsentRuntime } from 'c15t';
65
+ import { rybbitAnalytics } from '@c15t/scripts/rybbit-analytics';
66
+
67
+ getOrCreateConsentRuntime({
68
+ mode: 'hosted',
69
+ backendURL: 'https://your-instance.c15t.dev',
70
+ scripts: [rybbitAnalytics({ siteId: 'rybbit-123' })],
71
+ });
72
+ ```
73
+
74
+ ## How c15t loads it
75
+
76
+ * **Category:** `measurement` (Analytics)
77
+ * **Loads when:** measurement consent is granted
78
+ * **On revocation:** unloaded - c15t removes the script from the DOM and stops network activity until consent is granted again.
79
+
80
+ To use a custom analytics host:
81
+
82
+ ```ts
83
+ rybbitAnalytics({
84
+ siteId: 'rybbit-123',
85
+ analyticsHost: 'https://analytics.example.com',
86
+ })
87
+ ```
88
+
89
+ ## Tracking events in your app
90
+
91
+ c15t gates the Rybbit script from loading until `measurement` consent is granted. Your application code that calls Rybbit's runtime API (`window.rybbit`) is **not** automatically gated - `window.rybbit` does not exist until the script is loaded, so unguarded calls before consent throw.
92
+
93
+ Guard event calls by checking consent state. From React:
94
+
95
+ ```tsx
96
+ import { useCallback } from 'react';
97
+ import { useConsentManager } from '@c15t/react';
98
+
99
+ export default function SignupExample() {
100
+ const { has } = useConsentManager();
101
+
102
+ const trackSignup = useCallback(() => {
103
+ if (has('measurement')) {
104
+ window.rybbit?.event('signup');
105
+ }
106
+ }, [has]);
107
+
108
+ return <button onClick={trackSignup}>Sign up</button>;
109
+ }
110
+ ```
111
+
112
+ From plain JavaScript:
113
+
114
+ ```ts
115
+ import { getOrCreateConsentRuntime } from 'c15t';
116
+
117
+ const { consentStore } = getOrCreateConsentRuntime();
118
+
119
+ if (consentStore.getState().has('measurement')) {
120
+ window.rybbit?.event('signup');
121
+ }
122
+ ```
123
+
124
+ ## Types
125
+
126
+ ### RybbitAnalyticsOptions
127
+
128
+ |Property|Type|Description|Default|Required|
129
+ |:--|:--|:--|:--|:--:|
130
+ |siteId|string \|number|Your Rybbit site ID.|-|✅ Required|
131
+ |autoTrackPageview|boolean \|undefined|Automatically track pageviews.|-|Optional|
132
+ |trackSpa|boolean \|undefined|Enable SPA route tracking.|-|Optional|
133
+ |trackQuery|boolean \|undefined|Include query parameters in tracked URLs.|-|Optional|
134
+ |trackOutbound|boolean \|undefined|Track outbound link clicks.|-|Optional|
135
+ |trackErrors|boolean \|undefined|Track JavaScript errors.|-|Optional|
136
+ |sessionReplay|boolean \|undefined|Enable session replay.|-|Optional|
137
+ |webVitals|boolean \|undefined|Enable Web Vitals tracking.|-|Optional|
138
+ |skipPatterns|string\[] \|undefined|URL patterns to skip from tracking.|-|Optional|
139
+ |maskPatterns|string\[] \|undefined|URL patterns to mask in tracked data.|-|Optional|
140
+ |debounce|number \|undefined|Debounce interval for pageview tracking.|-|Optional|
141
+ |apiKey|string \|undefined|API key for authenticated tracking.|-|Optional|
142
+ |analyticsHost|string \|undefined|Override the analytics host URL.|-|Optional|
143
+ |scriptUrl|string \|undefined|Custom loader URL.|-|Optional|
144
+
145
+ ### Script
146
+
147
+ |Property|Type|Description|Default|Required|
148
+ |:--|:--|:--|:--|:--:|
149
+ |id|string|Unique identifier for the script|-|✅ Required|
150
+ |src|string \|undefined|URL of the script to load|-|Optional|
151
+ |textContent|string \|undefined|Inline JavaScript code to execute|-|Optional|
152
+ |category|HasCondition\<AllConsentNames>|Consent category or condition required to load this script|-|✅ Required|
153
+ |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|
154
+ |persistAfterConsentRevoked|boolean \|undefined|Whether the script should persist after consent is revoked.|false|Optional|
155
+ |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|
156
+ |fetchPriority|"high" \|"low" \|"auto" \|undefined|Priority hint for browser resource loading|-|Optional|
157
+ |attributes|Record\<string, string> \|undefined|Additional attributes to add to the script element|-|Optional|
158
+ |async|boolean \|undefined|Whether to use async loading|-|Optional|
159
+ |defer|boolean \|undefined|Whether to defer script loading|-|Optional|
160
+ |nonce|string \|undefined|Content Security Policy nonce|-|Optional|
161
+ |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|
162
+ |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|
163
+ |onBeforeLoad|Object \|undefined|Callback executed before the script is loaded|-|Optional|
164
+ |onLoad|Object \|undefined|Callback executed when the script loads successfully|-|Optional|
165
+ |onError|Object \|undefined|Callback executed if the script fails to load|-|Optional|
166
+ |onConsentChange|Object \|undefined|Callback executed whenever the consent store is changed. This callback only applies to scripts already loaded.|-|Optional|
167
+ |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|
168
+ |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|
169
+ |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|
170
+ |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|
171
+
172
+ #### `onBeforeLoad`
173
+
174
+ Callback executed before the script is loaded
175
+
176
+ |Property|Type|Description|Default|Required|
177
+ |:--|:--|:--|:--|:--:|
178
+ |id|string|The original script ID|-|✅ Required|
179
+ |elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
180
+ |hasConsent|boolean|Has consent|-|✅ Required|
181
+ |consents|ConsentState|The current consent state|-|✅ Required|
182
+ |element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
183
+ |error|Error \|undefined|Error information (for error callbacks)|-|Optional|
184
+
185
+ #### `onLoad`
186
+
187
+ Callback executed when the script loads successfully
188
+
189
+ |Property|Type|Description|Default|Required|
190
+ |:--|:--|:--|:--|:--:|
191
+ |id|string|The original script ID|-|✅ Required|
192
+ |elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
193
+ |hasConsent|boolean|Has consent|-|✅ Required|
194
+ |consents|ConsentState|The current consent state|-|✅ Required|
195
+ |element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
196
+ |error|Error \|undefined|Error information (for error callbacks)|-|Optional|
197
+
198
+ #### `onError`
199
+
200
+ Callback executed if the script fails to load
201
+
202
+ |Property|Type|Description|Default|Required|
203
+ |:--|:--|:--|:--|:--:|
204
+ |id|string|The original script ID|-|✅ Required|
205
+ |elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
206
+ |hasConsent|boolean|Has consent|-|✅ Required|
207
+ |consents|ConsentState|The current consent state|-|✅ Required|
208
+ |element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
209
+ |error|Error \|undefined|Error information (for error callbacks)|-|Optional|
210
+
211
+ #### `onConsentChange`
212
+
213
+ Callback executed whenever the consent store is changed. This callback only applies to scripts already loaded.
214
+
215
+ |Property|Type|Description|Default|Required|
216
+ |:--|:--|:--|:--|:--:|
217
+ |id|string|The original script ID|-|✅ Required|
218
+ |elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
219
+ |hasConsent|boolean|Has consent|-|✅ Required|
220
+ |consents|ConsentState|The current consent state|-|✅ Required|
221
+ |element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
222
+ |error|Error \|undefined|Error information (for error callbacks)|-|Optional|