@c15t/scripts 2.1.0 → 2.2.0-canary-20260804162155
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/AGENTS.md +62 -0
- package/README.md +32 -20
- package/dist/e2e-test-utils.cjs +51 -10
- package/dist/e2e-test-utils.js +37 -3
- package/dist/engine/compile.cjs +9 -5
- package/dist/engine/runtime.cjs +103 -17
- package/dist/engine/runtime.js +94 -12
- package/dist/registry.cjs +97 -12
- package/dist/registry.js +80 -0
- package/dist/resolve.cjs +9 -5
- package/dist/types.cjs +17 -13
- package/dist/vendors/_shared/attributes.cjs +13 -9
- package/dist/vendors/_shared/google-consent.cjs +14 -9
- package/dist/vendors/_shared/install-builders.cjs +12 -8
- package/dist/vendors/_shared/script-url.cjs +16 -12
- package/dist/vendors/ads-and-pixels/linkedin-insights.cjs +9 -5
- package/dist/vendors/ads-and-pixels/meta-pixel.cjs +13 -9
- package/dist/vendors/ads-and-pixels/microsoft-uet.cjs +11 -7
- package/dist/vendors/ads-and-pixels/reddit-pixel.cjs +9 -5
- package/dist/vendors/ads-and-pixels/snapchat-pixel.cjs +11 -7
- package/dist/vendors/ads-and-pixels/tiktok-pixel.cjs +9 -5
- package/dist/vendors/ads-and-pixels/x-pixel.cjs +9 -5
- package/dist/vendors/analytics/adobe-analytics.cjs +90 -0
- package/dist/vendors/analytics/adobe-analytics.js +49 -0
- package/dist/vendors/analytics/ahrefs-analytics.cjs +11 -7
- package/dist/vendors/analytics/amplitude.cjs +193 -0
- package/dist/vendors/analytics/amplitude.js +134 -0
- package/dist/vendors/analytics/clearbit.cjs +69 -0
- package/dist/vendors/analytics/clearbit.js +28 -0
- package/dist/vendors/analytics/cloudflare-web-analytics.cjs +11 -7
- package/dist/vendors/analytics/databuddy.cjs +11 -7
- package/dist/vendors/analytics/fathom-analytics.cjs +11 -7
- package/dist/vendors/analytics/google-tag.cjs +11 -7
- package/dist/vendors/analytics/heap.cjs +181 -0
- package/dist/vendors/analytics/heap.js +134 -0
- package/dist/vendors/analytics/hightouch.cjs +153 -0
- package/dist/vendors/analytics/hightouch.js +109 -0
- package/dist/vendors/analytics/hotjar.cjs +11 -7
- package/dist/vendors/analytics/logrocket.cjs +99 -0
- package/dist/vendors/analytics/logrocket.js +58 -0
- package/dist/vendors/analytics/matomo-analytics.cjs +9 -5
- package/dist/vendors/analytics/microsoft-clarity.cjs +75 -47
- package/dist/vendors/analytics/microsoft-clarity.js +64 -40
- package/dist/vendors/analytics/mixpanel-analytics.cjs +31 -16
- package/dist/vendors/analytics/mixpanel-analytics.js +22 -11
- package/dist/vendors/analytics/pirsch.cjs +108 -0
- package/dist/vendors/analytics/pirsch.js +67 -0
- package/dist/vendors/analytics/plausible-analytics.cjs +9 -5
- package/dist/vendors/analytics/posthog.cjs +63 -27
- package/dist/vendors/analytics/posthog.js +52 -20
- package/dist/vendors/analytics/promptwatch.cjs +11 -7
- package/dist/vendors/analytics/rudderstack.cjs +227 -0
- package/dist/vendors/analytics/rudderstack.js +183 -0
- package/dist/vendors/analytics/rybbit-analytics.cjs +9 -5
- package/dist/vendors/analytics/segment.cjs +9 -5
- package/dist/vendors/analytics/umami-analytics.cjs +9 -5
- package/dist/vendors/analytics/vercel-analytics.cjs +11 -7
- package/dist/vendors/functional/crisp.cjs +9 -5
- package/dist/vendors/functional/intercom.cjs +11 -7
- package/dist/vendors/tag-managers/google-tag-manager.cjs +11 -7
- package/dist-types/registry.d.ts +313 -241
- package/dist-types/types.d.ts +46 -4
- package/dist-types/vendors/ads-and-pixels/linkedin-insights.d.ts +18 -18
- package/dist-types/vendors/ads-and-pixels/meta-pixel.d.ts +21 -21
- package/dist-types/vendors/ads-and-pixels/microsoft-uet.d.ts +32 -32
- package/dist-types/vendors/ads-and-pixels/reddit-pixel.d.ts +19 -19
- package/dist-types/vendors/ads-and-pixels/snapchat-pixel.d.ts +16 -16
- package/dist-types/vendors/ads-and-pixels/tiktok-pixel.d.ts +28 -28
- package/dist-types/vendors/ads-and-pixels/x-pixel.d.ts +13 -13
- package/dist-types/vendors/analytics/adobe-analytics.d.ts +75 -0
- package/dist-types/vendors/analytics/ahrefs-analytics.d.ts +7 -7
- package/dist-types/vendors/analytics/amplitude.d.ts +234 -0
- package/dist-types/vendors/analytics/clearbit.d.ts +60 -0
- package/dist-types/vendors/analytics/cloudflare-web-analytics.d.ts +7 -7
- package/dist-types/vendors/analytics/databuddy.d.ts +25 -25
- package/dist-types/vendors/analytics/fathom-analytics.d.ts +11 -11
- package/dist-types/vendors/analytics/google-tag.d.ts +17 -17
- package/dist-types/vendors/analytics/heap.d.ts +316 -0
- package/dist-types/vendors/analytics/hightouch.d.ts +285 -0
- package/dist-types/vendors/analytics/hotjar.d.ts +14 -14
- package/dist-types/vendors/analytics/logrocket.d.ts +101 -0
- package/dist-types/vendors/analytics/microsoft-clarity.d.ts +42 -30
- package/dist-types/vendors/analytics/mixpanel-analytics.d.ts +40 -28
- package/dist-types/vendors/analytics/pirsch.d.ts +96 -0
- package/dist-types/vendors/analytics/plausible-analytics.d.ts +13 -13
- package/dist-types/vendors/analytics/posthog.d.ts +63 -45
- package/dist-types/vendors/analytics/promptwatch.d.ts +7 -7
- package/dist-types/vendors/analytics/rudderstack.d.ts +330 -0
- package/dist-types/vendors/analytics/rybbit-analytics.d.ts +18 -18
- package/dist-types/vendors/analytics/segment.d.ts +13 -13
- package/dist-types/vendors/analytics/umami-analytics.d.ts +12 -12
- package/dist-types/vendors/analytics/vercel-analytics.d.ts +16 -16
- package/dist-types/vendors/functional/crisp.d.ts +11 -11
- package/dist-types/vendors/functional/intercom.d.ts +16 -16
- package/dist-types/vendors/tag-managers/google-tag-manager.d.ts +18 -18
- package/docs/README.md +62 -0
- package/docs/frameworks/javascript/script-loader.md +356 -0
- package/docs/frameworks/next/script-loader.md +501 -0
- package/docs/frameworks/react/script-loader.md +555 -0
- package/docs/integrations/adobe-analytics.md +160 -0
- package/docs/integrations/ahrefs-analytics.md +157 -0
- package/docs/integrations/amplitude.md +230 -0
- package/docs/integrations/building-integrations.md +239 -0
- package/docs/integrations/clearbit.md +130 -0
- package/docs/integrations/cloudflare-web-analytics.md +126 -0
- package/docs/integrations/crisp.md +140 -0
- package/docs/integrations/databuddy.md +205 -0
- package/docs/integrations/fathom-analytics.md +150 -0
- package/docs/integrations/google-maps.md +263 -0
- package/docs/integrations/google-tag-manager.md +154 -0
- package/docs/integrations/google-tag.md +134 -0
- package/docs/integrations/heap.md +219 -0
- package/docs/integrations/hightouch.md +199 -0
- package/docs/integrations/hotjar.md +143 -0
- package/docs/integrations/intercom.md +144 -0
- package/docs/integrations/linkedin-insights.md +161 -0
- package/docs/integrations/logrocket.md +175 -0
- package/docs/integrations/matomo-analytics.md +171 -0
- package/docs/integrations/meta-pixel.md +412 -0
- package/docs/integrations/microsoft-clarity.md +173 -0
- package/docs/integrations/microsoft-uet.md +156 -0
- package/docs/integrations/mixpanel-analytics.md +130 -0
- package/docs/integrations/overview.md +149 -0
- package/docs/integrations/pirsch.md +142 -0
- package/docs/integrations/plausible-analytics.md +154 -0
- package/docs/integrations/posthog.md +258 -0
- package/docs/integrations/promptwatch.md +121 -0
- package/docs/integrations/reddit-pixel.md +241 -0
- package/docs/integrations/rudderstack.md +271 -0
- package/docs/integrations/rybbit-analytics.md +143 -0
- package/docs/integrations/segment.md +146 -0
- package/docs/integrations/snapchat-pixel.md +163 -0
- package/docs/integrations/tiktok-pixel.md +123 -0
- package/docs/integrations/umami-analytics.md +148 -0
- package/docs/integrations/vercel-analytics.md +141 -0
- package/docs/integrations/x-pixel.md +157 -0
- package/docs/integrations/youtube.md +193 -0
- package/docs/shared/react/guides/script-loader.md +311 -0
- package/package.json +61 -7
- package/readme.json +8 -4
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Microsoft Clarity
|
|
3
|
+
description: Session replay and behavior analytics with a prebuilt helper that
|
|
4
|
+
keeps Clarity consent synchronized with c15t measurement state.
|
|
5
|
+
group: integrations
|
|
6
|
+
icon: microsoft-clarity
|
|
7
|
+
---
|
|
8
|
+
Microsoft Clarity gives you session recordings, heatmaps, and behavioral insights. The `clarity()` helper sets up Clarity's queue stub, loads the vendor bundle, and keeps Clarity's consent state in sync as c15t measurement consent changes.
|
|
9
|
+
|
|
10
|
+
## Integrate with c15t
|
|
11
|
+
|
|
12
|
+
**React**
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
import { type ReactNode } from 'react';
|
|
16
|
+
import { ConsentManagerProvider } from '@c15t/react';
|
|
17
|
+
import { clarity } from '@c15t/scripts/microsoft-clarity';
|
|
18
|
+
|
|
19
|
+
const scripts = [
|
|
20
|
+
clarity({
|
|
21
|
+
id: 'abcdef1234',
|
|
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 { clarity } from '@c15t/scripts/microsoft-clarity';
|
|
48
|
+
|
|
49
|
+
const scripts = [
|
|
50
|
+
clarity({
|
|
51
|
+
id: 'abcdef1234',
|
|
52
|
+
}),
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
export function ConsentProvider({ children }: { children: ReactNode }) {
|
|
56
|
+
return (
|
|
57
|
+
<ConsentManagerProvider
|
|
58
|
+
options={{
|
|
59
|
+
mode: 'hosted',
|
|
60
|
+
backendURL: '/api/c15t',
|
|
61
|
+
scripts,
|
|
62
|
+
}}
|
|
63
|
+
>
|
|
64
|
+
{children}
|
|
65
|
+
</ConsentManagerProvider>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**JavaScript**
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
import { getOrCreateConsentRuntime } from 'c15t';
|
|
74
|
+
import { clarity } from '@c15t/scripts/microsoft-clarity';
|
|
75
|
+
|
|
76
|
+
getOrCreateConsentRuntime({
|
|
77
|
+
mode: 'hosted',
|
|
78
|
+
backendURL: 'https://your-instance.c15t.dev',
|
|
79
|
+
scripts: [
|
|
80
|
+
clarity({
|
|
81
|
+
id: 'abcdef1234',
|
|
82
|
+
}),
|
|
83
|
+
],
|
|
84
|
+
});
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## How c15t loads it
|
|
88
|
+
|
|
89
|
+
* **Category:** `measurement` (Analytics)
|
|
90
|
+
* **Loads when:** measurement consent is granted
|
|
91
|
+
* **On revocation:** stays loaded (`persistAfterConsentRevoked: true`) and receives `clarity('consent', false)` so Clarity transitions into denied mode without tearing down the script.
|
|
92
|
+
|
|
93
|
+
## Configure the integration
|
|
94
|
+
|
|
95
|
+
You can queue an initial Clarity consent value before the script loads.
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
import { clarity } from '@c15t/scripts/microsoft-clarity';
|
|
99
|
+
|
|
100
|
+
clarity({
|
|
101
|
+
id: 'abcdef1234',
|
|
102
|
+
defaultConsent: false,
|
|
103
|
+
});
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Use an object when you need to map granular consent categories into Clarity's boot-time consent payload:
|
|
107
|
+
|
|
108
|
+
```ts
|
|
109
|
+
clarity({
|
|
110
|
+
id: 'abcdef1234',
|
|
111
|
+
defaultConsent: {
|
|
112
|
+
marketing: false,
|
|
113
|
+
analytics: true,
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
c15t queues that exact `defaultConsent` object during boot. Later consent changes are mapped to simple `true` or `false` values when c15t updates Clarity.
|
|
119
|
+
|
|
120
|
+
## Tracking events in your app
|
|
121
|
+
|
|
122
|
+
c15t gates the Clarity script from loading until `measurement` consent is granted. Your application code that calls Clarity's runtime API (`window.clarity(...)`) is **not** automatically gated - `window.clarity` does not exist until the script is loaded, so unguarded calls before consent throw.
|
|
123
|
+
|
|
124
|
+
Guard event calls by checking consent state. From React:
|
|
125
|
+
|
|
126
|
+
```tsx
|
|
127
|
+
import { useCallback } from 'react';
|
|
128
|
+
import { useConsentManager } from '@c15t/react';
|
|
129
|
+
|
|
130
|
+
function SignupExample() {
|
|
131
|
+
const { has } = useConsentManager();
|
|
132
|
+
|
|
133
|
+
const trackSignup = useCallback(() => {
|
|
134
|
+
if (has('measurement')) {
|
|
135
|
+
window.clarity?.('event', 'signup');
|
|
136
|
+
}
|
|
137
|
+
}, [has]);
|
|
138
|
+
|
|
139
|
+
// Call trackSignup() from an event handler after signup succeeds.
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
From plain JavaScript:
|
|
144
|
+
|
|
145
|
+
```ts
|
|
146
|
+
import { getOrCreateConsentRuntime } from 'c15t';
|
|
147
|
+
|
|
148
|
+
const { consentStore } = getOrCreateConsentRuntime();
|
|
149
|
+
|
|
150
|
+
if (consentStore.getState().has('measurement')) {
|
|
151
|
+
window.clarity?.('event', 'signup');
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Types
|
|
156
|
+
|
|
157
|
+
### ClarityOptions
|
|
158
|
+
|
|
159
|
+
|Property|Value|
|
|
160
|
+
|:--|:--|
|
|
161
|
+
|Type Name|\`ClarityOptions\`|
|
|
162
|
+
|Source Path|\`./packages/scripts/src/vendors/analytics/microsoft-clarity.ts\`|
|
|
163
|
+
|
|
164
|
+
\*ExtractedTypeTable: Could not extract "ClarityOptions" from "./packages/scripts/src/vendors/analytics/microsoft-clarity.ts" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*
|
|
165
|
+
|
|
166
|
+
### Script
|
|
167
|
+
|
|
168
|
+
|Property|Value|
|
|
169
|
+
|:--|:--|
|
|
170
|
+
|Type Name|\`Script\`|
|
|
171
|
+
|Source Path|\`./packages/core/src/libs/script-loader/types.ts\`|
|
|
172
|
+
|
|
173
|
+
\*ExtractedTypeTable: Could not extract "Script" from "./packages/core/src/libs/script-loader/types.ts" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Microsoft UET
|
|
3
|
+
description: Track conversions and measure performance for Microsoft Advertising
|
|
4
|
+
and Bing Ads.
|
|
5
|
+
icon: microsoft
|
|
6
|
+
group: integrations
|
|
7
|
+
---
|
|
8
|
+
Microsoft UET (Universal Event Tracking) is Microsoft's conversion tracking tag
|
|
9
|
+
for Microsoft Advertising. It tracks user actions, measures campaign
|
|
10
|
+
effectiveness, and enables remarketing campaigns.
|
|
11
|
+
|
|
12
|
+
## Official Microsoft documentation
|
|
13
|
+
|
|
14
|
+
* [Universal Event Tracking](https://learn.microsoft.com/en-us/advertising/guides/universal-event-tracking?view=bingads-13)
|
|
15
|
+
* [UET tag data object](https://learn.microsoft.com/en-us/advertising/campaign-management-service/uettag?view=bingads-13)
|
|
16
|
+
* [FAQ: Universal Event Tracking](https://help.ads.microsoft.com/#apex/3/en/53056/2)
|
|
17
|
+
* [FAQ: Remarketing](https://help.ads.microsoft.com/#apex/3/en/56727/1)
|
|
18
|
+
|
|
19
|
+
> 📝 **Note:**
|
|
20
|
+
> UET can also load Microsoft Clarity (if enabled in your UET tag settings). Since Clarity is an analytics tool, we recommend loading it separately with measurement consent instead.
|
|
21
|
+
|
|
22
|
+
## Integrate with c15t
|
|
23
|
+
|
|
24
|
+
**React**
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
import { type ReactNode } from 'react';
|
|
28
|
+
import { ConsentManagerProvider } from '@c15t/react';
|
|
29
|
+
import { microsoftUet } from '@c15t/scripts/microsoft-uet';
|
|
30
|
+
|
|
31
|
+
const scripts = [microsoftUet({ id: '123456789012345' })];
|
|
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
|
+
```
|
|
47
|
+
|
|
48
|
+
**Next.js**
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
'use client';
|
|
52
|
+
|
|
53
|
+
import { type ReactNode } from 'react';
|
|
54
|
+
import { ConsentManagerProvider } from '@c15t/nextjs';
|
|
55
|
+
import { microsoftUet } from '@c15t/scripts/microsoft-uet';
|
|
56
|
+
|
|
57
|
+
const scripts = [microsoftUet({ id: '123456789012345' })];
|
|
58
|
+
|
|
59
|
+
export function ConsentProvider({ children }: { children: ReactNode }) {
|
|
60
|
+
return (
|
|
61
|
+
<ConsentManagerProvider
|
|
62
|
+
options={{
|
|
63
|
+
mode: 'hosted',
|
|
64
|
+
backendURL: '/api/c15t',
|
|
65
|
+
scripts,
|
|
66
|
+
}}
|
|
67
|
+
>
|
|
68
|
+
{children}
|
|
69
|
+
</ConsentManagerProvider>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**JavaScript**
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
import { getOrCreateConsentRuntime } from 'c15t';
|
|
78
|
+
import { microsoftUet } from '@c15t/scripts/microsoft-uet';
|
|
79
|
+
|
|
80
|
+
getOrCreateConsentRuntime({
|
|
81
|
+
mode: 'hosted',
|
|
82
|
+
backendURL: 'https://your-instance.c15t.dev',
|
|
83
|
+
scripts: [microsoftUet({ id: '123456789012345' })],
|
|
84
|
+
});
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## How c15t loads it
|
|
88
|
+
|
|
89
|
+
* **Category:** `marketing` (Ads & Pixels)
|
|
90
|
+
* **Loads when:** immediately, with Microsoft consent mode enabled
|
|
91
|
+
* **Default consent:** c15t pushes `ad_storage: 'denied'` before loading UET unless marketing consent is already granted
|
|
92
|
+
* **On grant/revocation:** c15t pushes the new consent state to `uetq` so UET can switch between granted and denied mode without removing the script
|
|
93
|
+
|
|
94
|
+
Use the UET tag ID as `id`. Microsoft recommends creating one UET tag and
|
|
95
|
+
adding it across your site; that tag can then support conversion goals and
|
|
96
|
+
remarketing lists.
|
|
97
|
+
|
|
98
|
+
## Tracking events in your app
|
|
99
|
+
|
|
100
|
+
c15t loads Microsoft UET in consent mode, so `window.uetq` is created before
|
|
101
|
+
consent is granted. Your own event calls are **not** automatically gated. Guard
|
|
102
|
+
them if you only want to send custom conversion events after marketing consent
|
|
103
|
+
is granted.
|
|
104
|
+
|
|
105
|
+
Microsoft's custom event syntax uses
|
|
106
|
+
`window.uetq.push('event', action, parameters)`. Conversion goals can match page
|
|
107
|
+
visits and custom events, and event payloads can include revenue fields such as
|
|
108
|
+
`revenue_value` and `currency`.
|
|
109
|
+
|
|
110
|
+
```tsx
|
|
111
|
+
import { useCallback } from 'react';
|
|
112
|
+
import { useConsentManager } from '@c15t/react';
|
|
113
|
+
|
|
114
|
+
function useTrackPurchase() {
|
|
115
|
+
const { has } = useConsentManager();
|
|
116
|
+
|
|
117
|
+
return useCallback(() => {
|
|
118
|
+
if (has('marketing')) {
|
|
119
|
+
window.uetq?.push('event', 'purchase', {
|
|
120
|
+
revenue_value: 10,
|
|
121
|
+
currency: 'USD',
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}, [has]);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function CheckoutButton() {
|
|
128
|
+
const trackPurchase = useTrackPurchase();
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
<button type="button" onClick={trackPurchase}>
|
|
132
|
+
Complete purchase
|
|
133
|
+
</button>
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Types
|
|
139
|
+
|
|
140
|
+
### MicrosoftUetOptions
|
|
141
|
+
|
|
142
|
+
|Property|Value|
|
|
143
|
+
|:--|:--|
|
|
144
|
+
|Type Name|\`MicrosoftUetOptions\`|
|
|
145
|
+
|Source Path|\`./packages/scripts/src/vendors/ads-and-pixels/microsoft-uet.ts\`|
|
|
146
|
+
|
|
147
|
+
\*ExtractedTypeTable: Could not extract "MicrosoftUetOptions" from "./packages/scripts/src/vendors/ads-and-pixels/microsoft-uet.ts" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*
|
|
148
|
+
|
|
149
|
+
### Script
|
|
150
|
+
|
|
151
|
+
|Property|Value|
|
|
152
|
+
|:--|:--|
|
|
153
|
+
|Type Name|\`Script\`|
|
|
154
|
+
|Source Path|\`./packages/core/src/libs/script-loader/types.ts\`|
|
|
155
|
+
|
|
156
|
+
\*ExtractedTypeTable: Could not extract "Script" from "./packages/core/src/libs/script-loader/types.ts" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Mixpanel Analytics
|
|
3
|
+
description: Load Mixpanel with c15t and let Mixpanel's own opt-in and opt-out
|
|
4
|
+
APIs follow measurement consent.
|
|
5
|
+
group: integrations
|
|
6
|
+
icon: mixpanel
|
|
7
|
+
---
|
|
8
|
+
Mixpanel helps you track product usage, funnels, and retention. The `mixpanelAnalytics()` helper always loads the Mixpanel library, initializes it after the bundle is ready, and uses Mixpanel's own `opt_in_tracking()` and `opt_out_tracking()` methods to keep tracking aligned with `measurement` consent.
|
|
9
|
+
|
|
10
|
+
## Integrate with c15t
|
|
11
|
+
|
|
12
|
+
**React**
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
import { type ReactNode } from 'react';
|
|
16
|
+
import { ConsentManagerProvider } from '@c15t/react';
|
|
17
|
+
import { mixpanelAnalytics } from '@c15t/scripts/mixpanel-analytics';
|
|
18
|
+
|
|
19
|
+
const scripts = [
|
|
20
|
+
mixpanelAnalytics({
|
|
21
|
+
token: '1234567890abcdef1234567890abcdef',
|
|
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 { mixpanelAnalytics } from '@c15t/scripts/mixpanel-analytics';
|
|
48
|
+
|
|
49
|
+
const scripts = [
|
|
50
|
+
mixpanelAnalytics({
|
|
51
|
+
token: '1234567890abcdef1234567890abcdef',
|
|
52
|
+
}),
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
export function ConsentProvider({ children }: { children: ReactNode }) {
|
|
56
|
+
return (
|
|
57
|
+
<ConsentManagerProvider
|
|
58
|
+
options={{
|
|
59
|
+
mode: 'hosted',
|
|
60
|
+
backendURL: '/api/c15t',
|
|
61
|
+
scripts,
|
|
62
|
+
}}
|
|
63
|
+
>
|
|
64
|
+
{children}
|
|
65
|
+
</ConsentManagerProvider>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**JavaScript**
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
import { getOrCreateConsentRuntime } from 'c15t';
|
|
74
|
+
import { mixpanelAnalytics } from '@c15t/scripts/mixpanel-analytics';
|
|
75
|
+
|
|
76
|
+
getOrCreateConsentRuntime({
|
|
77
|
+
mode: 'hosted',
|
|
78
|
+
backendURL: 'https://your-instance.c15t.dev',
|
|
79
|
+
scripts: [
|
|
80
|
+
mixpanelAnalytics({
|
|
81
|
+
token: '1234567890abcdef1234567890abcdef',
|
|
82
|
+
}),
|
|
83
|
+
],
|
|
84
|
+
});
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## How c15t loads it
|
|
88
|
+
|
|
89
|
+
* **Category:** `measurement` (Analytics)
|
|
90
|
+
* **Loads when:** immediately (`alwaysLoad: true`)
|
|
91
|
+
* **Consent behavior:** c15t keeps the SDK loaded and toggles tracking by calling Mixpanel's opt-in and opt-out APIs when consent changes.
|
|
92
|
+
|
|
93
|
+
## Configure the integration
|
|
94
|
+
|
|
95
|
+
You can pass serializable init options through to `mixpanel.init(...)`.
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
import { mixpanelAnalytics } from '@c15t/scripts/mixpanel-analytics';
|
|
99
|
+
|
|
100
|
+
mixpanelAnalytics({
|
|
101
|
+
token: '1234567890abcdef1234567890abcdef',
|
|
102
|
+
initOptions: {
|
|
103
|
+
debug: true,
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Tracking events in your app
|
|
109
|
+
|
|
110
|
+
Because Mixpanel is configured with `alwaysLoad: true`, `window.mixpanel` is available as soon as the script loads, even before `measurement` consent is granted. You can still call `window.mixpanel.track(...)` from app code; consent suppression is handled by Mixpanel's opt-in/opt-out methods that c15t triggers on consent updates.
|
|
111
|
+
|
|
112
|
+
## Types
|
|
113
|
+
|
|
114
|
+
### MixpanelAnalyticsOptions
|
|
115
|
+
|
|
116
|
+
|Property|Value|
|
|
117
|
+
|:--|:--|
|
|
118
|
+
|Type Name|\`MixpanelAnalyticsOptions\`|
|
|
119
|
+
|Source Path|\`./packages/scripts/src/vendors/analytics/mixpanel-analytics.ts\`|
|
|
120
|
+
|
|
121
|
+
\*ExtractedTypeTable: Could not extract "MixpanelAnalyticsOptions" from "./packages/scripts/src/vendors/analytics/mixpanel-analytics.ts" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*
|
|
122
|
+
|
|
123
|
+
### Script
|
|
124
|
+
|
|
125
|
+
|Property|Value|
|
|
126
|
+
|:--|:--|
|
|
127
|
+
|Type Name|\`Script\`|
|
|
128
|
+
|Source Path|\`./packages/core/src/libs/script-loader/types.ts\`|
|
|
129
|
+
|
|
130
|
+
\*ExtractedTypeTable: Could not extract "Script" from "./packages/core/src/libs/script-loader/types.ts" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Integrations
|
|
3
|
+
description: Load analytics, pixels, tag managers, and widgets through c15t so
|
|
4
|
+
consent state controls when they run, update, and appear in your consent UI.
|
|
5
|
+
group: integrations
|
|
6
|
+
---
|
|
7
|
+
Third-party tools are easy to paste into app code, but consent makes them part
|
|
8
|
+
of your privacy runtime. Analytics SDKs, ad pixels, tag managers, and chat
|
|
9
|
+
widgets can load remote code, store identifiers, send events, and keep running
|
|
10
|
+
after the first page view.
|
|
11
|
+
|
|
12
|
+
> ℹ️ **Info:**
|
|
13
|
+
> Put consent-sensitive vendor tools in c15t instead of scattering script tags across your codebase. c15t becomes the place that decides when they can load, when they must stop, and which consent categories your UI needs to show.
|
|
14
|
+
|
|
15
|
+
## Why Manage Tools In c15t
|
|
16
|
+
|
|
17
|
+
When you install a vendor directly in your app, your consent logic has to chase
|
|
18
|
+
that vendor everywhere it appears: page layouts, route handlers, event helpers,
|
|
19
|
+
tag-manager snippets, and cleanup code.
|
|
20
|
+
|
|
21
|
+
Register the vendor with c15t instead. The integration becomes a declarative
|
|
22
|
+
`Script` that the consent runtime can reason about:
|
|
23
|
+
|
|
24
|
+
* c15t registers the tool with the runtime and evaluates it against the current
|
|
25
|
+
consent state;
|
|
26
|
+
* c15t automatically adds the tool's consent category to the active categories,
|
|
27
|
+
so GDPR-style consent UIs include `measurement`, `marketing`, or
|
|
28
|
+
`functionality` when an enabled integration needs them;
|
|
29
|
+
* c15t blocks the script until consent is granted, or loads it with denied
|
|
30
|
+
defaults when the vendor has its own consent mode;
|
|
31
|
+
* c15t handles revocation by unloading the script or calling the vendor's
|
|
32
|
+
consent API;
|
|
33
|
+
* c15t runs vendor setup in the right order, including queue stubs, global
|
|
34
|
+
functions, data attributes, default page-view events, and consent updates.
|
|
35
|
+
|
|
36
|
+
That gives your app one consent lifecycle instead of many scattered vendor
|
|
37
|
+
lifecycles.
|
|
38
|
+
|
|
39
|
+
## Built-In Helpers
|
|
40
|
+
|
|
41
|
+
c15t ships prebuilt script helpers in
|
|
42
|
+
[`@c15t/scripts`](https://www.npmjs.com/package/@c15t/scripts) for the
|
|
43
|
+
third-party tools developers integrate most often. Prefer them over copied
|
|
44
|
+
vendor snippets whenever c15t already supports the vendor.
|
|
45
|
+
|
|
46
|
+
Every helper returns a regular `Script` object, so it works anywhere the c15t
|
|
47
|
+
[script loader](/docs/frameworks/javascript/script-loader) accepts scripts. You
|
|
48
|
+
usually choose the helper, provide the vendor ID, and pass the result to your
|
|
49
|
+
provider's `scripts` option. The vendor page explains anything else that still
|
|
50
|
+
matters, such as custom events, region settings, privacy modes, or ecommerce
|
|
51
|
+
payloads.
|
|
52
|
+
|
|
53
|
+
## Choose An Integration Style
|
|
54
|
+
|
|
55
|
+
Most apps mix more than one style. Pick the smallest one that keeps consent behavior obvious.
|
|
56
|
+
|
|
57
|
+
|Style|Use when|
|
|
58
|
+
|--|--|
|
|
59
|
+
|**Built-in helper** from `@c15t/scripts`|The vendor is listed below — start here.|
|
|
60
|
+
|**Plain `Script`**|One-off app code with simple load and callback behavior.|
|
|
61
|
+
|**Manifest-backed helper**|Reusable vendor integration with structured setup phases, queues, stubs, or a vendor consent API.|
|
|
62
|
+
|**Iframe / renderable integration**|Vendor exposes an iframe or React component, not just a script tag.|
|
|
63
|
+
|
|
64
|
+
Setup is the same shape in every framework: import the helper, call it with vendor options, and pass the result to the consent runtime through your provider's `scripts` option. See the framework guides for end-to-end snippets — [JavaScript](/docs/frameworks/javascript/script-loader), [React](/docs/frameworks/react/script-loader), [Next.js](/docs/frameworks/next/script-loader).
|
|
65
|
+
|
|
66
|
+
## Renderable Integrations
|
|
67
|
+
|
|
68
|
+
Maps and video embeds need a visible component as well as consent-aware loading.
|
|
69
|
+
The React and Next.js packages include components that own the placeholder,
|
|
70
|
+
vendor loading, and rendered surface. They are imported from the framework
|
|
71
|
+
package rather than `@c15t/scripts`.
|
|
72
|
+
|
|
73
|
+
* [Google Maps](/docs/integrations/google-maps)
|
|
74
|
+
* [YouTube](/docs/integrations/youtube)
|
|
75
|
+
|
|
76
|
+
## Analytics
|
|
77
|
+
|
|
78
|
+
Analytics integrations usually require `measurement` consent. Some vendors can run in a consent-aware or cookieless mode; others should stay fully blocked until measurement consent is granted.
|
|
79
|
+
|
|
80
|
+
* [Google Tag (gtag.js)](/docs/integrations/google-tag)
|
|
81
|
+
* [Ahrefs Analytics](/docs/integrations/ahrefs-analytics)
|
|
82
|
+
* [Adobe Analytics](/docs/integrations/adobe-analytics)
|
|
83
|
+
* [Amplitude](/docs/integrations/amplitude)
|
|
84
|
+
* [Cloudflare Web Analytics](/docs/integrations/cloudflare-web-analytics)
|
|
85
|
+
* [Clearbit](/docs/integrations/clearbit)
|
|
86
|
+
* [Microsoft Clarity](/docs/integrations/microsoft-clarity)
|
|
87
|
+
* [Databuddy](/docs/integrations/databuddy)
|
|
88
|
+
* [Rybbit Analytics](/docs/integrations/rybbit-analytics)
|
|
89
|
+
* [Fathom Analytics](/docs/integrations/fathom-analytics)
|
|
90
|
+
* [Heap](/docs/integrations/heap)
|
|
91
|
+
* [Mixpanel Analytics](/docs/integrations/mixpanel-analytics)
|
|
92
|
+
* [Hotjar](/docs/integrations/hotjar)
|
|
93
|
+
* [Hightouch](/docs/integrations/hightouch)
|
|
94
|
+
* [LogRocket](/docs/integrations/logrocket)
|
|
95
|
+
* [Matomo Analytics](/docs/integrations/matomo-analytics)
|
|
96
|
+
* [PostHog](/docs/integrations/posthog)
|
|
97
|
+
* [Promptwatch](/docs/integrations/promptwatch)
|
|
98
|
+
* [Pirsch](/docs/integrations/pirsch)
|
|
99
|
+
* [RudderStack](/docs/integrations/rudderstack)
|
|
100
|
+
* [Segment](/docs/integrations/segment)
|
|
101
|
+
* [Plausible Analytics](/docs/integrations/plausible-analytics)
|
|
102
|
+
* [Umami Analytics](/docs/integrations/umami-analytics)
|
|
103
|
+
* [Vercel Analytics](/docs/integrations/vercel-analytics)
|
|
104
|
+
|
|
105
|
+
## Functional
|
|
106
|
+
|
|
107
|
+
Functional integrations usually require `functionality` consent. They add optional user-facing capabilities, such as chat widgets, that should only run after the user allows them.
|
|
108
|
+
|
|
109
|
+
* [Crisp](/docs/integrations/crisp)
|
|
110
|
+
* [Intercom](/docs/integrations/intercom)
|
|
111
|
+
|
|
112
|
+
## Ads & Pixels
|
|
113
|
+
|
|
114
|
+
Advertising pixels usually require `marketing` consent. Many of them need startup stubs so events can be queued safely before the remote SDK loads — built-in helpers handle this for you.
|
|
115
|
+
|
|
116
|
+
* [Meta Pixel](/docs/integrations/meta-pixel)
|
|
117
|
+
* [Snapchat Pixel](/docs/integrations/snapchat-pixel)
|
|
118
|
+
* [Reddit Pixel](/docs/integrations/reddit-pixel)
|
|
119
|
+
* [TikTok Pixel](/docs/integrations/tiktok-pixel)
|
|
120
|
+
* [LinkedIn Insight Tag](/docs/integrations/linkedin-insights)
|
|
121
|
+
* [Microsoft UET](/docs/integrations/microsoft-uet)
|
|
122
|
+
* [X (Twitter) Pixel](/docs/integrations/x-pixel)
|
|
123
|
+
|
|
124
|
+
## Tag Managers
|
|
125
|
+
|
|
126
|
+
Tag managers can load other scripts, so they deserve extra care. Prefer vendor consent modes and denied defaults before any tags are allowed to run.
|
|
127
|
+
|
|
128
|
+
* [Google Tag Manager](/docs/integrations/google-tag-manager)
|
|
129
|
+
|
|
130
|
+
## Build Your Own
|
|
131
|
+
|
|
132
|
+
If c15t does not ship the vendor you need, drop down a level:
|
|
133
|
+
|
|
134
|
+
* build a one-off `Script` directly in your app for simple cases,
|
|
135
|
+
* build a reusable manifest-backed helper for shared or package-level integrations,
|
|
136
|
+
* or combine the script loader with iframe gating for visible media and widget integrations.
|
|
137
|
+
|
|
138
|
+
### Build a Custom Integration
|
|
139
|
+
|
|
140
|
+
Learn when to use a raw `Script`, when to use a manifest, and how to debug and test custom integrations.
|
|
141
|
+
|
|
142
|
+
[Read the guide →](/docs/integrations/building-integrations)
|
|
143
|
+
|
|
144
|
+
## Where To Next
|
|
145
|
+
|
|
146
|
+
* Read the script loader guide for your framework: [JavaScript](/docs/frameworks/javascript/script-loader), [React](/docs/frameworks/react/script-loader), [Next.js](/docs/frameworks/next/script-loader).
|
|
147
|
+
* Use the [Google Maps](/docs/integrations/google-maps) and [YouTube](/docs/integrations/youtube) components for built-in renderable integrations.
|
|
148
|
+
* See the [iframe blocking](/docs/frameworks/react/iframe-blocking) pattern for other visible embeds such as calendars and social widgets.
|
|
149
|
+
* Use [`has()`](/docs/frameworks/javascript/api/checking-consent) to conditionally run app code based on consent state.
|