@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
|
@@ -17,18 +17,18 @@ declare global {
|
|
|
17
17
|
* and unloaded when consent is revoked.
|
|
18
18
|
*/
|
|
19
19
|
export declare const ahrefsAnalyticsManifest: {
|
|
20
|
-
readonly
|
|
21
|
-
readonly
|
|
20
|
+
readonly kind: "c15t.vendor-manifest";
|
|
21
|
+
readonly schemaVersion: 1;
|
|
22
|
+
readonly vendor: 'ahrefs-analytics';
|
|
23
|
+
readonly category: 'measurement';
|
|
22
24
|
readonly install: [{
|
|
23
|
-
readonly type:
|
|
24
|
-
readonly src:
|
|
25
|
+
readonly type: 'loadScript';
|
|
26
|
+
readonly src: '{{scriptUrl}}';
|
|
25
27
|
readonly async: true;
|
|
26
28
|
readonly attributes: {
|
|
27
|
-
readonly 'data-key':
|
|
29
|
+
readonly 'data-key': '{{key}}';
|
|
28
30
|
};
|
|
29
31
|
}];
|
|
30
|
-
readonly kind: "c15t.vendor-manifest";
|
|
31
|
-
readonly schemaVersion: 1;
|
|
32
32
|
};
|
|
33
33
|
export interface AhrefsAnalyticsOptions {
|
|
34
34
|
/**
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import type { Script } from 'c15t';
|
|
2
|
+
/**
|
|
3
|
+
* Browser SDK 2 version used by the default Amplitude CDN loader URL.
|
|
4
|
+
*
|
|
5
|
+
* The Amplitude Browser SDK 2 public bundle path is versioned. A
|
|
6
|
+
* `analytics-browser-latest-min.js.gz` path is not publicly available, so c15t
|
|
7
|
+
* pins a known Browser SDK 2 version by default and lets callers override the
|
|
8
|
+
* loader through `scriptUrl`.
|
|
9
|
+
*/
|
|
10
|
+
export declare const DEFAULT_AMPLITUDE_BROWSER_SDK_VERSION = "2.44.4";
|
|
11
|
+
/**
|
|
12
|
+
* Default Amplitude Browser SDK 2 loader URL.
|
|
13
|
+
*/
|
|
14
|
+
export declare const DEFAULT_AMPLITUDE_SCRIPT_URL = "https://cdn.amplitude.com/libs/analytics-browser-2.44.4-min.js.gz";
|
|
15
|
+
/**
|
|
16
|
+
* Core Amplitude Browser SDK 2 methods queued before the real SDK loads.
|
|
17
|
+
*
|
|
18
|
+
* These methods use Amplitude's Browser SDK 2 snippet queue contract:
|
|
19
|
+
* `window.amplitude._q` receives `{ name, args, resolve }` records, and the
|
|
20
|
+
* loaded SDK drains that queue when `window.amplitude.invoked` is true.
|
|
21
|
+
*/
|
|
22
|
+
export declare const AMPLITUDE_PROMISE_QUEUE_METHODS: readonly ['init', 'track', 'identify', 'flush'];
|
|
23
|
+
/**
|
|
24
|
+
* Queue methods Amplitude's snippet treats as synchronous — they queue the
|
|
25
|
+
* call but return nothing.
|
|
26
|
+
*/
|
|
27
|
+
export declare const AMPLITUDE_SYNC_QUEUE_METHODS: readonly ['setUserId', 'setOptOut'];
|
|
28
|
+
export declare const AMPLITUDE_QUEUE_METHODS: readonly ["init", "track", "identify", "flush", "setUserId", "setOptOut"];
|
|
29
|
+
/**
|
|
30
|
+
* Amplitude Identify helper methods queued before the real SDK loads.
|
|
31
|
+
*/
|
|
32
|
+
export declare const AMPLITUDE_IDENTIFY_METHODS: readonly ['set', 'setOnce', 'add', 'append', 'prepend', 'preInsert', 'postInsert', 'remove', 'unset', 'clearAll', 'getUserProperties'];
|
|
33
|
+
/**
|
|
34
|
+
* Queue entry consumed by Amplitude Browser SDK 2 at load time.
|
|
35
|
+
*/
|
|
36
|
+
export interface AmplitudeQueueEntry {
|
|
37
|
+
/** Name of the Amplitude method to invoke after the SDK loads. */
|
|
38
|
+
name: (typeof AMPLITUDE_QUEUE_METHODS)[number];
|
|
39
|
+
/** Arguments originally passed to the queued method. */
|
|
40
|
+
args: unknown[];
|
|
41
|
+
/** Promise resolver called by the SDK after the queued method runs. */
|
|
42
|
+
resolve: (value: unknown) => void;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Queue entry stored by an Amplitude Identify helper created before load.
|
|
46
|
+
*/
|
|
47
|
+
export interface AmplitudeIdentifyQueueEntry {
|
|
48
|
+
/** Identify helper method to replay after the SDK loads. */
|
|
49
|
+
name: (typeof AMPLITUDE_IDENTIFY_METHODS)[number];
|
|
50
|
+
/** Arguments originally passed to the helper method. */
|
|
51
|
+
args: unknown[];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Pre-load Amplitude Identify helper.
|
|
55
|
+
*/
|
|
56
|
+
export interface AmplitudeIdentify {
|
|
57
|
+
/** Queued Identify helper operations. */
|
|
58
|
+
_q?: AmplitudeIdentifyQueueEntry[];
|
|
59
|
+
/** Queue a `$set` identify operation. */
|
|
60
|
+
set: (property: string, value: unknown) => this;
|
|
61
|
+
/** Queue a `$setOnce` identify operation. */
|
|
62
|
+
setOnce: (property: string, value: unknown) => this;
|
|
63
|
+
/** Queue an `$add` identify operation. */
|
|
64
|
+
add: (property: string, value: number) => this;
|
|
65
|
+
/** Queue an `$append` identify operation. */
|
|
66
|
+
append: (property: string, value: unknown) => this;
|
|
67
|
+
/** Queue a `$prepend` identify operation. */
|
|
68
|
+
prepend: (property: string, value: unknown) => this;
|
|
69
|
+
/** Queue a `$preInsert` identify operation. */
|
|
70
|
+
preInsert: (property: string, value: unknown) => this;
|
|
71
|
+
/** Queue a `$postInsert` identify operation. */
|
|
72
|
+
postInsert: (property: string, value: unknown) => this;
|
|
73
|
+
/** Queue a `$remove` identify operation. */
|
|
74
|
+
remove: (property: string, value: unknown) => this;
|
|
75
|
+
/** Queue an `$unset` identify operation. */
|
|
76
|
+
unset: (property: string) => this;
|
|
77
|
+
/** Queue a `$clearAll` identify operation. */
|
|
78
|
+
clearAll: () => this;
|
|
79
|
+
/** Queue a read of the accumulated user property operations. */
|
|
80
|
+
getUserProperties: () => this;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Minimal public Amplitude Browser SDK 2 API exposed on `window.amplitude`.
|
|
84
|
+
*
|
|
85
|
+
* The real SDK replaces the pre-load stub with these methods after the loader
|
|
86
|
+
* executes. Calls made before load return promises that resolve once the SDK
|
|
87
|
+
* replays them.
|
|
88
|
+
*/
|
|
89
|
+
export interface AmplitudeApi {
|
|
90
|
+
/** Amplitude Browser SDK 2 pre-load queue. */
|
|
91
|
+
_q?: AmplitudeQueueEntry[];
|
|
92
|
+
/** Named-instance queue registry used by the official snippet contract. */
|
|
93
|
+
_iq?: Record<string, unknown>;
|
|
94
|
+
/** Marker that tells the SDK to replay snippet-queued calls. */
|
|
95
|
+
invoked?: boolean;
|
|
96
|
+
/** Pre-load Identify helper constructor. */
|
|
97
|
+
Identify?: new () => AmplitudeIdentify;
|
|
98
|
+
/** Initialize the default Amplitude instance. */
|
|
99
|
+
init: (apiKey: string, options?: Record<string, unknown>) => Promise<unknown> | unknown;
|
|
100
|
+
/** Track an event with optional event properties. */
|
|
101
|
+
track: (eventInput: string | Record<string, unknown>, eventProperties?: Record<string, unknown>) => Promise<unknown> | unknown;
|
|
102
|
+
/** Send an identify call. */
|
|
103
|
+
identify: (identifyPayload: AmplitudeIdentify, eventOptions?: Record<string, unknown>) => Promise<unknown> | unknown;
|
|
104
|
+
/** Set the current user identifier. */
|
|
105
|
+
setUserId: (userId: string | undefined) => Promise<unknown> | unknown;
|
|
106
|
+
/** Toggle runtime opt-out. */
|
|
107
|
+
setOptOut: (optOut: boolean) => Promise<unknown> | unknown;
|
|
108
|
+
/** Flush pending events. */
|
|
109
|
+
flush: () => Promise<unknown> | unknown;
|
|
110
|
+
}
|
|
111
|
+
declare global {
|
|
112
|
+
interface Window {
|
|
113
|
+
amplitude?: AmplitudeApi;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Amplitude vendor manifest.
|
|
118
|
+
*
|
|
119
|
+
* Implements the essential Browser SDK 2 script-loader contract with
|
|
120
|
+
* `window.amplitude.invoked`, an `_q` method-call queue, and an `_iq` registry
|
|
121
|
+
* for named instances. It also defines the `Identify` queued helper used by
|
|
122
|
+
* pre-load `identify()` calls. c15t gates the loader on `measurement` consent,
|
|
123
|
+
* queues `init(apiKey, initOptions)` before the bundle loads, and uses
|
|
124
|
+
* `setOptOut(false)` / `setOptOut(true)` for runtime consent changes after the
|
|
125
|
+
* SDK has loaded.
|
|
126
|
+
*/
|
|
127
|
+
export declare const amplitudeManifest: {
|
|
128
|
+
readonly kind: "c15t.vendor-manifest";
|
|
129
|
+
readonly schemaVersion: 1;
|
|
130
|
+
readonly vendor: 'amplitude';
|
|
131
|
+
readonly category: 'measurement';
|
|
132
|
+
readonly install: [{
|
|
133
|
+
readonly type: 'setGlobal';
|
|
134
|
+
readonly name: 'amplitude';
|
|
135
|
+
readonly value: {
|
|
136
|
+
readonly _q: readonly [];
|
|
137
|
+
readonly _iq: {};
|
|
138
|
+
readonly invoked: true;
|
|
139
|
+
};
|
|
140
|
+
readonly ifUndefined: true;
|
|
141
|
+
}, {
|
|
142
|
+
readonly type: 'defineQueueClass';
|
|
143
|
+
readonly target: 'amplitude';
|
|
144
|
+
readonly name: 'Identify';
|
|
145
|
+
readonly queueProperty: '_q';
|
|
146
|
+
readonly methods: ["set", "setOnce", "add", "append", "prepend", "preInsert", "postInsert", "remove", "unset", "clearAll", "getUserProperties"];
|
|
147
|
+
}, {
|
|
148
|
+
readonly type: 'defineQueueMethods';
|
|
149
|
+
readonly target: 'amplitude';
|
|
150
|
+
readonly queue: {
|
|
151
|
+
readonly property: '_q';
|
|
152
|
+
};
|
|
153
|
+
readonly queueFormat: 'wrappedMethodCall';
|
|
154
|
+
readonly methods: ["init", "track", "identify", "flush"];
|
|
155
|
+
}, {
|
|
156
|
+
readonly type: 'defineQueueMethods';
|
|
157
|
+
readonly target: 'amplitude';
|
|
158
|
+
readonly queue: {
|
|
159
|
+
readonly property: '_q';
|
|
160
|
+
};
|
|
161
|
+
readonly queueFormat: 'voidMethodCall';
|
|
162
|
+
readonly methods: ["setUserId", "setOptOut"];
|
|
163
|
+
}, {
|
|
164
|
+
readonly type: 'callGlobal';
|
|
165
|
+
readonly global: 'amplitude';
|
|
166
|
+
readonly method: 'init';
|
|
167
|
+
readonly args: ["{{apiKey}}", "{{initOptions}}"];
|
|
168
|
+
}, {
|
|
169
|
+
readonly type: 'loadScript';
|
|
170
|
+
readonly src: '{{scriptUrl}}';
|
|
171
|
+
readonly async: true;
|
|
172
|
+
}];
|
|
173
|
+
readonly onLoadDenied: [{
|
|
174
|
+
readonly type: 'callGlobal';
|
|
175
|
+
readonly global: 'amplitude';
|
|
176
|
+
readonly method: 'setOptOut';
|
|
177
|
+
readonly args: [true];
|
|
178
|
+
}];
|
|
179
|
+
readonly onConsentGranted: [{
|
|
180
|
+
readonly type: 'callGlobal';
|
|
181
|
+
readonly global: 'amplitude';
|
|
182
|
+
readonly method: 'setOptOut';
|
|
183
|
+
readonly args: [false];
|
|
184
|
+
}];
|
|
185
|
+
readonly onConsentDenied: [{
|
|
186
|
+
readonly type: 'callGlobal';
|
|
187
|
+
readonly global: 'amplitude';
|
|
188
|
+
readonly method: 'setOptOut';
|
|
189
|
+
readonly args: [true];
|
|
190
|
+
}];
|
|
191
|
+
};
|
|
192
|
+
export interface AmplitudeOptions {
|
|
193
|
+
/** Amplitude project API key. */
|
|
194
|
+
apiKey: string;
|
|
195
|
+
/**
|
|
196
|
+
* Amplitude Browser SDK 2 initialization options.
|
|
197
|
+
*
|
|
198
|
+
* Values are serialized into the manifest, so use JSON-serializable values
|
|
199
|
+
* only: plain objects, arrays, strings, numbers, booleans, and `null`.
|
|
200
|
+
*/
|
|
201
|
+
initOptions?: Record<string, unknown>;
|
|
202
|
+
/**
|
|
203
|
+
* Optional Amplitude loader URL override.
|
|
204
|
+
*
|
|
205
|
+
* @default 'https://cdn.amplitude.com/libs/analytics-browser-2.44.4-min.js.gz'
|
|
206
|
+
*/
|
|
207
|
+
scriptUrl?: string;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Creates an Amplitude Browser SDK 2 script.
|
|
211
|
+
*
|
|
212
|
+
* @param options - The options for the Amplitude script.
|
|
213
|
+
* @returns The Amplitude script configuration.
|
|
214
|
+
* @throws {Error} When `apiKey` is missing or only whitespace.
|
|
215
|
+
*
|
|
216
|
+
* @remarks
|
|
217
|
+
* The generated script is gated on `measurement` consent. It does not load the
|
|
218
|
+
* Amplitude SDK until measurement consent is granted; after the SDK is loaded,
|
|
219
|
+
* later consent changes call `amplitude.setOptOut(false)` or
|
|
220
|
+
* `amplitude.setOptOut(true)`.
|
|
221
|
+
*
|
|
222
|
+
* @example
|
|
223
|
+
* ```ts
|
|
224
|
+
* import { amplitude } from '@c15t/scripts/amplitude';
|
|
225
|
+
*
|
|
226
|
+
* const script = amplitude({
|
|
227
|
+
* apiKey: 'AMPLITUDE_API_KEY',
|
|
228
|
+
* initOptions: {
|
|
229
|
+
* autocapture: false,
|
|
230
|
+
* },
|
|
231
|
+
* });
|
|
232
|
+
* ```
|
|
233
|
+
*/
|
|
234
|
+
export declare function amplitude({ apiKey, initOptions, scriptUrl, }: AmplitudeOptions): Script;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { Script } from 'c15t';
|
|
2
|
+
/**
|
|
3
|
+
* Clearbit vendor manifest.
|
|
4
|
+
*
|
|
5
|
+
* Loads Clearbit's visitor and company enrichment tag from the account-keyed
|
|
6
|
+
* `tags.js` endpoint. Clearbit enrichment can identify visitors and companies,
|
|
7
|
+
* so the default consent category is `marketing` rather than `measurement`.
|
|
8
|
+
* The GitHub issue left the category open between measurement and marketing;
|
|
9
|
+
* c15t treats enrichment and intent profiling as marketing-sensitive.
|
|
10
|
+
*/
|
|
11
|
+
export declare const clearbitManifest: {
|
|
12
|
+
readonly kind: "c15t.vendor-manifest";
|
|
13
|
+
readonly schemaVersion: 1;
|
|
14
|
+
readonly vendor: 'clearbit';
|
|
15
|
+
readonly category: 'marketing';
|
|
16
|
+
readonly install: [{
|
|
17
|
+
readonly type: 'loadScript';
|
|
18
|
+
readonly src: '{{scriptUrl}}';
|
|
19
|
+
readonly attributes: {
|
|
20
|
+
readonly referrerpolicy: 'strict-origin-when-cross-origin';
|
|
21
|
+
};
|
|
22
|
+
}];
|
|
23
|
+
};
|
|
24
|
+
export interface ClearbitOptions {
|
|
25
|
+
/**
|
|
26
|
+
* Your Clearbit publishable key.
|
|
27
|
+
*/
|
|
28
|
+
publishableKey: string;
|
|
29
|
+
/**
|
|
30
|
+
* Custom loader URL.
|
|
31
|
+
* @default `https://tag.clearbitscripts.com/v1/{publishableKey}/tags.js`
|
|
32
|
+
*/
|
|
33
|
+
scriptUrl?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Creates a Clearbit enrichment script.
|
|
37
|
+
*
|
|
38
|
+
* @see https://help.clearbit.com/hc/en-us/articles/4420022080783 — installing the Clearbit tag
|
|
39
|
+
*
|
|
40
|
+
* @param options - The options for the Clearbit script.
|
|
41
|
+
* @returns The Clearbit script.
|
|
42
|
+
* @throws {Error} When `publishableKey` is missing, empty, or invalid.
|
|
43
|
+
* Provide a valid non-empty `publishableKey` string to prevent this error.
|
|
44
|
+
*
|
|
45
|
+
* @remarks
|
|
46
|
+
* Clearbit identifies visitors and companies for enrichment and intent use
|
|
47
|
+
* cases. This helper therefore uses the `marketing` consent category by
|
|
48
|
+
* default even though Clearbit is listed with analytics integrations for
|
|
49
|
+
* discovery.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* import { clearbit } from '@c15t/scripts/clearbit';
|
|
54
|
+
*
|
|
55
|
+
* clearbit({
|
|
56
|
+
* publishableKey: 'YOUR_PUBLISHABLE_KEY',
|
|
57
|
+
* });
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export declare function clearbit(options: ClearbitOptions): Script;
|
|
@@ -15,18 +15,18 @@ declare global {
|
|
|
15
15
|
* `measurement` and unloaded when consent is revoked.
|
|
16
16
|
*/
|
|
17
17
|
export declare const cloudflareWebAnalyticsManifest: {
|
|
18
|
-
readonly
|
|
19
|
-
readonly
|
|
18
|
+
readonly kind: "c15t.vendor-manifest";
|
|
19
|
+
readonly schemaVersion: 1;
|
|
20
|
+
readonly vendor: 'cloudflare-web-analytics';
|
|
21
|
+
readonly category: 'measurement';
|
|
20
22
|
readonly install: [{
|
|
21
|
-
readonly type:
|
|
22
|
-
readonly src:
|
|
23
|
+
readonly type: 'loadScript';
|
|
24
|
+
readonly src: '{{scriptUrl}}';
|
|
23
25
|
readonly defer: true;
|
|
24
26
|
readonly attributes: {
|
|
25
|
-
readonly 'data-cf-beacon':
|
|
27
|
+
readonly 'data-cf-beacon': '{{beaconConfig}}';
|
|
26
28
|
};
|
|
27
29
|
}];
|
|
28
|
-
readonly kind: "c15t.vendor-manifest";
|
|
29
|
-
readonly schemaVersion: 1;
|
|
30
30
|
};
|
|
31
31
|
export interface CloudflareWebAnalyticsOptions {
|
|
32
32
|
/**
|
|
@@ -27,63 +27,63 @@ declare global {
|
|
|
27
27
|
* Config is seeded via `window.databuddyConfig` before the script loads.
|
|
28
28
|
*/
|
|
29
29
|
export declare const databuddyManifest: {
|
|
30
|
-
readonly
|
|
31
|
-
readonly
|
|
30
|
+
readonly kind: "c15t.vendor-manifest";
|
|
31
|
+
readonly schemaVersion: 1;
|
|
32
|
+
readonly vendor: 'databuddy';
|
|
33
|
+
readonly category: 'measurement';
|
|
32
34
|
readonly alwaysLoad: true;
|
|
33
35
|
readonly install: [{
|
|
34
|
-
readonly type:
|
|
35
|
-
readonly src:
|
|
36
|
+
readonly type: 'loadScript';
|
|
37
|
+
readonly src: '{{scriptUrl}}';
|
|
36
38
|
readonly async: true;
|
|
37
39
|
readonly attributes: {
|
|
38
|
-
readonly crossorigin:
|
|
39
|
-
readonly 'data-client-id':
|
|
40
|
-
readonly 'data-api-url':
|
|
40
|
+
readonly crossorigin: 'anonymous';
|
|
41
|
+
readonly 'data-client-id': '{{clientId}}';
|
|
42
|
+
readonly 'data-api-url': '{{apiUrl}}';
|
|
41
43
|
};
|
|
42
44
|
}];
|
|
43
45
|
readonly onBeforeLoadGranted: [{
|
|
44
|
-
readonly type:
|
|
45
|
-
readonly name:
|
|
46
|
-
readonly value:
|
|
46
|
+
readonly type: 'setGlobal';
|
|
47
|
+
readonly name: 'databuddyConfig';
|
|
48
|
+
readonly value: '{{configWhenGranted}}';
|
|
47
49
|
readonly ifUndefined: true;
|
|
48
50
|
}];
|
|
49
51
|
readonly onBeforeLoadDenied: [{
|
|
50
|
-
readonly type:
|
|
51
|
-
readonly name:
|
|
52
|
-
readonly value:
|
|
52
|
+
readonly type: 'setGlobal';
|
|
53
|
+
readonly name: 'databuddyConfig';
|
|
54
|
+
readonly value: '{{configWhenDenied}}';
|
|
53
55
|
readonly ifUndefined: true;
|
|
54
56
|
}];
|
|
55
57
|
readonly onLoadGranted: [{
|
|
56
|
-
readonly type:
|
|
58
|
+
readonly type: 'setGlobalPath';
|
|
57
59
|
readonly path: ["databuddy", "options", "disabled"];
|
|
58
60
|
readonly value: false;
|
|
59
61
|
}];
|
|
60
62
|
readonly onLoadDenied: [{
|
|
61
|
-
readonly type:
|
|
63
|
+
readonly type: 'setGlobalPath';
|
|
62
64
|
readonly path: ["databuddy", "options", "disabled"];
|
|
63
65
|
readonly value: true;
|
|
64
66
|
}];
|
|
65
67
|
readonly onConsentGranted: [{
|
|
66
|
-
readonly type:
|
|
67
|
-
readonly name:
|
|
68
|
-
readonly value:
|
|
68
|
+
readonly type: 'setGlobal';
|
|
69
|
+
readonly name: 'databuddyConfig';
|
|
70
|
+
readonly value: '{{configWhenGranted}}';
|
|
69
71
|
readonly ifUndefined: false;
|
|
70
72
|
}, {
|
|
71
|
-
readonly type:
|
|
73
|
+
readonly type: 'setGlobalPath';
|
|
72
74
|
readonly path: ["databuddy", "options", "disabled"];
|
|
73
75
|
readonly value: false;
|
|
74
76
|
}];
|
|
75
77
|
readonly onConsentDenied: [{
|
|
76
|
-
readonly type:
|
|
77
|
-
readonly name:
|
|
78
|
-
readonly value:
|
|
78
|
+
readonly type: 'setGlobal';
|
|
79
|
+
readonly name: 'databuddyConfig';
|
|
80
|
+
readonly value: '{{configWhenDenied}}';
|
|
79
81
|
readonly ifUndefined: false;
|
|
80
82
|
}, {
|
|
81
|
-
readonly type:
|
|
83
|
+
readonly type: 'setGlobalPath';
|
|
82
84
|
readonly path: ["databuddy", "options", "disabled"];
|
|
83
85
|
readonly value: true;
|
|
84
86
|
}];
|
|
85
|
-
readonly kind: "c15t.vendor-manifest";
|
|
86
|
-
readonly schemaVersion: 1;
|
|
87
87
|
};
|
|
88
88
|
export interface DatabuddyConsentOptions {
|
|
89
89
|
/**
|
|
@@ -23,22 +23,22 @@ declare global {
|
|
|
23
23
|
* unloaded when consent is revoked.
|
|
24
24
|
*/
|
|
25
25
|
export declare const fathomAnalyticsManifest: {
|
|
26
|
-
readonly
|
|
27
|
-
readonly
|
|
26
|
+
readonly kind: "c15t.vendor-manifest";
|
|
27
|
+
readonly schemaVersion: 1;
|
|
28
|
+
readonly vendor: 'fathom-analytics';
|
|
29
|
+
readonly category: 'measurement';
|
|
28
30
|
readonly install: [{
|
|
29
|
-
readonly type:
|
|
30
|
-
readonly src:
|
|
31
|
+
readonly type: 'loadScript';
|
|
32
|
+
readonly src: '{{scriptUrl}}';
|
|
31
33
|
readonly defer: true;
|
|
32
34
|
readonly attributes: {
|
|
33
|
-
readonly 'data-site':
|
|
34
|
-
readonly 'data-spa':
|
|
35
|
-
readonly 'data-auto':
|
|
36
|
-
readonly 'data-canonical':
|
|
37
|
-
readonly 'data-honor-dnt':
|
|
35
|
+
readonly 'data-site': '{{site}}';
|
|
36
|
+
readonly 'data-spa': '{{spa}}';
|
|
37
|
+
readonly 'data-auto': '{{autoAttribute}}';
|
|
38
|
+
readonly 'data-canonical': '{{canonicalAttribute}}';
|
|
39
|
+
readonly 'data-honor-dnt': '{{honorDntAttribute}}';
|
|
38
40
|
};
|
|
39
41
|
}];
|
|
40
|
-
readonly kind: "c15t.vendor-manifest";
|
|
41
|
-
readonly schemaVersion: 1;
|
|
42
42
|
};
|
|
43
43
|
export interface FathomAnalyticsOptions {
|
|
44
44
|
/**
|
|
@@ -12,41 +12,41 @@ declare global {
|
|
|
12
12
|
* Uses the same Consent Mode v2 mapping.
|
|
13
13
|
*/
|
|
14
14
|
export declare const gtagManifest: {
|
|
15
|
-
readonly
|
|
16
|
-
readonly
|
|
15
|
+
readonly kind: "c15t.vendor-manifest";
|
|
16
|
+
readonly schemaVersion: 1;
|
|
17
|
+
readonly vendor: 'gtag';
|
|
18
|
+
readonly category: '{{category}}';
|
|
17
19
|
readonly alwaysLoad: true;
|
|
18
20
|
readonly persistAfterConsentRevoked: true;
|
|
19
21
|
readonly bootstrap: [{
|
|
20
|
-
readonly type:
|
|
21
|
-
readonly name:
|
|
22
|
+
readonly type: 'setGlobal';
|
|
23
|
+
readonly name: 'dataLayer';
|
|
22
24
|
readonly value: readonly [];
|
|
23
25
|
readonly ifUndefined: true;
|
|
24
26
|
}, {
|
|
25
|
-
readonly type:
|
|
26
|
-
readonly name:
|
|
27
|
-
readonly queue:
|
|
27
|
+
readonly type: 'defineQueueFunction';
|
|
28
|
+
readonly name: 'gtag';
|
|
29
|
+
readonly queue: 'dataLayer';
|
|
28
30
|
readonly ifUndefined: true;
|
|
29
31
|
}];
|
|
30
32
|
readonly install: [{
|
|
31
|
-
readonly type:
|
|
32
|
-
readonly global:
|
|
33
|
+
readonly type: 'callGlobal';
|
|
34
|
+
readonly global: 'gtag';
|
|
33
35
|
readonly args: ["js", {
|
|
34
36
|
readonly kind: "c15t.runtime-value";
|
|
35
|
-
readonly value:
|
|
37
|
+
readonly value: 'date';
|
|
36
38
|
}];
|
|
37
39
|
}, {
|
|
38
|
-
readonly type:
|
|
39
|
-
readonly global:
|
|
40
|
+
readonly type: 'callGlobal';
|
|
41
|
+
readonly global: 'gtag';
|
|
40
42
|
readonly args: ["config", "{{id}}"];
|
|
41
43
|
}, {
|
|
42
|
-
readonly type:
|
|
43
|
-
readonly src:
|
|
44
|
+
readonly type: 'loadScript';
|
|
45
|
+
readonly src: 'https://www.googletagmanager.com/gtag/js?id={{id}}';
|
|
44
46
|
readonly async: true;
|
|
45
47
|
}];
|
|
46
48
|
readonly consentMapping: Record<string, string[]>;
|
|
47
|
-
readonly consentSignal:
|
|
48
|
-
readonly kind: "c15t.vendor-manifest";
|
|
49
|
-
readonly schemaVersion: 1;
|
|
49
|
+
readonly consentSignal: 'gtag';
|
|
50
50
|
};
|
|
51
51
|
export interface GtagOptions {
|
|
52
52
|
/**
|