@c15t/nextjs 2.0.0-rc.0 → 2.0.0-rc.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -3
- package/client/components/consent-dialog-link.js +3 -0
- package/dist/headless.cjs +1 -1
- package/dist/iab/styles.css +12 -0
- package/dist/iab/styles.tw3.css +14 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/libs/browser-initial-data.cjs +1 -0
- package/dist/libs/browser-initial-data.js +1 -0
- package/dist/libs/initial-data.cjs +1 -1
- package/dist/libs/initial-data.js +1 -1
- package/dist/styles.css +10 -0
- package/dist/styles.tw3.css +13 -0
- package/dist/types.cjs +1 -1
- package/dist/version.cjs +1 -1
- package/dist/version.js +1 -1
- package/{dist → dist-types}/headless.d.ts +0 -1
- package/{dist → dist-types}/index.d.ts +3 -2
- package/dist-types/libs/browser-initial-data.d.ts +9 -0
- package/{dist → dist-types}/libs/initial-data.d.ts +7 -2
- package/dist-types/types.d.ts +38 -0
- package/dist-types/version.d.ts +1 -0
- package/docs/README.md +73 -0
- package/docs/building-headless-components.md +377 -0
- package/docs/callbacks.md +184 -0
- package/docs/components/consent-banner.md +269 -0
- package/docs/components/consent-dialog-link.md +59 -0
- package/docs/components/consent-dialog-trigger.md +103 -0
- package/docs/components/consent-dialog.md +177 -0
- package/docs/components/consent-manager-provider.md +425 -0
- package/docs/components/consent-widget.md +133 -0
- package/docs/components/dev-tools.md +63 -0
- package/docs/components/frame.md +73 -0
- package/docs/concepts/client-modes.md +175 -0
- package/docs/concepts/consent-categories.md +97 -0
- package/docs/concepts/consent-models.md +116 -0
- package/docs/concepts/cookie-management.md +122 -0
- package/docs/concepts/glossary.md +23 -0
- package/docs/concepts/initialization-flow.md +148 -0
- package/docs/concepts/policy-packs.md +229 -0
- package/docs/headless.md +190 -0
- package/docs/hooks/use-color-scheme.md +40 -0
- package/docs/hooks/use-consent-manager/checking-consent.md +94 -0
- package/docs/hooks/use-consent-manager/location-info.md +95 -0
- package/docs/hooks/use-consent-manager/overview.md +420 -0
- package/docs/hooks/use-consent-manager/setting-consent.md +92 -0
- package/docs/hooks/use-draggable.md +57 -0
- package/docs/hooks/use-focus-trap.md +41 -0
- package/docs/hooks/use-reduced-motion.md +35 -0
- package/docs/hooks/use-ssr-status.md +31 -0
- package/docs/hooks/use-text-direction.md +49 -0
- package/docs/hooks/use-translations.md +118 -0
- package/docs/iab/consent-banner.md +94 -0
- package/docs/iab/consent-dialog.md +134 -0
- package/docs/iab/overview.md +126 -0
- package/docs/iab/use-gvl-data.md +20 -0
- package/docs/iframe-blocking.md +107 -0
- package/docs/integrations/building-integrations.md +405 -0
- package/docs/integrations/databuddy.md +203 -0
- package/docs/integrations/google-tag-manager.md +153 -0
- package/docs/integrations/google-tag.md +122 -0
- package/docs/integrations/linkedin-insights.md +109 -0
- package/docs/integrations/meta-pixel.md +342 -0
- package/docs/integrations/microsoft-uet.md +112 -0
- package/docs/integrations/overview.md +105 -0
- package/docs/integrations/posthog.md +199 -0
- package/docs/integrations/tiktok-pixel.md +113 -0
- package/docs/integrations/x-pixel.md +143 -0
- package/docs/internationalization.md +197 -0
- package/docs/network-blocker.md +178 -0
- package/docs/optimization.md +234 -0
- package/docs/policy-packs.md +246 -0
- package/docs/quickstart.md +161 -0
- package/docs/script-loader.md +321 -0
- package/docs/server-side.md +176 -0
- package/docs/styling/classnames.md +92 -0
- package/docs/styling/color-scheme.md +82 -0
- package/docs/styling/css-variables.md +92 -0
- package/docs/styling/overview.md +456 -0
- package/docs/styling/slots.md +127 -0
- package/docs/styling/tailwind.md +113 -0
- package/docs/styling/tokens.md +216 -0
- package/docs/troubleshooting.md +146 -0
- package/iab/styles.css +1 -0
- package/package.json +38 -17
- package/readme.json +4 -0
- package/src/iab/styles.css +12 -0
- package/src/iab/styles.tw3.css +14 -0
- package/src/styles.css +10 -0
- package/src/styles.tw3.css +13 -0
- package/styles.css +1 -0
- package/dist/headless.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/libs/initial-data.d.ts.map +0 -1
- package/dist/types.d.ts +0 -16
- package/dist/types.d.ts.map +0 -1
- package/dist/version.d.ts +0 -2
- package/dist/version.d.ts.map +0 -1
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Databuddy
|
|
3
|
+
description: Databuddy is a privacy-focused analytics platform that helps you understand user behavior and track events. It supports cookieless tracking and manages consent automatically through c15t's consent state synchronization.
|
|
4
|
+
lastModified: 2025-10-31
|
|
5
|
+
|
|
6
|
+
icon: databuddy
|
|
7
|
+
---
|
|
8
|
+
The Databuddy script automatically respects consent preferences by toggling tracking on and off based on the user's consent state.
|
|
9
|
+
|
|
10
|
+
## Script Implementation
|
|
11
|
+
|
|
12
|
+
1. **Adding the Databuddy script to c15t**
|
|
13
|
+
|
|
14
|
+
> ℹ️ Info:
|
|
15
|
+
>
|
|
16
|
+
> See the integration overview for how to pass scripts to your framework (JavaScript, React, or Next.js).
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { databuddy } from '@c15t/scripts/databuddy';
|
|
20
|
+
|
|
21
|
+
databuddy({
|
|
22
|
+
clientId: 'your-client-id',
|
|
23
|
+
scriptUrl: 'https://cdn.databuddy.cc/databuddy.js',
|
|
24
|
+
apiUrl: 'https://basket.databuddy.cc',
|
|
25
|
+
configWhenGranted: {
|
|
26
|
+
clientId: 'your-client-id',
|
|
27
|
+
apiUrl: 'https://basket.databuddy.cc',
|
|
28
|
+
trackScreenViews: true,
|
|
29
|
+
trackOutgoingLinks: true,
|
|
30
|
+
disabled: false,
|
|
31
|
+
},
|
|
32
|
+
configWhenDenied: {
|
|
33
|
+
clientId: 'your-client-id',
|
|
34
|
+
apiUrl: 'https://basket.databuddy.cc',
|
|
35
|
+
disabled: true,
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
2. **Using Databuddy in your application** Once initialized, Databuddy is available globally via window\.databuddy or window\.db:
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
// Track a custom event
|
|
44
|
+
window.databuddy?.trackCustomEvent('button_clicked', {
|
|
45
|
+
button_id: 'signup',
|
|
46
|
+
page: '/landing'
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// Or use the shorthand
|
|
50
|
+
window.db?.track('purchase_completed', {
|
|
51
|
+
amount: 99.99,
|
|
52
|
+
currency: 'USD'
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// Track a screen view manually
|
|
56
|
+
window.databuddy?.screenView('/dashboard', {
|
|
57
|
+
user_role: 'admin'
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// Set global properties for all events
|
|
61
|
+
window.databuddy?.setGlobalProperties({
|
|
62
|
+
app_version: '1.2.3',
|
|
63
|
+
environment: 'production'
|
|
64
|
+
});
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## How Consent Management Works
|
|
68
|
+
|
|
69
|
+
The Databuddy integration automatically handles consent management:
|
|
70
|
+
|
|
71
|
+
1. **Before Script Load**: Sets `window.databuddyConfig.disabled` based on initial consent state
|
|
72
|
+
2. **On Consent Grant**: Enables tracking by setting `window.databuddy.options.disabled = false`
|
|
73
|
+
3. **On Consent Revoke**: Disables tracking by setting `window.databuddy.options.disabled = true`
|
|
74
|
+
|
|
75
|
+
This ensures that no tracking occurs without user consent, keeping your analytics privacy-compliant.
|
|
76
|
+
|
|
77
|
+
## Configuration Options
|
|
78
|
+
|
|
79
|
+
The Databuddy manifest expects explicit initial config objects for the granted
|
|
80
|
+
and denied consent states:
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
databuddy({
|
|
84
|
+
clientId: 'your-client-id',
|
|
85
|
+
scriptUrl: 'https://cdn.databuddy.cc/databuddy.js',
|
|
86
|
+
apiUrl: 'https://basket.databuddy.cc', // Optional, defaults to basket.databuddy.cc, change if self-hosting
|
|
87
|
+
configWhenGranted: {
|
|
88
|
+
clientId: 'your-client-id',
|
|
89
|
+
apiUrl: 'https://basket.databuddy.cc',
|
|
90
|
+
// Tracking options
|
|
91
|
+
trackScreenViews: true, // Automatically track page views
|
|
92
|
+
trackOutgoingLinks: true, // Track clicks on external links
|
|
93
|
+
trackAttributes: false, // Track data-track attributes on elements
|
|
94
|
+
trackErrors: false, // Track JavaScript errors
|
|
95
|
+
trackPerformance: true, // Track performance metrics
|
|
96
|
+
trackWebVitals: false, // Track Core Web Vitals
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
// Network options
|
|
100
|
+
enableBatching: false, // Batch events before sending
|
|
101
|
+
batchSize: 10, // Events per batch
|
|
102
|
+
batchTimeout: 2000, // Batch timeout in ms
|
|
103
|
+
samplingRate: 1.0, // Sample rate (0.0-1.0)
|
|
104
|
+
disabled: false,
|
|
105
|
+
},
|
|
106
|
+
configWhenDenied: {
|
|
107
|
+
clientId: 'your-client-id',
|
|
108
|
+
apiUrl: 'https://basket.databuddy.cc',
|
|
109
|
+
disabled: true,
|
|
110
|
+
}
|
|
111
|
+
})
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Types
|
|
115
|
+
|
|
116
|
+
### DatabuddyConsentOptions
|
|
117
|
+
|
|
118
|
+
|Property|Type|Description|Default|Required|
|
|
119
|
+
|:--|:--|:--|:--|:--:|
|
|
120
|
+
|clientId|string|Your Databuddy client ID.|-|✅ Required|
|
|
121
|
+
|apiUrl|string \|undefined|Your Databuddy API URL.|'https\://basket.databuddy.cc'|Optional|
|
|
122
|
+
|scriptUrl|string \|undefined|The Databuddy script URL.|'https\://cdn.databuddy.cc/databuddy.js'|Optional|
|
|
123
|
+
|configWhenGranted|Record\<string, unknown>|Databuddy config object to seed when consent is granted at load time.|-|✅ Required|
|
|
124
|
+
|configWhenDenied|Record\<string, unknown>|Databuddy config object to seed when consent is denied at load time.|-|✅ Required|
|
|
125
|
+
|
|
126
|
+
### Script
|
|
127
|
+
|
|
128
|
+
|Property|Type|Description|Default|Required|
|
|
129
|
+
|:--|:--|:--|:--|:--:|
|
|
130
|
+
|id|string|Unique identifier for the script|-|✅ Required|
|
|
131
|
+
|src|string \|undefined|URL of the script to load|-|Optional|
|
|
132
|
+
|textContent|string \|undefined|Inline JavaScript code to execute|-|Optional|
|
|
133
|
+
|category|HasCondition\<AllConsentNames>|Consent category or condition required to load this script|-|✅ Required|
|
|
134
|
+
|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|
|
|
135
|
+
|persistAfterConsentRevoked|boolean \|undefined|Whether the script should persist after consent is revoked.|false|Optional|
|
|
136
|
+
|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|
|
|
137
|
+
|fetchPriority|"high" \|"low" \|"auto" \|undefined|Priority hint for browser resource loading|-|Optional|
|
|
138
|
+
|attributes|Record\<string, string> \|undefined|Additional attributes to add to the script element|-|Optional|
|
|
139
|
+
|async|boolean \|undefined|Whether to use async loading|-|Optional|
|
|
140
|
+
|defer|boolean \|undefined|Whether to defer script loading|-|Optional|
|
|
141
|
+
|nonce|string \|undefined|Content Security Policy nonce|-|Optional|
|
|
142
|
+
|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|
|
|
143
|
+
|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|
|
|
144
|
+
|onBeforeLoad|Object \|undefined|Callback executed before the script is loaded|-|Optional|
|
|
145
|
+
|onLoad|Object \|undefined|Callback executed when the script loads successfully|-|Optional|
|
|
146
|
+
|onError|Object \|undefined|Callback executed if the script fails to load|-|Optional|
|
|
147
|
+
|onConsentChange|Object \|undefined|Callback executed whenever the consent store is changed. This callback only applies to scripts already loaded.|-|Optional|
|
|
148
|
+
|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|
|
|
149
|
+
|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|
|
|
150
|
+
|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|
|
|
151
|
+
|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|
|
|
152
|
+
|
|
153
|
+
#### `onBeforeLoad`
|
|
154
|
+
|
|
155
|
+
Callback executed before the script is loaded
|
|
156
|
+
|
|
157
|
+
|Property|Type|Description|Default|Required|
|
|
158
|
+
|:--|:--|:--|:--|:--:|
|
|
159
|
+
|id|string|The original script ID|-|✅ Required|
|
|
160
|
+
|elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
|
|
161
|
+
|hasConsent|boolean|Has consent|-|✅ Required|
|
|
162
|
+
|consents|ConsentState|The current consent state|-|✅ Required|
|
|
163
|
+
|element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
|
|
164
|
+
|error|Error \|undefined|Error information (for error callbacks)|-|Optional|
|
|
165
|
+
|
|
166
|
+
#### `onLoad`
|
|
167
|
+
|
|
168
|
+
Callback executed when the script loads successfully
|
|
169
|
+
|
|
170
|
+
|Property|Type|Description|Default|Required|
|
|
171
|
+
|:--|:--|:--|:--|:--:|
|
|
172
|
+
|id|string|The original script ID|-|✅ Required|
|
|
173
|
+
|elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
|
|
174
|
+
|hasConsent|boolean|Has consent|-|✅ Required|
|
|
175
|
+
|consents|ConsentState|The current consent state|-|✅ Required|
|
|
176
|
+
|element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
|
|
177
|
+
|error|Error \|undefined|Error information (for error callbacks)|-|Optional|
|
|
178
|
+
|
|
179
|
+
#### `onError`
|
|
180
|
+
|
|
181
|
+
Callback executed if the script fails to load
|
|
182
|
+
|
|
183
|
+
|Property|Type|Description|Default|Required|
|
|
184
|
+
|:--|:--|:--|:--|:--:|
|
|
185
|
+
|id|string|The original script ID|-|✅ Required|
|
|
186
|
+
|elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
|
|
187
|
+
|hasConsent|boolean|Has consent|-|✅ Required|
|
|
188
|
+
|consents|ConsentState|The current consent state|-|✅ Required|
|
|
189
|
+
|element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
|
|
190
|
+
|error|Error \|undefined|Error information (for error callbacks)|-|Optional|
|
|
191
|
+
|
|
192
|
+
#### `onConsentChange`
|
|
193
|
+
|
|
194
|
+
Callback executed whenever the consent store is changed. This callback only applies to scripts already loaded.
|
|
195
|
+
|
|
196
|
+
|Property|Type|Description|Default|Required|
|
|
197
|
+
|:--|:--|:--|:--|:--:|
|
|
198
|
+
|id|string|The original script ID|-|✅ Required|
|
|
199
|
+
|elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
|
|
200
|
+
|hasConsent|boolean|Has consent|-|✅ Required|
|
|
201
|
+
|consents|ConsentState|The current consent state|-|✅ Required|
|
|
202
|
+
|element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
|
|
203
|
+
|error|Error \|undefined|Error information (for error callbacks)|-|Optional|
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Google Tag Manager
|
|
3
|
+
description: Deploy and manage marketing tags centrally with automatic consent state synchronization.
|
|
4
|
+
lastModified: 2026-02-10
|
|
5
|
+
|
|
6
|
+
icon: google-tag-manager
|
|
7
|
+
---
|
|
8
|
+
Google Tag Manager (GTM) is Google's tag management system that lets you deploy and manage marketing tags, analytics scripts, and conversion pixels without modifying your codebase. Instead of hardcoding multiple scripts, you configure them through GTM's web interface.
|
|
9
|
+
|
|
10
|
+
c15t automatically injects the GTM script into your page and syncs consent state with GTM using Consent Mode v2. By default, c15t loads GTM regardless of consent because GTM manages its own internal consent state and only fires tags when appropriate consent is granted.
|
|
11
|
+
|
|
12
|
+
This prevents GTM-managed scripts from loading without proper consent while giving you centralized control over your marketing stack.
|
|
13
|
+
|
|
14
|
+
> ℹ️ **Info:**
|
|
15
|
+
> Use GTM if your team manages many tags centrally in the GTM UI. Use gtag.js if you only need GA4/Google Ads directly in code. Don't run both for the same destination unless intentional, or you may duplicate events.
|
|
16
|
+
|
|
17
|
+
## Implementation
|
|
18
|
+
|
|
19
|
+
1. **Creating a Tag Manager Container**
|
|
20
|
+
|
|
21
|
+
> ℹ️ Info:
|
|
22
|
+
>
|
|
23
|
+
> This step is optional if you already have a Tag Manager container. Ensure your container has consent overview enabled.
|
|
24
|
+
|
|
25
|
+
After signing into Google Tag Manager, you can create a new container.
|
|
26
|
+
Continue to Google Tag Manager
|
|
27
|
+
|
|
28
|
+
In Tag Manager, click Admin > Container Settings.Under Additional Settings, select "Enable consent overview".
|
|
29
|
+
|
|
30
|
+
Enable consent overview
|
|
31
|
+
|
|
32
|
+
2. **Custom Update Trigger** We now need to create a custom trigger in GTM to trigger the update event, this is the trigger that is fired when the consent state is updated, e.g. user gives consent to a specific purpose.
|
|
33
|
+
|
|
34
|
+
In GTM, you can create a new trigger by clicking on the "Triggers" tab and then clicking on "New".
|
|
35
|
+
|
|
36
|
+
For the event name, you can use the default "consent-update", this is customizable later so you can change it if you want.
|
|
37
|
+
|
|
38
|
+
Create trigger
|
|
39
|
+
|
|
40
|
+
3. **Adding / Updating tags** Now for your existing tags, you can add the "consent-update" trigger to the tag, this will fire the update event when the consent state is updated & it has the appropriate consent state.
|
|
41
|
+
|
|
42
|
+
Update tags
|
|
43
|
+
|
|
44
|
+
4. **Setting up c15t with Google Tag Manager** After creating your container, you can set up c15t with Google Tag Manager. All you need to do is copy and paste your container ID & begins with "GTM-".
|
|
45
|
+
|
|
46
|
+
> ℹ️ Info:
|
|
47
|
+
>
|
|
48
|
+
> See the integration overview for how to pass scripts to your framework (JavaScript, React, or Next.js).
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
import { googleTagManager } from '@c15t/scripts/google-tag-manager';
|
|
52
|
+
|
|
53
|
+
googleTagManager({
|
|
54
|
+
id: 'GTM-XXXXXXX',
|
|
55
|
+
})
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Post-setup verification checklist
|
|
59
|
+
|
|
60
|
+
1. Open GTM Preview mode and confirm your container (`GTM-...`) loads on page load.
|
|
61
|
+
2. Before giving consent, confirm non-essential tags do not fire in GTM Preview.
|
|
62
|
+
3. Accept consent in the c15t banner/dialog and confirm a `consent-update` event appears in the GTM event timeline.
|
|
63
|
+
4. Confirm measurement/marketing tags fire only after the matching consent is granted.
|
|
64
|
+
5. Revoke consent and confirm a new `consent-update` event appears and affected tags stop firing.
|
|
65
|
+
|
|
66
|
+
## Types
|
|
67
|
+
|
|
68
|
+
### GoogleTagManagerOptions
|
|
69
|
+
|
|
70
|
+
|Property|Type|Description|Default|Required|
|
|
71
|
+
|:--|:--|:--|:--|:--:|
|
|
72
|
+
|id|string|Your Google Tag Manager container ID. Begins with 'GTM-'.|-|✅ Required|
|
|
73
|
+
|updateEventName|string \|undefined|Custom event name fired after consent updates. Can be used as a trigger in GTM to load scripts once consent is updated.|'consent-update'|Optional|
|
|
74
|
+
|consentMapping|Record\<string, string\[]> \|undefined|Custom mapping from c15t consent categories to Google Consent Mode v2 types. Overrides the default mapping when provided.|\`\`\`ts \{ necessary: \['security\_storage'], functionality: \['functionality\_storage'], measurement: \['analytics\_storage'], marketing: \['ad\_storage', 'ad\_user\_data', 'ad\_personalization'], experience: \['personalization\_storage'], } \`\`\`|Optional|
|
|
75
|
+
|
|
76
|
+
### Script
|
|
77
|
+
|
|
78
|
+
|Property|Type|Description|Default|Required|
|
|
79
|
+
|:--|:--|:--|:--|:--:|
|
|
80
|
+
|id|string|Unique identifier for the script|-|✅ Required|
|
|
81
|
+
|src|string \|undefined|URL of the script to load|-|Optional|
|
|
82
|
+
|textContent|string \|undefined|Inline JavaScript code to execute|-|Optional|
|
|
83
|
+
|category|HasCondition\<AllConsentNames>|Consent category or condition required to load this script|-|✅ Required|
|
|
84
|
+
|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|
|
|
85
|
+
|persistAfterConsentRevoked|boolean \|undefined|Whether the script should persist after consent is revoked.|false|Optional|
|
|
86
|
+
|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|
|
|
87
|
+
|fetchPriority|"high" \|"low" \|"auto" \|undefined|Priority hint for browser resource loading|-|Optional|
|
|
88
|
+
|attributes|Record\<string, string> \|undefined|Additional attributes to add to the script element|-|Optional|
|
|
89
|
+
|async|boolean \|undefined|Whether to use async loading|-|Optional|
|
|
90
|
+
|defer|boolean \|undefined|Whether to defer script loading|-|Optional|
|
|
91
|
+
|nonce|string \|undefined|Content Security Policy nonce|-|Optional|
|
|
92
|
+
|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|
|
|
93
|
+
|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|
|
|
94
|
+
|onBeforeLoad|Object \|undefined|Callback executed before the script is loaded|-|Optional|
|
|
95
|
+
|onLoad|Object \|undefined|Callback executed when the script loads successfully|-|Optional|
|
|
96
|
+
|onError|Object \|undefined|Callback executed if the script fails to load|-|Optional|
|
|
97
|
+
|onConsentChange|Object \|undefined|Callback executed whenever the consent store is changed. This callback only applies to scripts already loaded.|-|Optional|
|
|
98
|
+
|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|
|
|
99
|
+
|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|
|
|
100
|
+
|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|
|
|
101
|
+
|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|
|
|
102
|
+
|
|
103
|
+
#### `onBeforeLoad`
|
|
104
|
+
|
|
105
|
+
Callback executed before the script is loaded
|
|
106
|
+
|
|
107
|
+
|Property|Type|Description|Default|Required|
|
|
108
|
+
|:--|:--|:--|:--|:--:|
|
|
109
|
+
|id|string|The original script ID|-|✅ Required|
|
|
110
|
+
|elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
|
|
111
|
+
|hasConsent|boolean|Has consent|-|✅ Required|
|
|
112
|
+
|consents|ConsentState|The current consent state|-|✅ Required|
|
|
113
|
+
|element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
|
|
114
|
+
|error|Error \|undefined|Error information (for error callbacks)|-|Optional|
|
|
115
|
+
|
|
116
|
+
#### `onLoad`
|
|
117
|
+
|
|
118
|
+
Callback executed when the script loads successfully
|
|
119
|
+
|
|
120
|
+
|Property|Type|Description|Default|Required|
|
|
121
|
+
|:--|:--|:--|:--|:--:|
|
|
122
|
+
|id|string|The original script ID|-|✅ Required|
|
|
123
|
+
|elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
|
|
124
|
+
|hasConsent|boolean|Has consent|-|✅ Required|
|
|
125
|
+
|consents|ConsentState|The current consent state|-|✅ Required|
|
|
126
|
+
|element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
|
|
127
|
+
|error|Error \|undefined|Error information (for error callbacks)|-|Optional|
|
|
128
|
+
|
|
129
|
+
#### `onError`
|
|
130
|
+
|
|
131
|
+
Callback executed if the script fails to load
|
|
132
|
+
|
|
133
|
+
|Property|Type|Description|Default|Required|
|
|
134
|
+
|:--|:--|:--|:--|:--:|
|
|
135
|
+
|id|string|The original script ID|-|✅ Required|
|
|
136
|
+
|elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
|
|
137
|
+
|hasConsent|boolean|Has consent|-|✅ Required|
|
|
138
|
+
|consents|ConsentState|The current consent state|-|✅ Required|
|
|
139
|
+
|element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
|
|
140
|
+
|error|Error \|undefined|Error information (for error callbacks)|-|Optional|
|
|
141
|
+
|
|
142
|
+
#### `onConsentChange`
|
|
143
|
+
|
|
144
|
+
Callback executed whenever the consent store is changed. This callback only applies to scripts already loaded.
|
|
145
|
+
|
|
146
|
+
|Property|Type|Description|Default|Required|
|
|
147
|
+
|:--|:--|:--|:--|:--:|
|
|
148
|
+
|id|string|The original script ID|-|✅ Required|
|
|
149
|
+
|elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
|
|
150
|
+
|hasConsent|boolean|Has consent|-|✅ Required|
|
|
151
|
+
|consents|ConsentState|The current consent state|-|✅ Required|
|
|
152
|
+
|element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
|
|
153
|
+
|error|Error \|undefined|Error information (for error callbacks)|-|Optional|
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: GA4 + Google Ads (gtag.js)
|
|
3
|
+
description: Send data to Google Analytics 4 and Google Ads with automatic Consent Mode v2 support.
|
|
4
|
+
lastModified: 2026-02-10
|
|
5
|
+
|
|
6
|
+
icon: google-analytics
|
|
7
|
+
---
|
|
8
|
+
Google Tag (`gtag.js`) is Google's unified tracking script for sending data to Google Analytics 4 (GA4), Google Ads, and Floodlight. It measures user behavior, tracks conversions, and powers Google's advertising ecosystem.
|
|
9
|
+
|
|
10
|
+
c15t initializes Google Tag with Consent Mode v2 defaults set to denied and automatically updates the consent state when users make choices. You don't need to configure Google Consent Mode yourself.
|
|
11
|
+
|
|
12
|
+
> ℹ️ **Info:**
|
|
13
|
+
> Use GTM if your team needs centralized tag management in the GTM UI. Use gtag.js if you only need GA4/Google Ads directly in code. Don't run both for the same destination unless intentional, or you may duplicate events.
|
|
14
|
+
|
|
15
|
+
**Choosing the right category:**
|
|
16
|
+
|
|
17
|
+
* Use `category: 'measurement'` for analytics-only tracking (GA4 events)
|
|
18
|
+
* Use `category: 'marketing'` for advertising and conversion tracking (Google Ads)
|
|
19
|
+
|
|
20
|
+
## Adding GA4 + Google Ads to c15t
|
|
21
|
+
|
|
22
|
+
> ℹ️ **Info:**
|
|
23
|
+
> See the integration overview for how to pass scripts to your framework (JavaScript, React, or Next.js).
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import { gtag } from '@c15t/scripts/google-tag';
|
|
27
|
+
|
|
28
|
+
gtag({
|
|
29
|
+
id: 'G-XXXXXXXXXX',
|
|
30
|
+
category: 'measurement', // or 'marketing'
|
|
31
|
+
})
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Types
|
|
35
|
+
|
|
36
|
+
### GtagOptions
|
|
37
|
+
|
|
38
|
+
|Property|Type|Description|Default|Required|
|
|
39
|
+
|:--|:--|:--|:--|:--:|
|
|
40
|
+
|id|string|Your gtag id|-|✅ Required|
|
|
41
|
+
|category|AllConsentNames|The consent category to use for the gtag script. This is typically marketing (Ads & Floodlight) or measurement (Analytics)|-|✅ Required|
|
|
42
|
+
|consentMapping|Record\<string, string\[]> \|undefined|Custom mapping from c15t consent categories to Google Consent Mode v2 types. Overrides the default mapping when provided.|\`\`\`ts \{ necessary: \['security\_storage'], functionality: \['functionality\_storage'], measurement: \['analytics\_storage'], marketing: \['ad\_storage', 'ad\_user\_data', 'ad\_personalization'], experience: \['personalization\_storage'], } \`\`\`|Optional|
|
|
43
|
+
|script|Script \|undefined|Deprecated script-level overrides preserved for backwards compatibility. Prefer manifest-backed options instead of this generic override bag.|-|Optional|
|
|
44
|
+
|
|
45
|
+
### Script
|
|
46
|
+
|
|
47
|
+
|Property|Type|Description|Default|Required|
|
|
48
|
+
|:--|:--|:--|:--|:--:|
|
|
49
|
+
|id|string|Unique identifier for the script|-|✅ Required|
|
|
50
|
+
|src|string \|undefined|URL of the script to load|-|Optional|
|
|
51
|
+
|textContent|string \|undefined|Inline JavaScript code to execute|-|Optional|
|
|
52
|
+
|category|HasCondition\<AllConsentNames>|Consent category or condition required to load this script|-|✅ Required|
|
|
53
|
+
|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|
|
|
54
|
+
|persistAfterConsentRevoked|boolean \|undefined|Whether the script should persist after consent is revoked.|false|Optional|
|
|
55
|
+
|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|
|
|
56
|
+
|fetchPriority|"high" \|"low" \|"auto" \|undefined|Priority hint for browser resource loading|-|Optional|
|
|
57
|
+
|attributes|Record\<string, string> \|undefined|Additional attributes to add to the script element|-|Optional|
|
|
58
|
+
|async|boolean \|undefined|Whether to use async loading|-|Optional|
|
|
59
|
+
|defer|boolean \|undefined|Whether to defer script loading|-|Optional|
|
|
60
|
+
|nonce|string \|undefined|Content Security Policy nonce|-|Optional|
|
|
61
|
+
|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|
|
|
62
|
+
|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|
|
|
63
|
+
|onBeforeLoad|Object \|undefined|Callback executed before the script is loaded|-|Optional|
|
|
64
|
+
|onLoad|Object \|undefined|Callback executed when the script loads successfully|-|Optional|
|
|
65
|
+
|onError|Object \|undefined|Callback executed if the script fails to load|-|Optional|
|
|
66
|
+
|onConsentChange|Object \|undefined|Callback executed whenever the consent store is changed. This callback only applies to scripts already loaded.|-|Optional|
|
|
67
|
+
|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|
|
|
68
|
+
|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|
|
|
69
|
+
|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|
|
|
70
|
+
|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|
|
|
71
|
+
|
|
72
|
+
#### `onBeforeLoad`
|
|
73
|
+
|
|
74
|
+
Callback executed before the script is loaded
|
|
75
|
+
|
|
76
|
+
|Property|Type|Description|Default|Required|
|
|
77
|
+
|:--|:--|:--|:--|:--:|
|
|
78
|
+
|id|string|The original script ID|-|✅ Required|
|
|
79
|
+
|elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
|
|
80
|
+
|hasConsent|boolean|Has consent|-|✅ Required|
|
|
81
|
+
|consents|ConsentState|The current consent state|-|✅ Required|
|
|
82
|
+
|element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
|
|
83
|
+
|error|Error \|undefined|Error information (for error callbacks)|-|Optional|
|
|
84
|
+
|
|
85
|
+
#### `onLoad`
|
|
86
|
+
|
|
87
|
+
Callback executed when the script loads successfully
|
|
88
|
+
|
|
89
|
+
|Property|Type|Description|Default|Required|
|
|
90
|
+
|:--|:--|:--|:--|:--:|
|
|
91
|
+
|id|string|The original script ID|-|✅ Required|
|
|
92
|
+
|elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
|
|
93
|
+
|hasConsent|boolean|Has consent|-|✅ Required|
|
|
94
|
+
|consents|ConsentState|The current consent state|-|✅ Required|
|
|
95
|
+
|element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
|
|
96
|
+
|error|Error \|undefined|Error information (for error callbacks)|-|Optional|
|
|
97
|
+
|
|
98
|
+
#### `onError`
|
|
99
|
+
|
|
100
|
+
Callback executed if the script fails to load
|
|
101
|
+
|
|
102
|
+
|Property|Type|Description|Default|Required|
|
|
103
|
+
|:--|:--|:--|:--|:--:|
|
|
104
|
+
|id|string|The original script ID|-|✅ Required|
|
|
105
|
+
|elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
|
|
106
|
+
|hasConsent|boolean|Has consent|-|✅ Required|
|
|
107
|
+
|consents|ConsentState|The current consent state|-|✅ Required|
|
|
108
|
+
|element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
|
|
109
|
+
|error|Error \|undefined|Error information (for error callbacks)|-|Optional|
|
|
110
|
+
|
|
111
|
+
#### `onConsentChange`
|
|
112
|
+
|
|
113
|
+
Callback executed whenever the consent store is changed. This callback only applies to scripts already loaded.
|
|
114
|
+
|
|
115
|
+
|Property|Type|Description|Default|Required|
|
|
116
|
+
|:--|:--|:--|:--|:--:|
|
|
117
|
+
|id|string|The original script ID|-|✅ Required|
|
|
118
|
+
|elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
|
|
119
|
+
|hasConsent|boolean|Has consent|-|✅ Required|
|
|
120
|
+
|consents|ConsentState|The current consent state|-|✅ Required|
|
|
121
|
+
|element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
|
|
122
|
+
|error|Error \|undefined|Error information (for error callbacks)|-|Optional|
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: LinkedIn Insights
|
|
3
|
+
description: Track conversions and build matched audiences for LinkedIn advertising campaigns.
|
|
4
|
+
lastModified: 2025-09-24
|
|
5
|
+
|
|
6
|
+
icon: linkedin
|
|
7
|
+
---
|
|
8
|
+
LinkedIn Insights Tag is LinkedIn's conversion tracking and audience matching tool for LinkedIn advertising campaigns. It tracks website actions, measures ad performance, builds matched audiences for retargeting, and provides demographic insights about your visitors. By default, c15t loads this script based on `marketing` consent.
|
|
9
|
+
|
|
10
|
+
## Adding the LinkedIn Insights Tag to c15t
|
|
11
|
+
|
|
12
|
+
> ℹ️ **Info:**
|
|
13
|
+
> See the integration overview for how to pass scripts to your framework (JavaScript, React, or Next.js).
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { linkedinInsights } from '@c15t/scripts/linkedin-insights';
|
|
17
|
+
|
|
18
|
+
linkedinInsights({
|
|
19
|
+
id: '123456789012345',
|
|
20
|
+
})
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Types
|
|
24
|
+
|
|
25
|
+
### LinkedInInsightsOptions
|
|
26
|
+
|
|
27
|
+
|Property|Type|Description|Default|Required|
|
|
28
|
+
|:--|:--|:--|:--|:--:|
|
|
29
|
+
|id|string|Your LinkedIn Insights ID|-|✅ Required|
|
|
30
|
+
|scriptSrc|string \|undefined|LinkedIn Insights loader URL.|-|Optional|
|
|
31
|
+
|
|
32
|
+
### Script
|
|
33
|
+
|
|
34
|
+
|Property|Type|Description|Default|Required|
|
|
35
|
+
|:--|:--|:--|:--|:--:|
|
|
36
|
+
|id|string|Unique identifier for the script|-|✅ Required|
|
|
37
|
+
|src|string \|undefined|URL of the script to load|-|Optional|
|
|
38
|
+
|textContent|string \|undefined|Inline JavaScript code to execute|-|Optional|
|
|
39
|
+
|category|HasCondition\<AllConsentNames>|Consent category or condition required to load this script|-|✅ Required|
|
|
40
|
+
|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|
|
|
41
|
+
|persistAfterConsentRevoked|boolean \|undefined|Whether the script should persist after consent is revoked.|false|Optional|
|
|
42
|
+
|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|
|
|
43
|
+
|fetchPriority|"high" \|"low" \|"auto" \|undefined|Priority hint for browser resource loading|-|Optional|
|
|
44
|
+
|attributes|Record\<string, string> \|undefined|Additional attributes to add to the script element|-|Optional|
|
|
45
|
+
|async|boolean \|undefined|Whether to use async loading|-|Optional|
|
|
46
|
+
|defer|boolean \|undefined|Whether to defer script loading|-|Optional|
|
|
47
|
+
|nonce|string \|undefined|Content Security Policy nonce|-|Optional|
|
|
48
|
+
|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|
|
|
49
|
+
|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|
|
|
50
|
+
|onBeforeLoad|Object \|undefined|Callback executed before the script is loaded|-|Optional|
|
|
51
|
+
|onLoad|Object \|undefined|Callback executed when the script loads successfully|-|Optional|
|
|
52
|
+
|onError|Object \|undefined|Callback executed if the script fails to load|-|Optional|
|
|
53
|
+
|onConsentChange|Object \|undefined|Callback executed whenever the consent store is changed. This callback only applies to scripts already loaded.|-|Optional|
|
|
54
|
+
|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|
|
|
55
|
+
|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|
|
|
56
|
+
|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|
|
|
57
|
+
|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|
|
|
58
|
+
|
|
59
|
+
#### `onBeforeLoad`
|
|
60
|
+
|
|
61
|
+
Callback executed before the script is loaded
|
|
62
|
+
|
|
63
|
+
|Property|Type|Description|Default|Required|
|
|
64
|
+
|:--|:--|:--|:--|:--:|
|
|
65
|
+
|id|string|The original script ID|-|✅ Required|
|
|
66
|
+
|elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
|
|
67
|
+
|hasConsent|boolean|Has consent|-|✅ Required|
|
|
68
|
+
|consents|ConsentState|The current consent state|-|✅ Required|
|
|
69
|
+
|element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
|
|
70
|
+
|error|Error \|undefined|Error information (for error callbacks)|-|Optional|
|
|
71
|
+
|
|
72
|
+
#### `onLoad`
|
|
73
|
+
|
|
74
|
+
Callback executed when the script loads successfully
|
|
75
|
+
|
|
76
|
+
|Property|Type|Description|Default|Required|
|
|
77
|
+
|:--|:--|:--|:--|:--:|
|
|
78
|
+
|id|string|The original script ID|-|✅ Required|
|
|
79
|
+
|elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
|
|
80
|
+
|hasConsent|boolean|Has consent|-|✅ Required|
|
|
81
|
+
|consents|ConsentState|The current consent state|-|✅ Required|
|
|
82
|
+
|element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
|
|
83
|
+
|error|Error \|undefined|Error information (for error callbacks)|-|Optional|
|
|
84
|
+
|
|
85
|
+
#### `onError`
|
|
86
|
+
|
|
87
|
+
Callback executed if the script fails to load
|
|
88
|
+
|
|
89
|
+
|Property|Type|Description|Default|Required|
|
|
90
|
+
|:--|:--|:--|:--|:--:|
|
|
91
|
+
|id|string|The original script ID|-|✅ Required|
|
|
92
|
+
|elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
|
|
93
|
+
|hasConsent|boolean|Has consent|-|✅ Required|
|
|
94
|
+
|consents|ConsentState|The current consent state|-|✅ Required|
|
|
95
|
+
|element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
|
|
96
|
+
|error|Error \|undefined|Error information (for error callbacks)|-|Optional|
|
|
97
|
+
|
|
98
|
+
#### `onConsentChange`
|
|
99
|
+
|
|
100
|
+
Callback executed whenever the consent store is changed. This callback only applies to scripts already loaded.
|
|
101
|
+
|
|
102
|
+
|Property|Type|Description|Default|Required|
|
|
103
|
+
|:--|:--|:--|:--|:--:|
|
|
104
|
+
|id|string|The original script ID|-|✅ Required|
|
|
105
|
+
|elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
|
|
106
|
+
|hasConsent|boolean|Has consent|-|✅ Required|
|
|
107
|
+
|consents|ConsentState|The current consent state|-|✅ Required|
|
|
108
|
+
|element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
|
|
109
|
+
|error|Error \|undefined|Error information (for error callbacks)|-|Optional|
|