c15t 2.0.0 → 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.
- package/CHANGELOG.md +44 -0
- package/README.md +15 -15
- package/dist/index.cjs +29 -26
- package/dist/index.js +29 -26
- package/dist-types/client/hosted/init.d.ts +1 -1
- package/dist-types/client/hosted/types.d.ts +1 -1
- package/dist-types/client/offline/types.d.ts +1 -1
- package/dist-types/index.d.ts +1 -1
- package/dist-types/libs/iab-tcf/types.d.ts +4 -4
- package/dist-types/libs/policy.d.ts +8 -5
- package/dist-types/store/type.d.ts +2 -2
- package/dist-types/version.d.ts +1 -1
- package/docs/ai-agents.md +111 -0
- package/docs/iab/overview.md +4 -4
- package/docs/integrations/ahrefs-analytics.md +224 -0
- package/docs/integrations/cloudflare-web-analytics.md +194 -0
- package/docs/integrations/crisp.md +214 -0
- package/docs/integrations/databuddy.md +136 -65
- package/docs/integrations/fathom-analytics.md +221 -0
- package/docs/integrations/google-tag-manager.md +84 -15
- package/docs/integrations/google-tag.md +89 -8
- package/docs/integrations/hotjar.md +211 -0
- package/docs/integrations/intercom.md +214 -0
- package/docs/integrations/linkedin-insights.md +130 -11
- package/docs/integrations/matomo-analytics.md +246 -0
- package/docs/integrations/meta-pixel.md +377 -24
- package/docs/integrations/microsoft-clarity.md +241 -0
- package/docs/integrations/microsoft-uet.md +120 -9
- package/docs/integrations/mixpanel-analytics.md +198 -0
- package/docs/integrations/overview.md +69 -74
- package/docs/integrations/plausible-analytics.md +237 -0
- package/docs/integrations/posthog.md +172 -41
- package/docs/integrations/promptwatch.md +187 -0
- package/docs/integrations/reddit-pixel.md +336 -0
- package/docs/integrations/rybbit-analytics.md +222 -0
- package/docs/integrations/segment.md +213 -0
- package/docs/integrations/snapchat-pixel.md +244 -0
- package/docs/integrations/tiktok-pixel.md +88 -10
- package/docs/integrations/umami-analytics.md +220 -0
- package/docs/integrations/vercel-analytics.md +213 -0
- package/docs/integrations/x-pixel.md +99 -10
- package/docs/script-loader.md +168 -51
- package/package.json +25 -15
- package/readme.json +1 -1
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Hotjar
|
|
3
|
+
description: Product analytics and behavior insights with a prebuilt helper that seeds Hotjar globals before loading the vendor bundle.
|
|
4
|
+
lastModified: 2026-05-10
|
|
5
|
+
icon: hotjar
|
|
6
|
+
---
|
|
7
|
+
Hotjar helps you understand behavior with heatmaps, session recordings, and feedback tools. The `hotjar()` helper sets up Hotjar's `_hjSettings` global and `hj` queue stub, then loads the vendor script once `measurement` consent is granted.
|
|
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 { hotjar } from '@c15t/scripts/hotjar';
|
|
17
|
+
|
|
18
|
+
const scripts = [hotjar({ siteId: 1234567, version: 6 })];
|
|
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 { hotjar } from '@c15t/scripts/hotjar';
|
|
43
|
+
|
|
44
|
+
const scripts = [hotjar({ siteId: 1234567, version: 6 })];
|
|
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 { hotjar } from '@c15t/scripts/hotjar';
|
|
66
|
+
|
|
67
|
+
getOrCreateConsentRuntime({
|
|
68
|
+
mode: 'hosted',
|
|
69
|
+
backendURL: 'https://your-instance.c15t.dev',
|
|
70
|
+
scripts: [hotjar({ siteId: 1234567, version: 6 })],
|
|
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 loader script element from the DOM, which prevents further loader-driven network requests. Existing Hotjar requests, timers, event listeners, and globals may continue until they finish or are cleared by Hotjar-specific APIs.
|
|
79
|
+
|
|
80
|
+
To load Hotjar from a custom URL:
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
hotjar({
|
|
84
|
+
siteId: 1234567,
|
|
85
|
+
scriptUrl: 'https://cdn.example.com/hotjar.js',
|
|
86
|
+
});
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Tracking events in your app
|
|
90
|
+
|
|
91
|
+
c15t gates loading of the Hotjar script until `measurement` consent is granted. The `hotjar()` helper initializes Hotjar globals by creating a pre-load queue stub at `window.hj`, so calls to Hotjar's runtime API (`window.hj(...)`) can be queued before the real script loads. After the helper runs, `window.hj` exists as that queue stub; once Hotjar's script loads, it is replaced by Hotjar's real implementation.
|
|
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
|
+
function SignupExample() {
|
|
100
|
+
const { has } = useConsentManager();
|
|
101
|
+
|
|
102
|
+
const trackSignup = useCallback(() => {
|
|
103
|
+
if (has('measurement')) {
|
|
104
|
+
window.hj?.('event', 'signup');
|
|
105
|
+
}
|
|
106
|
+
}, [has]);
|
|
107
|
+
|
|
108
|
+
// Call trackSignup() from an event handler after signup succeeds.
|
|
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.hj?.('event', 'signup');
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Types
|
|
125
|
+
|
|
126
|
+
### HotjarOptions
|
|
127
|
+
|
|
128
|
+
|Property|Type|Description|Default|Required|
|
|
129
|
+
|:--|:--|:--|:--|:--:|
|
|
130
|
+
|siteId|string \|number|Your Hotjar site ID.|-|✅ Required|
|
|
131
|
+
|version|number \|undefined|Hotjar script version.|6|Optional|
|
|
132
|
+
|scriptUrl|string \|undefined|Hotjar loader URL.|-|Optional|
|
|
133
|
+
|
|
134
|
+
### Script
|
|
135
|
+
|
|
136
|
+
|Property|Type|Description|Default|Required|
|
|
137
|
+
|:--|:--|:--|:--|:--:|
|
|
138
|
+
|id|string|Unique identifier for the script|-|✅ Required|
|
|
139
|
+
|src|string \|undefined|URL of the script to load|-|Optional|
|
|
140
|
+
|textContent|string \|undefined|Inline JavaScript code to execute|-|Optional|
|
|
141
|
+
|category|HasCondition\<AllConsentNames>|Consent category or condition required to load this script|-|✅ Required|
|
|
142
|
+
|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|
|
|
143
|
+
|persistAfterConsentRevoked|boolean \|undefined|Whether the script should persist after consent is revoked.|false|Optional|
|
|
144
|
+
|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|
|
|
145
|
+
|fetchPriority|"high" \|"low" \|"auto" \|undefined|Priority hint for browser resource loading|-|Optional|
|
|
146
|
+
|attributes|Record\<string, string> \|undefined|Additional attributes to add to the script element|-|Optional|
|
|
147
|
+
|async|boolean \|undefined|Whether to use async loading|-|Optional|
|
|
148
|
+
|defer|boolean \|undefined|Whether to defer script loading|-|Optional|
|
|
149
|
+
|nonce|string \|undefined|Content Security Policy nonce|-|Optional|
|
|
150
|
+
|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|
|
|
151
|
+
|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|
|
|
152
|
+
|onBeforeLoad|Object \|undefined|Callback executed before the script is loaded|-|Optional|
|
|
153
|
+
|onLoad|Object \|undefined|Callback executed when the script loads successfully|-|Optional|
|
|
154
|
+
|onError|Object \|undefined|Callback executed if the script fails to load|-|Optional|
|
|
155
|
+
|onConsentChange|Object \|undefined|Callback executed whenever the consent store is changed. This callback only applies to scripts already loaded.|-|Optional|
|
|
156
|
+
|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|
|
|
157
|
+
|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|
|
|
158
|
+
|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|
|
|
159
|
+
|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|
|
|
160
|
+
|
|
161
|
+
#### `onBeforeLoad`
|
|
162
|
+
|
|
163
|
+
Callback executed before the script is loaded
|
|
164
|
+
|
|
165
|
+
|Property|Type|Description|Default|Required|
|
|
166
|
+
|:--|:--|:--|:--|:--:|
|
|
167
|
+
|id|string|The original script ID|-|✅ Required|
|
|
168
|
+
|elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
|
|
169
|
+
|hasConsent|boolean|Has consent|-|✅ Required|
|
|
170
|
+
|consents|ConsentState|The current consent state|-|✅ Required|
|
|
171
|
+
|element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
|
|
172
|
+
|error|Error \|undefined|Error information (for error callbacks)|-|Optional|
|
|
173
|
+
|
|
174
|
+
#### `onLoad`
|
|
175
|
+
|
|
176
|
+
Callback executed when the script loads successfully
|
|
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
|
+
#### `onError`
|
|
188
|
+
|
|
189
|
+
Callback executed if the script fails to load
|
|
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
|
+
#### `onConsentChange`
|
|
201
|
+
|
|
202
|
+
Callback executed whenever the consent store is changed. This callback only applies to scripts already loaded.
|
|
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|
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Intercom
|
|
3
|
+
description: Bootstrap Intercom settings and load the messenger widget bundle.
|
|
4
|
+
lastModified: 2026-05-12
|
|
5
|
+
icon: intercom
|
|
6
|
+
---
|
|
7
|
+
Intercom adds the Intercom messenger widget and queues early `Intercom(...)`
|
|
8
|
+
calls until the widget bundle loads.
|
|
9
|
+
|
|
10
|
+
## Official Intercom documentation
|
|
11
|
+
|
|
12
|
+
* [Install Intercom Messenger](https://developers.intercom.com/installing-intercom/web/installation)
|
|
13
|
+
* [Secure your Messenger](https://developers.intercom.com/installing-intercom/web/identity-verification)
|
|
14
|
+
* [JavaScript API](https://developers.intercom.com/installing-intercom/web/methods)
|
|
15
|
+
* [Attributes and objects](https://developers.intercom.com/installing-intercom/web/attributes-objects)
|
|
16
|
+
|
|
17
|
+
## Integrate with c15t
|
|
18
|
+
|
|
19
|
+
**React**
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import { type ReactNode } from 'react';
|
|
23
|
+
import { ConsentManagerProvider } from '@c15t/react';
|
|
24
|
+
import { intercom } from '@c15t/scripts/intercom';
|
|
25
|
+
|
|
26
|
+
const scripts = [intercom({ appId: 'abc123' })];
|
|
27
|
+
|
|
28
|
+
export function ConsentProvider({ children }: { children: ReactNode }) {
|
|
29
|
+
return (
|
|
30
|
+
<ConsentManagerProvider
|
|
31
|
+
options={{
|
|
32
|
+
mode: 'hosted',
|
|
33
|
+
backendURL: 'https://your-instance.c15t.dev',
|
|
34
|
+
scripts,
|
|
35
|
+
}}
|
|
36
|
+
>
|
|
37
|
+
{children}
|
|
38
|
+
</ConsentManagerProvider>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Next.js**
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
'use client';
|
|
47
|
+
|
|
48
|
+
import { type ReactNode } from 'react';
|
|
49
|
+
import { ConsentManagerProvider } from '@c15t/nextjs';
|
|
50
|
+
import { intercom } from '@c15t/scripts/intercom';
|
|
51
|
+
|
|
52
|
+
const scripts = [intercom({ appId: 'abc123' })];
|
|
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 { intercom } from '@c15t/scripts/intercom';
|
|
74
|
+
|
|
75
|
+
getOrCreateConsentRuntime({
|
|
76
|
+
mode: 'hosted',
|
|
77
|
+
backendURL: 'https://your-instance.c15t.dev',
|
|
78
|
+
scripts: [intercom({ appId: 'abc123' })],
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## How c15t loads it
|
|
83
|
+
|
|
84
|
+
* **Category:** `functionality` (Functional)
|
|
85
|
+
* **Loads when:** functionality consent is granted
|
|
86
|
+
* **Before load:** c15t seeds `window.intercomSettings` and a queueing
|
|
87
|
+
`Intercom` stub
|
|
88
|
+
* **On revocation:** c15t follows the default script loader behavior for
|
|
89
|
+
non-persistent scripts
|
|
90
|
+
|
|
91
|
+
## Configure the integration
|
|
92
|
+
|
|
93
|
+
Intercom's default regional API base is `https://api-iam.intercom.io`. If your
|
|
94
|
+
workspace uses the EU or Australia data host, pass the matching `apiBase`.
|
|
95
|
+
|
|
96
|
+
```ts
|
|
97
|
+
intercom({
|
|
98
|
+
appId: 'abc123',
|
|
99
|
+
apiBase: 'https://api-iam.eu.intercom.io',
|
|
100
|
+
})
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Runtime options
|
|
104
|
+
|
|
105
|
+
Pass additional Intercom settings through `settings`. The helper always writes
|
|
106
|
+
the provided `appId` to `app_id` and `apiBase` to `api_base`.
|
|
107
|
+
|
|
108
|
+
```ts
|
|
109
|
+
intercom({
|
|
110
|
+
appId: 'abc123',
|
|
111
|
+
settings: {
|
|
112
|
+
name: 'Ada Lovelace',
|
|
113
|
+
user_id: 'user-123',
|
|
114
|
+
company: {
|
|
115
|
+
company_id: 'company-123',
|
|
116
|
+
name: 'Example Company Inc.',
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
})
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
For logged-in users, Intercom recommends securing the Messenger with
|
|
123
|
+
server-generated identity data. Generate verification tokens on your backend and
|
|
124
|
+
only pass client-safe values through `settings`.
|
|
125
|
+
|
|
126
|
+
## Types
|
|
127
|
+
|
|
128
|
+
### IntercomOptions
|
|
129
|
+
|
|
130
|
+
|Property|Type|Description|Default|Required|
|
|
131
|
+
|:--|:--|:--|:--|:--:|
|
|
132
|
+
|appId|string|Your Intercom app ID.|-|✅ Required|
|
|
133
|
+
|apiBase|IntercomApiBase \|undefined|Regional Intercom API base.|'https\://api-iam.intercom.io'|Optional|
|
|
134
|
+
|settings|IntercomCustomSettings \|undefined|Additional serializable Intercom settings merged into \`window\.intercomSettings\`.|-|Optional|
|
|
135
|
+
|scriptSrc|string \|undefined|Intercom 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|
|
|
@@ -1,33 +1,152 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: LinkedIn Insights
|
|
3
3
|
description: Track conversions and build matched audiences for LinkedIn advertising campaigns.
|
|
4
|
-
lastModified:
|
|
5
|
-
|
|
4
|
+
lastModified: 2026-05-11
|
|
6
5
|
icon: linkedin
|
|
7
6
|
---
|
|
8
|
-
LinkedIn
|
|
7
|
+
LinkedIn Insight Tag is LinkedIn's conversion tracking and audience matching tool for LinkedIn advertising campaigns. It tracks website actions, measures ad performance, builds website retargeting audiences, and provides aggregate audience insights about visitors from LinkedIn member accounts.
|
|
8
|
+
|
|
9
|
+
## Official LinkedIn documentation
|
|
10
|
+
|
|
11
|
+
* [Add the LinkedIn Insight Tag to your website](https://www.linkedin.com/help/lms/answer/a418880)
|
|
12
|
+
* [LinkedIn Insight Tag overview](https://www.linkedin.com/help/lms/answer/a489169)
|
|
13
|
+
* [LinkedIn Insight Tag FAQs](https://www.linkedin.com/help/lms/answer/a427660)
|
|
14
|
+
* [Insight Tag source status](https://www.linkedin.com/help/lms/answer/a488323)
|
|
15
|
+
* [Compatible tag management systems](https://www.linkedin.com/help/lms/answer/a422760)
|
|
16
|
+
* [LinkedIn Ads Agreement](https://www.linkedin.com/legal/sas-terms)
|
|
17
|
+
|
|
18
|
+
## Integrate with c15t
|
|
9
19
|
|
|
10
|
-
|
|
20
|
+
**React**
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
import { type ReactNode } from 'react';
|
|
24
|
+
import { ConsentManagerProvider } from '@c15t/react';
|
|
25
|
+
import { linkedinInsights } from '@c15t/scripts/linkedin-insights';
|
|
26
|
+
|
|
27
|
+
const scripts = [
|
|
28
|
+
linkedinInsights({
|
|
29
|
+
id: '123456789012345',
|
|
30
|
+
}),
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
export function ConsentProvider({ children }: { children: ReactNode }) {
|
|
34
|
+
return (
|
|
35
|
+
<ConsentManagerProvider
|
|
36
|
+
options={{
|
|
37
|
+
mode: 'hosted',
|
|
38
|
+
backendURL: 'https://your-instance.c15t.dev',
|
|
39
|
+
scripts,
|
|
40
|
+
}}
|
|
41
|
+
>
|
|
42
|
+
{children}
|
|
43
|
+
</ConsentManagerProvider>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
```
|
|
11
47
|
|
|
12
|
-
|
|
13
|
-
|
|
48
|
+
**Next.js**
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
'use client';
|
|
52
|
+
|
|
53
|
+
import { type ReactNode } from 'react';
|
|
54
|
+
import { ConsentManagerProvider } from '@c15t/nextjs';
|
|
55
|
+
import { linkedinInsights } from '@c15t/scripts/linkedin-insights';
|
|
56
|
+
|
|
57
|
+
const scripts = [
|
|
58
|
+
linkedinInsights({
|
|
59
|
+
id: '123456789012345',
|
|
60
|
+
}),
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
export function ConsentProvider({ children }: { children: ReactNode }) {
|
|
64
|
+
return (
|
|
65
|
+
<ConsentManagerProvider
|
|
66
|
+
options={{
|
|
67
|
+
mode: 'hosted',
|
|
68
|
+
backendURL: '/api/c15t',
|
|
69
|
+
scripts,
|
|
70
|
+
}}
|
|
71
|
+
>
|
|
72
|
+
{children}
|
|
73
|
+
</ConsentManagerProvider>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**JavaScript**
|
|
14
79
|
|
|
15
80
|
```ts
|
|
81
|
+
import { getOrCreateConsentRuntime } from 'c15t';
|
|
16
82
|
import { linkedinInsights } from '@c15t/scripts/linkedin-insights';
|
|
17
83
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
84
|
+
getOrCreateConsentRuntime({
|
|
85
|
+
mode: 'hosted',
|
|
86
|
+
backendURL: 'https://your-instance.c15t.dev',
|
|
87
|
+
scripts: [
|
|
88
|
+
linkedinInsights({
|
|
89
|
+
id: '123456789012345',
|
|
90
|
+
}),
|
|
91
|
+
],
|
|
92
|
+
});
|
|
21
93
|
```
|
|
22
94
|
|
|
95
|
+
## How c15t loads it
|
|
96
|
+
|
|
97
|
+
* **Category:** `marketing` (Ads & Pixels)
|
|
98
|
+
* **Loads when:** marketing consent is granted
|
|
99
|
+
* **Default install:** c15t sets the LinkedIn partner ID globals, seeds the `lintrk` queue, and loads LinkedIn's `insight.min.js`
|
|
100
|
+
* **On revocation:** unloaded - c15t removes the script element from the DOM
|
|
101
|
+
|
|
102
|
+
> ⚠️ **Warning:**
|
|
103
|
+
> LinkedIn says the Insight Tag should not be installed on pages that collect or contain Sensitive Data, including certain consumer health or financial pages. If your app has those pages, only include this script on eligible routes and confirm the placement with your legal team.
|
|
104
|
+
|
|
105
|
+
Use the LinkedIn Insight Tag partner ID as `id`. You can find it in Campaign Manager under **Data** -> **Signals manager** -> **Insight Tag**.
|
|
106
|
+
|
|
107
|
+
c15t intentionally does not add LinkedIn's `<noscript>` image pixel fallback. The integration is consent-gated JavaScript, so the script only loads after `marketing` consent is granted.
|
|
108
|
+
|
|
109
|
+
## Tracking events in your app
|
|
110
|
+
|
|
111
|
+
c15t gates the LinkedIn Insight Tag from loading until `marketing` consent is granted. Page tracking is automatic once the script loads, but if you fire custom conversions through `window.lintrk(...)`, those calls are **not** automatically gated - `window.lintrk` does not exist before consent is granted, and is removed again if consent is revoked.
|
|
112
|
+
|
|
113
|
+
Guard custom conversion calls by checking consent state:
|
|
114
|
+
|
|
115
|
+
```tsx
|
|
116
|
+
import { useCallback } from 'react';
|
|
117
|
+
import { useConsentManager } from '@c15t/react';
|
|
118
|
+
|
|
119
|
+
function useTrackSignup() {
|
|
120
|
+
const { has } = useConsentManager();
|
|
121
|
+
return useCallback(() => {
|
|
122
|
+
if (has('marketing')) {
|
|
123
|
+
window.lintrk?.('track', { conversion_id: 12345 });
|
|
124
|
+
}
|
|
125
|
+
}, [has]);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function SignupButton() {
|
|
129
|
+
const trackSignup = useTrackSignup();
|
|
130
|
+
return <button onClick={trackSignup}>Sign up</button>;
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Verify setup
|
|
135
|
+
|
|
136
|
+
LinkedIn validates the tag after an associated domain or URL receives traffic. Source status can take a few minutes and up to 24 hours to update after the first page load:
|
|
137
|
+
|
|
138
|
+
* **Active:** signal received in the past seven days
|
|
139
|
+
* **No recent activity:** no signal for more than seven days
|
|
140
|
+
* **Unverified:** no signal received yet
|
|
141
|
+
|
|
23
142
|
## Types
|
|
24
143
|
|
|
25
144
|
### LinkedInInsightsOptions
|
|
26
145
|
|
|
27
146
|
|Property|Type|Description|Default|Required|
|
|
28
147
|
|:--|:--|:--|:--|:--:|
|
|
29
|
-
|id|string|Your LinkedIn
|
|
30
|
-
|scriptSrc|string \|undefined|LinkedIn
|
|
148
|
+
|id|string|Your LinkedIn Insight Tag partner ID. LinkedIn shows this in Campaign Manager under Data -> Signals manager -> Insight Tag.|-|✅ Required|
|
|
149
|
+
|scriptSrc|string \|undefined|LinkedIn Insight Tag loader URL.|-|Optional|
|
|
31
150
|
|
|
32
151
|
### Script
|
|
33
152
|
|