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
@@ -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: 2025-09-24
5
-
4
+ lastModified: 2026-05-11
6
5
  icon: linkedin
7
6
  ---
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.
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
- ## Adding the LinkedIn Insights Tag to c15t
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
- > ℹ️ **Info:**
13
- > See the integration overview for how to pass scripts to your framework (JavaScript, React, or Next.js).
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
- linkedinInsights({
19
- id: '123456789012345',
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 Insights ID|-|✅ Required|
30
- |scriptSrc|string \|undefined|LinkedIn Insights loader URL.|-|Optional|
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
 
@@ -0,0 +1,246 @@
1
+ ---
2
+ title: Matomo Analytics
3
+ description: Load Matomo with c15t and keep Matomo's queue aligned with measurement consent.
4
+ lastModified: 2026-05-10
5
+ icon: matomo
6
+ ---
7
+ Matomo gives you privacy-focused web analytics with self-hosted and cloud deployment options. The `matomoAnalytics()` helper sets up Matomo's `_paq` queue, points it at your tracker, and can queue consent-aware commands before the vendor bundle loads.
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 { matomoAnalytics } from '@c15t/scripts/matomo-analytics';
17
+
18
+ const scripts = [
19
+ matomoAnalytics({
20
+ matomoUrl: 'https://analytics.example.com',
21
+ siteId: 1,
22
+ }),
23
+ ];
24
+
25
+ export function ConsentProvider({ children }: { children: ReactNode }) {
26
+ return (
27
+ <ConsentManagerProvider
28
+ options={{
29
+ mode: 'hosted',
30
+ backendURL: 'https://your-instance.c15t.dev',
31
+ scripts,
32
+ }}
33
+ >
34
+ {children}
35
+ </ConsentManagerProvider>
36
+ );
37
+ }
38
+ ```
39
+
40
+ **Next.js**
41
+
42
+ ```tsx
43
+ 'use client';
44
+
45
+ import { type ReactNode } from 'react';
46
+ import { ConsentManagerProvider } from '@c15t/nextjs';
47
+ import { matomoAnalytics } from '@c15t/scripts/matomo-analytics';
48
+
49
+ const scripts = [
50
+ matomoAnalytics({
51
+ matomoUrl: 'https://analytics.example.com',
52
+ siteId: 1,
53
+ }),
54
+ ];
55
+
56
+ export function ConsentProvider({ children }: { children: ReactNode }) {
57
+ return (
58
+ <ConsentManagerProvider
59
+ options={{
60
+ mode: 'hosted',
61
+ backendURL: '/api/c15t',
62
+ scripts,
63
+ }}
64
+ >
65
+ {children}
66
+ </ConsentManagerProvider>
67
+ );
68
+ }
69
+ ```
70
+
71
+ **JavaScript**
72
+
73
+ ```ts
74
+ import { getOrCreateConsentRuntime } from 'c15t';
75
+ import { matomoAnalytics } from '@c15t/scripts/matomo-analytics';
76
+
77
+ getOrCreateConsentRuntime({
78
+ mode: 'hosted',
79
+ backendURL: 'https://your-instance.c15t.dev',
80
+ scripts: [
81
+ matomoAnalytics({
82
+ matomoUrl: 'https://analytics.example.com',
83
+ siteId: 1,
84
+ }),
85
+ ],
86
+ });
87
+ ```
88
+
89
+ ## How c15t loads it
90
+
91
+ * **Category:** `measurement` (Analytics)
92
+ * **Loads when:** measurement consent is granted by default
93
+ * **Consent mode option:** with `defaultConsent`, the helper switches to `alwaysLoad: true` and uses Matomo queue commands to grant/forget consent without unloading the SDK.
94
+
95
+ ## Configure the integration
96
+
97
+ If you want Matomo to manage consent internally, set `defaultConsent` to one
98
+ of these values:
99
+
100
+ * `'required'` queues Matomo's `requireConsent` command so no tracking runs
101
+ until consent is granted.
102
+ * `'given'` queues Matomo's `setConsentGiven` command so tracking starts as
103
+ granted by default.
104
+
105
+ When `defaultConsent` is omitted, c15t uses the standard script-loader flow:
106
+ Matomo only loads after `measurement` consent is granted.
107
+
108
+ ```ts
109
+ import { matomoAnalytics } from '@c15t/scripts/matomo-analytics';
110
+
111
+ matomoAnalytics({
112
+ matomoUrl: 'https://analytics.example.com',
113
+ siteId: 1,
114
+ defaultConsent: 'required',
115
+ });
116
+ ```
117
+
118
+ ## Tracking events in your app
119
+
120
+ Matomo's runtime API is queue-based (`window._paq`). When the script is not loaded yet, pushing to `_paq` is still safe as long as the queue exists. The helper creates `_paq` during setup.
121
+
122
+ From React:
123
+
124
+ ```tsx
125
+ import { useCallback } from 'react';
126
+ import { useConsentManager } from '@c15t/react';
127
+
128
+ function SignupExample() {
129
+ const { has } = useConsentManager();
130
+
131
+ const trackSignup = useCallback(() => {
132
+ if (has('measurement')) {
133
+ window._paq?.push(['trackEvent', 'signup', 'completed']);
134
+ }
135
+ }, [has]);
136
+
137
+ return <button onClick={trackSignup}>Sign up</button>;
138
+ }
139
+ ```
140
+
141
+ From plain JavaScript:
142
+
143
+ ```ts
144
+ import { getOrCreateConsentRuntime } from 'c15t';
145
+
146
+ const { consentStore } = getOrCreateConsentRuntime();
147
+
148
+ if (consentStore.getState().has('measurement')) {
149
+ window._paq?.push(['trackEvent', 'signup', 'completed']);
150
+ }
151
+ ```
152
+
153
+ ## Types
154
+
155
+ ### MatomoAnalyticsOptions
156
+
157
+ |Property|Type|Description|Default|Required|
158
+ |:--|:--|:--|:--|:--:|
159
+ |siteId|string \|number \|undefined|Your Matomo site ID.|-|Optional|
160
+ |matomoUrl|string \|undefined|Your Matomo base URL, for example \`https\://analytics.example.com\`.|-|Optional|
161
+ |cloudId|string \|undefined|Your Matomo Cloud identifier, for example \`my-site.matomo.cloud\`.|-|Optional|
162
+ |trackerUrl|string \|undefined|Optional explicit tracker endpoint override.|-|Optional|
163
+ |scriptUrl|string \|undefined|Optional explicit script URL override.|-|Optional|
164
+ |enableLinkTracking|boolean \|undefined|Queue \`enableLinkTracking\`.|-|Optional|
165
+ |disableCookies|boolean \|undefined|Queue \`disableCookies\`.|-|Optional|
166
+ |trackPageView|boolean \|undefined|Queue an initial \`trackPageView\`.|-|Optional|
167
+ |defaultConsent|"required" \|"given" \|undefined|Default Matomo consent state (\`required\` blocks, \`given\` starts enabled).|-|Optional|
168
+
169
+ ### Script
170
+
171
+ |Property|Type|Description|Default|Required|
172
+ |:--|:--|:--|:--|:--:|
173
+ |id|string|Unique identifier for the script|-|✅ Required|
174
+ |src|string \|undefined|URL of the script to load|-|Optional|
175
+ |textContent|string \|undefined|Inline JavaScript code to execute|-|Optional|
176
+ |category|HasCondition\<AllConsentNames>|Consent category or condition required to load this script|-|✅ Required|
177
+ |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|
178
+ |persistAfterConsentRevoked|boolean \|undefined|Whether the script should persist after consent is revoked.|false|Optional|
179
+ |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|
180
+ |fetchPriority|"high" \|"low" \|"auto" \|undefined|Priority hint for browser resource loading|-|Optional|
181
+ |attributes|Record\<string, string> \|undefined|Additional attributes to add to the script element|-|Optional|
182
+ |async|boolean \|undefined|Whether to use async loading|-|Optional|
183
+ |defer|boolean \|undefined|Whether to defer script loading|-|Optional|
184
+ |nonce|string \|undefined|Content Security Policy nonce|-|Optional|
185
+ |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|
186
+ |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|
187
+ |onBeforeLoad|Object \|undefined|Callback executed before the script is loaded|-|Optional|
188
+ |onLoad|Object \|undefined|Callback executed when the script loads successfully|-|Optional|
189
+ |onError|Object \|undefined|Callback executed if the script fails to load|-|Optional|
190
+ |onConsentChange|Object \|undefined|Callback executed whenever the consent store is changed. This callback only applies to scripts already loaded.|-|Optional|
191
+ |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|
192
+ |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|
193
+ |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|
194
+ |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|
195
+
196
+ #### `onBeforeLoad`
197
+
198
+ Callback executed before the script is loaded
199
+
200
+ |Property|Type|Description|Default|Required|
201
+ |:--|:--|:--|:--|:--:|
202
+ |id|string|The original script ID|-|✅ Required|
203
+ |elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
204
+ |hasConsent|boolean|Has consent|-|✅ Required|
205
+ |consents|ConsentState|The current consent state|-|✅ Required|
206
+ |element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
207
+ |error|Error \|undefined|Error information (for error callbacks)|-|Optional|
208
+
209
+ #### `onLoad`
210
+
211
+ Callback executed when the script loads successfully
212
+
213
+ |Property|Type|Description|Default|Required|
214
+ |:--|:--|:--|:--|:--:|
215
+ |id|string|The original script ID|-|✅ Required|
216
+ |elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
217
+ |hasConsent|boolean|Has consent|-|✅ Required|
218
+ |consents|ConsentState|The current consent state|-|✅ Required|
219
+ |element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
220
+ |error|Error \|undefined|Error information (for error callbacks)|-|Optional|
221
+
222
+ #### `onError`
223
+
224
+ Callback executed if the script fails to load
225
+
226
+ |Property|Type|Description|Default|Required|
227
+ |:--|:--|:--|:--|:--:|
228
+ |id|string|The original script ID|-|✅ Required|
229
+ |elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
230
+ |hasConsent|boolean|Has consent|-|✅ Required|
231
+ |consents|ConsentState|The current consent state|-|✅ Required|
232
+ |element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
233
+ |error|Error \|undefined|Error information (for error callbacks)|-|Optional|
234
+
235
+ #### `onConsentChange`
236
+
237
+ Callback executed whenever the consent store is changed. This callback only applies to scripts already loaded.
238
+
239
+ |Property|Type|Description|Default|Required|
240
+ |:--|:--|:--|:--|:--:|
241
+ |id|string|The original script ID|-|✅ Required|
242
+ |elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
243
+ |hasConsent|boolean|Has consent|-|✅ Required|
244
+ |consents|ConsentState|The current consent state|-|✅ Required|
245
+ |element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
246
+ |error|Error \|undefined|Error information (for error callbacks)|-|Optional|