@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.
Files changed (140) hide show
  1. package/AGENTS.md +62 -0
  2. package/README.md +32 -20
  3. package/dist/e2e-test-utils.cjs +51 -10
  4. package/dist/e2e-test-utils.js +37 -3
  5. package/dist/engine/compile.cjs +9 -5
  6. package/dist/engine/runtime.cjs +103 -17
  7. package/dist/engine/runtime.js +94 -12
  8. package/dist/registry.cjs +97 -12
  9. package/dist/registry.js +80 -0
  10. package/dist/resolve.cjs +9 -5
  11. package/dist/types.cjs +17 -13
  12. package/dist/vendors/_shared/attributes.cjs +13 -9
  13. package/dist/vendors/_shared/google-consent.cjs +14 -9
  14. package/dist/vendors/_shared/install-builders.cjs +12 -8
  15. package/dist/vendors/_shared/script-url.cjs +16 -12
  16. package/dist/vendors/ads-and-pixels/linkedin-insights.cjs +9 -5
  17. package/dist/vendors/ads-and-pixels/meta-pixel.cjs +13 -9
  18. package/dist/vendors/ads-and-pixels/microsoft-uet.cjs +11 -7
  19. package/dist/vendors/ads-and-pixels/reddit-pixel.cjs +9 -5
  20. package/dist/vendors/ads-and-pixels/snapchat-pixel.cjs +11 -7
  21. package/dist/vendors/ads-and-pixels/tiktok-pixel.cjs +9 -5
  22. package/dist/vendors/ads-and-pixels/x-pixel.cjs +9 -5
  23. package/dist/vendors/analytics/adobe-analytics.cjs +90 -0
  24. package/dist/vendors/analytics/adobe-analytics.js +49 -0
  25. package/dist/vendors/analytics/ahrefs-analytics.cjs +11 -7
  26. package/dist/vendors/analytics/amplitude.cjs +193 -0
  27. package/dist/vendors/analytics/amplitude.js +134 -0
  28. package/dist/vendors/analytics/clearbit.cjs +69 -0
  29. package/dist/vendors/analytics/clearbit.js +28 -0
  30. package/dist/vendors/analytics/cloudflare-web-analytics.cjs +11 -7
  31. package/dist/vendors/analytics/databuddy.cjs +11 -7
  32. package/dist/vendors/analytics/fathom-analytics.cjs +11 -7
  33. package/dist/vendors/analytics/google-tag.cjs +11 -7
  34. package/dist/vendors/analytics/heap.cjs +181 -0
  35. package/dist/vendors/analytics/heap.js +134 -0
  36. package/dist/vendors/analytics/hightouch.cjs +153 -0
  37. package/dist/vendors/analytics/hightouch.js +109 -0
  38. package/dist/vendors/analytics/hotjar.cjs +11 -7
  39. package/dist/vendors/analytics/logrocket.cjs +99 -0
  40. package/dist/vendors/analytics/logrocket.js +58 -0
  41. package/dist/vendors/analytics/matomo-analytics.cjs +9 -5
  42. package/dist/vendors/analytics/microsoft-clarity.cjs +75 -47
  43. package/dist/vendors/analytics/microsoft-clarity.js +64 -40
  44. package/dist/vendors/analytics/mixpanel-analytics.cjs +31 -16
  45. package/dist/vendors/analytics/mixpanel-analytics.js +22 -11
  46. package/dist/vendors/analytics/pirsch.cjs +108 -0
  47. package/dist/vendors/analytics/pirsch.js +67 -0
  48. package/dist/vendors/analytics/plausible-analytics.cjs +9 -5
  49. package/dist/vendors/analytics/posthog.cjs +63 -27
  50. package/dist/vendors/analytics/posthog.js +52 -20
  51. package/dist/vendors/analytics/promptwatch.cjs +11 -7
  52. package/dist/vendors/analytics/rudderstack.cjs +227 -0
  53. package/dist/vendors/analytics/rudderstack.js +183 -0
  54. package/dist/vendors/analytics/rybbit-analytics.cjs +9 -5
  55. package/dist/vendors/analytics/segment.cjs +9 -5
  56. package/dist/vendors/analytics/umami-analytics.cjs +9 -5
  57. package/dist/vendors/analytics/vercel-analytics.cjs +11 -7
  58. package/dist/vendors/functional/crisp.cjs +9 -5
  59. package/dist/vendors/functional/intercom.cjs +11 -7
  60. package/dist/vendors/tag-managers/google-tag-manager.cjs +11 -7
  61. package/dist-types/registry.d.ts +313 -241
  62. package/dist-types/types.d.ts +46 -4
  63. package/dist-types/vendors/ads-and-pixels/linkedin-insights.d.ts +18 -18
  64. package/dist-types/vendors/ads-and-pixels/meta-pixel.d.ts +21 -21
  65. package/dist-types/vendors/ads-and-pixels/microsoft-uet.d.ts +32 -32
  66. package/dist-types/vendors/ads-and-pixels/reddit-pixel.d.ts +19 -19
  67. package/dist-types/vendors/ads-and-pixels/snapchat-pixel.d.ts +16 -16
  68. package/dist-types/vendors/ads-and-pixels/tiktok-pixel.d.ts +28 -28
  69. package/dist-types/vendors/ads-and-pixels/x-pixel.d.ts +13 -13
  70. package/dist-types/vendors/analytics/adobe-analytics.d.ts +75 -0
  71. package/dist-types/vendors/analytics/ahrefs-analytics.d.ts +7 -7
  72. package/dist-types/vendors/analytics/amplitude.d.ts +234 -0
  73. package/dist-types/vendors/analytics/clearbit.d.ts +60 -0
  74. package/dist-types/vendors/analytics/cloudflare-web-analytics.d.ts +7 -7
  75. package/dist-types/vendors/analytics/databuddy.d.ts +25 -25
  76. package/dist-types/vendors/analytics/fathom-analytics.d.ts +11 -11
  77. package/dist-types/vendors/analytics/google-tag.d.ts +17 -17
  78. package/dist-types/vendors/analytics/heap.d.ts +316 -0
  79. package/dist-types/vendors/analytics/hightouch.d.ts +285 -0
  80. package/dist-types/vendors/analytics/hotjar.d.ts +14 -14
  81. package/dist-types/vendors/analytics/logrocket.d.ts +101 -0
  82. package/dist-types/vendors/analytics/microsoft-clarity.d.ts +42 -30
  83. package/dist-types/vendors/analytics/mixpanel-analytics.d.ts +40 -28
  84. package/dist-types/vendors/analytics/pirsch.d.ts +96 -0
  85. package/dist-types/vendors/analytics/plausible-analytics.d.ts +13 -13
  86. package/dist-types/vendors/analytics/posthog.d.ts +63 -45
  87. package/dist-types/vendors/analytics/promptwatch.d.ts +7 -7
  88. package/dist-types/vendors/analytics/rudderstack.d.ts +330 -0
  89. package/dist-types/vendors/analytics/rybbit-analytics.d.ts +18 -18
  90. package/dist-types/vendors/analytics/segment.d.ts +13 -13
  91. package/dist-types/vendors/analytics/umami-analytics.d.ts +12 -12
  92. package/dist-types/vendors/analytics/vercel-analytics.d.ts +16 -16
  93. package/dist-types/vendors/functional/crisp.d.ts +11 -11
  94. package/dist-types/vendors/functional/intercom.d.ts +16 -16
  95. package/dist-types/vendors/tag-managers/google-tag-manager.d.ts +18 -18
  96. package/docs/README.md +62 -0
  97. package/docs/frameworks/javascript/script-loader.md +356 -0
  98. package/docs/frameworks/next/script-loader.md +501 -0
  99. package/docs/frameworks/react/script-loader.md +555 -0
  100. package/docs/integrations/adobe-analytics.md +160 -0
  101. package/docs/integrations/ahrefs-analytics.md +157 -0
  102. package/docs/integrations/amplitude.md +230 -0
  103. package/docs/integrations/building-integrations.md +239 -0
  104. package/docs/integrations/clearbit.md +130 -0
  105. package/docs/integrations/cloudflare-web-analytics.md +126 -0
  106. package/docs/integrations/crisp.md +140 -0
  107. package/docs/integrations/databuddy.md +205 -0
  108. package/docs/integrations/fathom-analytics.md +150 -0
  109. package/docs/integrations/google-maps.md +263 -0
  110. package/docs/integrations/google-tag-manager.md +154 -0
  111. package/docs/integrations/google-tag.md +134 -0
  112. package/docs/integrations/heap.md +219 -0
  113. package/docs/integrations/hightouch.md +199 -0
  114. package/docs/integrations/hotjar.md +143 -0
  115. package/docs/integrations/intercom.md +144 -0
  116. package/docs/integrations/linkedin-insights.md +161 -0
  117. package/docs/integrations/logrocket.md +175 -0
  118. package/docs/integrations/matomo-analytics.md +171 -0
  119. package/docs/integrations/meta-pixel.md +412 -0
  120. package/docs/integrations/microsoft-clarity.md +173 -0
  121. package/docs/integrations/microsoft-uet.md +156 -0
  122. package/docs/integrations/mixpanel-analytics.md +130 -0
  123. package/docs/integrations/overview.md +149 -0
  124. package/docs/integrations/pirsch.md +142 -0
  125. package/docs/integrations/plausible-analytics.md +154 -0
  126. package/docs/integrations/posthog.md +258 -0
  127. package/docs/integrations/promptwatch.md +121 -0
  128. package/docs/integrations/reddit-pixel.md +241 -0
  129. package/docs/integrations/rudderstack.md +271 -0
  130. package/docs/integrations/rybbit-analytics.md +143 -0
  131. package/docs/integrations/segment.md +146 -0
  132. package/docs/integrations/snapchat-pixel.md +163 -0
  133. package/docs/integrations/tiktok-pixel.md +123 -0
  134. package/docs/integrations/umami-analytics.md +148 -0
  135. package/docs/integrations/vercel-analytics.md +141 -0
  136. package/docs/integrations/x-pixel.md +157 -0
  137. package/docs/integrations/youtube.md +193 -0
  138. package/docs/shared/react/guides/script-loader.md +311 -0
  139. package/package.json +61 -7
  140. package/readme.json +8 -4
@@ -0,0 +1,316 @@
1
+ import type { Script } from 'c15t';
2
+ /**
3
+ * Default Heap config-loader base URL.
4
+ *
5
+ * Heap's current web installation snippet loads account configuration from a
6
+ * per-environment `heap_config.js` URL. That configuration then chain-loads the
7
+ * versioned heap.js runtime selected for the environment.
8
+ */
9
+ export declare const DEFAULT_HEAP_CONFIG_BASE_URL = "https://cdn.us.heap-api.com/config";
10
+ /**
11
+ * Current heap.js v5 method stubs from Heap's official web snippet.
12
+ *
13
+ * These methods do not push `[method, args]` tuples into `window.heap`. They
14
+ * push `{ name, fn }` records into `window.heapReadyCb`; each callback replays
15
+ * the original call against the loaded `window.heap` runtime.
16
+ */
17
+ export declare const HEAP_QUEUE_METHODS: readonly ['init', 'startTracking', 'stopTracking', 'track', 'resetIdentity', 'identify', 'identifyHashed', 'getSessionId', 'getUserId', 'getIdentity', 'addUserProperties', 'addEventProperties', 'removeEventProperty', 'clearEventProperties', 'addAccountProperties', 'addAdapter', 'addTransformer', 'addTransformerFn', 'onReady', 'addPageviewProperties', 'removePageviewProperty', 'clearPageviewProperties', 'trackPageview'];
18
+ type JsonPrimitive = string | number | boolean | null;
19
+ type JsonValue = JsonPrimitive | JsonValue[] | {
20
+ [key: string]: JsonValue;
21
+ };
22
+ type JsonRecord = {
23
+ [key: string]: JsonValue;
24
+ };
25
+ export interface HeapReadyCallback {
26
+ /** Heap method name captured by the pre-load snippet stub. */
27
+ name: (typeof HEAP_QUEUE_METHODS)[number];
28
+ /** Callback invoked by heap.js after the runtime is ready. */
29
+ fn: () => void;
30
+ }
31
+ /**
32
+ * Minimal public heap.js API exposed on `window.heap`.
33
+ *
34
+ * Before the real SDK loads, c15t creates an array-backed stub with these
35
+ * methods. The config loader calls `heap.init(envId, clientConfig,
36
+ * serverConfig)`, and heap.js drains `window.heapReadyCb` by invoking each
37
+ * stored callback.
38
+ */
39
+ export interface HeapApi {
40
+ /** Environment/app id selected for this Heap installation. */
41
+ envId?: string;
42
+ /** Legacy alias used by some Heap runtime paths. */
43
+ appid?: string;
44
+ /** Client configuration passed into `heap.load()`. */
45
+ clientConfig?: JsonRecord;
46
+ /** Server configuration assigned by `heap_config.js` before heap.js loads. */
47
+ serverConfig?: Record<string, unknown>;
48
+ /**
49
+ * Initializes the heap.js runtime.
50
+ *
51
+ * @param envId - Heap environment/app id.
52
+ * @param clientConfig - Client-side configuration options.
53
+ * @param serverConfig - Server-side configuration loaded by Heap.
54
+ * @returns Vendor-specific runtime result.
55
+ */
56
+ init: (envId: string, clientConfig?: JsonRecord, serverConfig?: Record<string, unknown>) => unknown;
57
+ /**
58
+ * Starts Heap autocapture and event delivery.
59
+ *
60
+ * @returns Vendor-specific runtime result.
61
+ */
62
+ startTracking: () => unknown;
63
+ /**
64
+ * Stops Heap tracking for the current runtime session.
65
+ *
66
+ * @returns Vendor-specific runtime result.
67
+ */
68
+ stopTracking: () => unknown;
69
+ /**
70
+ * Tracks a custom Heap event.
71
+ *
72
+ * @param event - Event name to record.
73
+ * @param properties - Optional event properties.
74
+ * @returns Vendor-specific runtime result.
75
+ */
76
+ track: (event: string, properties?: Record<string, unknown>) => unknown;
77
+ /**
78
+ * Clears the current Heap identity.
79
+ *
80
+ * @returns Vendor-specific runtime result.
81
+ */
82
+ resetIdentity: () => unknown;
83
+ /**
84
+ * Identifies the current user.
85
+ *
86
+ * @param identity - Stable user identity.
87
+ * @returns Vendor-specific runtime result.
88
+ */
89
+ identify: (identity: string) => unknown;
90
+ /**
91
+ * Identifies the current user with a hashed identity.
92
+ *
93
+ * @param identity - Hashed user identity.
94
+ * @returns Vendor-specific runtime result.
95
+ */
96
+ identifyHashed: (identity: string) => unknown;
97
+ /**
98
+ * Reads the current Heap session id.
99
+ *
100
+ * @returns Current session id when available.
101
+ */
102
+ getSessionId: () => unknown;
103
+ /**
104
+ * Reads the current Heap user id.
105
+ *
106
+ * @returns Current Heap user id when available.
107
+ */
108
+ getUserId: () => unknown;
109
+ /**
110
+ * Reads the current Heap identity.
111
+ *
112
+ * @returns Current identity when available.
113
+ */
114
+ getIdentity: () => unknown;
115
+ /**
116
+ * Adds properties to the current user.
117
+ *
118
+ * @param properties - User properties to merge.
119
+ * @returns Vendor-specific runtime result.
120
+ */
121
+ addUserProperties: (properties: Record<string, unknown>) => unknown;
122
+ /**
123
+ * Adds properties to every subsequent event.
124
+ *
125
+ * @param properties - Event properties to merge.
126
+ * @returns Vendor-specific runtime result.
127
+ */
128
+ addEventProperties: (properties: Record<string, unknown>) => unknown;
129
+ /**
130
+ * Removes a single persisted event property.
131
+ *
132
+ * @param property - Event property name to remove.
133
+ * @returns Vendor-specific runtime result.
134
+ */
135
+ removeEventProperty: (property: string) => unknown;
136
+ /**
137
+ * Clears persisted event properties.
138
+ *
139
+ * @returns Vendor-specific runtime result.
140
+ */
141
+ clearEventProperties: () => unknown;
142
+ /**
143
+ * Adds properties to the current account.
144
+ *
145
+ * @param properties - Account properties to merge.
146
+ * @returns Vendor-specific runtime result.
147
+ */
148
+ addAccountProperties: (properties: Record<string, unknown>) => unknown;
149
+ /**
150
+ * Adds a Heap adapter.
151
+ *
152
+ * @param adapter - Adapter implementation accepted by heap.js.
153
+ * @returns Vendor-specific runtime result.
154
+ */
155
+ addAdapter: (adapter: unknown) => unknown;
156
+ /**
157
+ * Adds a Heap event transformer.
158
+ *
159
+ * @param transformer - Transformer implementation accepted by heap.js.
160
+ * @returns Vendor-specific runtime result.
161
+ */
162
+ addTransformer: (transformer: unknown) => unknown;
163
+ /**
164
+ * Adds a Heap transformer function.
165
+ *
166
+ * @param transformer - Transformer callback accepted by heap.js.
167
+ * @returns Vendor-specific runtime result.
168
+ */
169
+ addTransformerFn: (transformer: (...args: unknown[]) => unknown) => unknown;
170
+ /**
171
+ * Registers a callback for Heap readiness.
172
+ *
173
+ * @param callback - Function to call once Heap is ready.
174
+ * @returns Vendor-specific runtime result.
175
+ */
176
+ onReady: (callback: () => void) => unknown;
177
+ /**
178
+ * Adds properties to subsequent pageview events.
179
+ *
180
+ * @param properties - Pageview properties to merge.
181
+ * @returns Vendor-specific runtime result.
182
+ */
183
+ addPageviewProperties: (properties: Record<string, unknown>) => unknown;
184
+ /**
185
+ * Removes a single persisted pageview property.
186
+ *
187
+ * @param property - Pageview property name to remove.
188
+ * @returns Vendor-specific runtime result.
189
+ */
190
+ removePageviewProperty: (property: string) => unknown;
191
+ /**
192
+ * Clears persisted pageview properties.
193
+ *
194
+ * @returns Vendor-specific runtime result.
195
+ */
196
+ clearPageviewProperties: () => unknown;
197
+ /**
198
+ * Tracks a pageview event.
199
+ *
200
+ * @param properties - Optional pageview properties.
201
+ * @returns Vendor-specific runtime result.
202
+ */
203
+ trackPageview: (properties?: Record<string, unknown>) => unknown;
204
+ }
205
+ declare global {
206
+ interface Window {
207
+ heap?: HeapApi;
208
+ heapReadyCb?: HeapReadyCallback[];
209
+ }
210
+ }
211
+ /**
212
+ * Heap vendor manifest.
213
+ *
214
+ * Reproduces the heap.js v5 snippet contract consumed by
215
+ * `heap_config.js`: `window.heapReadyCb` receives `{ name, fn }` callback
216
+ * records, `window.heap` stores `envId`/`appid` and `clientConfig`, and the
217
+ * Heap configuration script chain-loads the versioned heap.js runtime.
218
+ *
219
+ * Heap does not document a browser opt-out API that can make an already loaded
220
+ * runtime inert for c15t's purposes, so c15t gates the load on `measurement`
221
+ * consent and unloads the script when that consent is revoked.
222
+ */
223
+ export declare const heapManifest: {
224
+ readonly kind: "c15t.vendor-manifest";
225
+ readonly schemaVersion: 1;
226
+ readonly vendor: 'heap';
227
+ readonly category: 'measurement';
228
+ readonly install: [{
229
+ readonly type: 'setGlobal';
230
+ readonly name: 'heapReadyCb';
231
+ readonly value: readonly [];
232
+ readonly ifUndefined: true;
233
+ }, {
234
+ readonly type: 'setGlobal';
235
+ readonly name: 'heap';
236
+ readonly value: readonly [];
237
+ readonly ifUndefined: true;
238
+ }, {
239
+ readonly type: 'setGlobalPath';
240
+ readonly path: ["heap", "envId"];
241
+ readonly value: '{{envId}}';
242
+ }, {
243
+ readonly type: 'setGlobalPath';
244
+ readonly path: ["heap", "appid"];
245
+ readonly value: '{{envId}}';
246
+ }, {
247
+ readonly type: 'setGlobalPath';
248
+ readonly path: ["heap", "clientConfig"];
249
+ readonly value: '{{clientConfig}}';
250
+ }, {
251
+ readonly type: 'defineQueueMethods';
252
+ readonly target: 'heap';
253
+ readonly queue: {
254
+ readonly global: 'heapReadyCb';
255
+ };
256
+ readonly queueFormat: 'callback';
257
+ readonly methods: ["init", "startTracking", "stopTracking", "track", "resetIdentity", "identify", "identifyHashed", "getSessionId", "getUserId", "getIdentity", "addUserProperties", "addEventProperties", "removeEventProperty", "clearEventProperties", "addAccountProperties", "addAdapter", "addTransformer", "addTransformerFn", "onReady", "addPageviewProperties", "removePageviewProperty", "clearPageviewProperties", "trackPageview"];
258
+ }, {
259
+ readonly type: 'loadScript';
260
+ readonly src: '{{scriptUrl}}';
261
+ readonly async: true;
262
+ }];
263
+ };
264
+ export interface HeapOptions {
265
+ /**
266
+ * Heap environment/app id.
267
+ *
268
+ * Heap's app UI commonly shows this as a numeric string. c15t validates only
269
+ * that the value is a non-empty string after trimming because Heap's public
270
+ * install docs describe it generically as `YOUR_APP_ID`.
271
+ */
272
+ envId: string;
273
+ /**
274
+ * Optional heap.js client configuration.
275
+ *
276
+ * Values must be JSON-serializable: plain objects, arrays, strings, finite
277
+ * numbers, booleans, and `null`. c15t adds `shouldFetchServerConfig: false`
278
+ * to match Heap's current web installation snippet.
279
+ */
280
+ clientConfig?: Record<string, unknown>;
281
+ /**
282
+ * Optional full Heap config-loader URL override.
283
+ *
284
+ * @default 'https://cdn.us.heap-api.com/config/{envId}/heap_config.js'
285
+ */
286
+ scriptUrl?: string;
287
+ }
288
+ /**
289
+ * Creates a Heap web analytics script.
290
+ *
291
+ * @see https://developers.heap.io/docs/web
292
+ *
293
+ * @param options - The options for the Heap script.
294
+ * @returns The Heap script configuration.
295
+ * @throws {Error} When `envId` is missing or only whitespace.
296
+ * @throws {TypeError} When `clientConfig` contains non-JSON values.
297
+ *
298
+ * @remarks
299
+ * Heap autocaptures interactions as soon as heap.js loads. c15t therefore
300
+ * gates the config loader on `measurement` consent and unloads the script when
301
+ * that consent is revoked.
302
+ *
303
+ * @example
304
+ * ```ts
305
+ * import { heap } from '@c15t/scripts/heap';
306
+ *
307
+ * const script = heap({
308
+ * envId: '123456789',
309
+ * clientConfig: {
310
+ * disableTextCapture: true,
311
+ * },
312
+ * });
313
+ * ```
314
+ */
315
+ export declare function heap({ envId, clientConfig, scriptUrl }: HeapOptions): Script;
316
+ export {};
@@ -0,0 +1,285 @@
1
+ import type { Script } from 'c15t';
2
+ export declare const HIGHTOUCH_QUEUE_METHODS: readonly ['trackSubmit', 'trackClick', 'trackLink', 'trackForm', 'pageview', 'identify', 'reset', 'group', 'track', 'ready', 'alias', 'debug', 'page', 'once', 'off', 'on', 'addSourceMiddleware', 'addIntegrationMiddleware', 'setAnonymousId', 'addDestinationMiddleware', 'load'];
3
+ /**
4
+ * Public Hightouch Events browser API exposed on `window.htevents`.
5
+ *
6
+ * The official browser snippet starts as an array-backed queue and the loaded
7
+ * SDK replaces it with an initialized runtime object. Use this interface for
8
+ * calls made after consent has allowed the SDK to load.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * window.htevents?.track('Signup Completed', { plan: 'pro' });
13
+ * ```
14
+ */
15
+ export interface HightouchApi {
16
+ /**
17
+ * Tracks a form submission.
18
+ *
19
+ * @param form - Form element, selector, or vendor-supported form target.
20
+ * @param event - Event name to record.
21
+ * @param properties - Optional event properties payload.
22
+ * @returns The Hightouch runtime or a promise-like value from the SDK.
23
+ */
24
+ trackSubmit: (form: unknown, event: string, properties?: Record<string, unknown>) => unknown;
25
+ /**
26
+ * Tracks a click interaction.
27
+ *
28
+ * @param element - Element, selector, or vendor-supported click target.
29
+ * @param event - Event name to record.
30
+ * @param properties - Optional event properties payload.
31
+ * @returns The Hightouch runtime or a promise-like value from the SDK.
32
+ */
33
+ trackClick: (element: unknown, event: string, properties?: Record<string, unknown>) => unknown;
34
+ /**
35
+ * Tracks link clicks before navigation.
36
+ *
37
+ * @param link - Link element, selector, or vendor-supported link target.
38
+ * @param event - Event name to record.
39
+ * @param properties - Optional event properties payload.
40
+ * @returns The Hightouch runtime or a promise-like value from the SDK.
41
+ */
42
+ trackLink: (link: unknown, event: string, properties?: Record<string, unknown>) => unknown;
43
+ /**
44
+ * Tracks form submissions with form-specific semantics.
45
+ *
46
+ * @param form - Form element, selector, or vendor-supported form target.
47
+ * @param event - Event name to record.
48
+ * @param properties - Optional event properties payload.
49
+ * @returns The Hightouch runtime or a promise-like value from the SDK.
50
+ */
51
+ trackForm: (form: unknown, event: string, properties?: Record<string, unknown>) => unknown;
52
+ /**
53
+ * Tracks a classic pageview event.
54
+ *
55
+ * @param url - Optional URL override.
56
+ * @returns The Hightouch runtime or a promise-like value from the SDK.
57
+ */
58
+ pageview: (url?: string) => unknown;
59
+ /**
60
+ * Identifies a user and associates traits with that identity.
61
+ *
62
+ * @param userId - Stable user identifier.
63
+ * @param traits - Optional trait map associated with the user.
64
+ * @param context - Optional event context overrides.
65
+ * @param callback - Optional callback after processing.
66
+ * @returns The Hightouch runtime or a promise-like value from the SDK.
67
+ */
68
+ identify: (userId: string, traits?: Record<string, unknown>, context?: Record<string, unknown>, callback?: () => void) => unknown;
69
+ /**
70
+ * Clears the current user identity state.
71
+ *
72
+ * @returns The Hightouch runtime or a promise-like value from the SDK.
73
+ */
74
+ reset: () => unknown;
75
+ /**
76
+ * Associates the current user with a group or account.
77
+ *
78
+ * @param groupId - Group or account identifier.
79
+ * @param traits - Optional group trait map.
80
+ * @param context - Optional event context overrides.
81
+ * @param callback - Optional callback after processing.
82
+ * @returns The Hightouch runtime or a promise-like value from the SDK.
83
+ */
84
+ group: (groupId: string, traits?: Record<string, unknown>, context?: Record<string, unknown>, callback?: () => void) => unknown;
85
+ /**
86
+ * Tracks a named event.
87
+ *
88
+ * @param event - Event name to record.
89
+ * @param properties - Optional event properties payload.
90
+ * @param context - Optional event context overrides.
91
+ * @param callback - Optional callback after processing.
92
+ * @returns The Hightouch runtime or a promise-like value from the SDK.
93
+ */
94
+ track: (event: string, properties?: Record<string, unknown>, context?: Record<string, unknown>, callback?: () => void) => unknown;
95
+ /**
96
+ * Registers a callback that fires when the SDK is ready.
97
+ *
98
+ * @param callback - Function to run once the SDK is ready.
99
+ * @returns The Hightouch runtime or a promise-like value from the SDK.
100
+ */
101
+ ready: (callback: () => void) => unknown;
102
+ /**
103
+ * Aliases one user identifier to another.
104
+ *
105
+ * @param userId - New canonical user identifier.
106
+ * @param previousId - Optional previous identifier.
107
+ * @param context - Optional event context overrides.
108
+ * @param callback - Optional callback after processing.
109
+ * @returns The Hightouch runtime or a promise-like value from the SDK.
110
+ */
111
+ alias: (userId: string, previousId?: string, context?: Record<string, unknown>, callback?: () => void) => unknown;
112
+ /**
113
+ * Enables or disables debug logging in the SDK.
114
+ *
115
+ * @param enabled - Whether debug logging should be enabled.
116
+ * @returns The Hightouch runtime or a promise-like value from the SDK.
117
+ */
118
+ debug: (enabled?: boolean) => unknown;
119
+ /**
120
+ * Tracks a page view with optional category, name, properties, and context.
121
+ *
122
+ * @param category - Optional page category or page name.
123
+ * @param name - Optional page name or properties payload.
124
+ * @param properties - Optional page metadata payload.
125
+ * @param context - Optional event context overrides.
126
+ * @param callback - Optional callback after processing.
127
+ * @returns The Hightouch runtime or a promise-like value from the SDK.
128
+ */
129
+ page: (category?: string, name?: string | Record<string, unknown>, properties?: Record<string, unknown>, context?: Record<string, unknown>, callback?: () => void) => unknown;
130
+ /**
131
+ * Registers a one-time event listener on the SDK emitter.
132
+ *
133
+ * @param event - Event name to listen for.
134
+ * @param callback - Listener callback.
135
+ * @returns The Hightouch runtime or a promise-like value from the SDK.
136
+ */
137
+ once: (event: string, callback: (...args: unknown[]) => void) => unknown;
138
+ /**
139
+ * Removes an SDK event listener.
140
+ *
141
+ * @param event - Event name to stop listening for.
142
+ * @param callback - Listener callback to remove.
143
+ * @returns The Hightouch runtime or a promise-like value from the SDK.
144
+ */
145
+ off: (event: string, callback?: (...args: unknown[]) => void) => unknown;
146
+ /**
147
+ * Registers an SDK event listener.
148
+ *
149
+ * @param event - Event name to listen for.
150
+ * @param callback - Listener callback.
151
+ * @returns The Hightouch runtime or a promise-like value from the SDK.
152
+ */
153
+ on: (event: string, callback: (...args: unknown[]) => void) => unknown;
154
+ /**
155
+ * Adds source middleware before events are dispatched.
156
+ *
157
+ * @param middleware - Middleware function or vendor-supported middleware.
158
+ * @returns The Hightouch runtime or a promise-like value from the SDK.
159
+ */
160
+ addSourceMiddleware: (middleware: unknown) => unknown;
161
+ /**
162
+ * Adds integration middleware for destination-specific event transforms.
163
+ *
164
+ * @param integration - Integration name.
165
+ * @param middleware - Middleware function or vendor-supported middleware.
166
+ * @returns The Hightouch runtime or a promise-like value from the SDK.
167
+ */
168
+ addIntegrationMiddleware: (integration: string, middleware: unknown) => unknown;
169
+ /**
170
+ * Sets the anonymous ID used for subsequent events.
171
+ *
172
+ * @param anonymousId - Anonymous identifier to assign.
173
+ * @returns The Hightouch runtime or a promise-like value from the SDK.
174
+ */
175
+ setAnonymousId: (anonymousId: string) => unknown;
176
+ /**
177
+ * Adds destination middleware for event delivery.
178
+ *
179
+ * @param destination - Destination name.
180
+ * @param middleware - Middleware function or vendor-supported middleware.
181
+ * @returns The Hightouch runtime or a promise-like value from the SDK.
182
+ */
183
+ addDestinationMiddleware: (destination: string, middleware: unknown) => unknown;
184
+ }
185
+ declare global {
186
+ interface Window {
187
+ htevents?: HightouchApi;
188
+ }
189
+ }
190
+ /**
191
+ * Hightouch Events vendor manifest.
192
+ *
193
+ * Creates Hightouch's analytics.js-style `window.htevents` queue, records the
194
+ * write key/load options expected by the standalone loader, queues the
195
+ * `load()` and optional `page()` calls, then lets c15t own the script element.
196
+ */
197
+ export declare const hightouchManifest: {
198
+ readonly kind: "c15t.vendor-manifest";
199
+ readonly schemaVersion: 1;
200
+ readonly vendor: 'hightouch';
201
+ readonly category: 'measurement';
202
+ readonly bootstrap: [{
203
+ readonly type: 'setGlobal';
204
+ readonly name: 'htevents';
205
+ readonly value: readonly [];
206
+ readonly ifUndefined: true;
207
+ }, {
208
+ readonly type: 'defineQueueMethods';
209
+ readonly target: 'htevents';
210
+ readonly methods: ["trackSubmit", "trackClick", "trackLink", "trackForm", "pageview", "identify", "reset", "group", "track", "ready", "alias", "debug", "page", "once", "off", "on", "addSourceMiddleware", "addIntegrationMiddleware", "setAnonymousId", "addDestinationMiddleware", "load"];
211
+ }, {
212
+ readonly type: 'setGlobalPath';
213
+ readonly path: ["htevents", "_writeKey"];
214
+ readonly value: '{{writeKey}}';
215
+ }, {
216
+ readonly type: 'setGlobalPath';
217
+ readonly path: ["htevents", "_loadOptions"];
218
+ readonly value: '{{loadOptions}}';
219
+ }];
220
+ readonly install: [{
221
+ readonly type: 'callGlobal';
222
+ readonly global: 'htevents';
223
+ readonly method: 'load';
224
+ readonly args: ["{{writeKey}}", "{{loadOptions}}"];
225
+ }, {
226
+ readonly type: 'callGlobal';
227
+ readonly global: 'htevents';
228
+ readonly method: 'page';
229
+ }, {
230
+ readonly type: 'loadScript';
231
+ readonly src: '{{scriptUrl}}';
232
+ readonly async: true;
233
+ }];
234
+ };
235
+ export interface HightouchOptions {
236
+ /**
237
+ * Hightouch Events write key from your Event Source.
238
+ */
239
+ writeKey: string;
240
+ /**
241
+ * Optional Hightouch Events API host.
242
+ *
243
+ * Hightouch's browser SDK defaults to `us-east-1.hightouch-events.com`.
244
+ * Pass this only when your Event Source uses another region or a first-party
245
+ * tracking host.
246
+ */
247
+ apiHost?: string;
248
+ /**
249
+ * Queue the initial `htevents.page()` call during setup.
250
+ *
251
+ * @default true
252
+ */
253
+ trackPageView?: boolean;
254
+ /**
255
+ * Optional full loader URL override.
256
+ *
257
+ * @default 'https://cdn.hightouch-events.com/browser/release/v1-latest/events.min.js'
258
+ */
259
+ scriptUrl?: string;
260
+ }
261
+ /**
262
+ * Creates a Hightouch Events browser SDK script.
263
+ *
264
+ * @see https://hightouch.com/docs/events/sdks/browser
265
+ *
266
+ * @param options - The options for the Hightouch script.
267
+ * @returns The Hightouch script configuration.
268
+ * @throws {Error} When `writeKey` is missing or only whitespace.
269
+ *
270
+ * @remarks
271
+ * Hightouch Events collects customer behavior and sends it to the configured
272
+ * Event Source. c15t gates the browser SDK on `measurement` consent and does
273
+ * not allowlist collection endpoints in live probes beyond the CDN loader.
274
+ *
275
+ * @example
276
+ * ```ts
277
+ * import { hightouch } from '@c15t/scripts/hightouch';
278
+ *
279
+ * hightouch({
280
+ * writeKey: 'WRITE_KEY',
281
+ * apiHost: 'us-east-1.hightouch-events.com',
282
+ * });
283
+ * ```
284
+ */
285
+ export declare function hightouch({ writeKey, apiHost, trackPageView, scriptUrl, }: HightouchOptions): Script;
@@ -17,31 +17,31 @@ declare global {
17
17
  * the vendor bundle.
18
18
  */
19
19
  export declare const hotjarManifest: {
20
- readonly vendor: "hotjar";
21
- readonly category: "measurement";
20
+ readonly kind: "c15t.vendor-manifest";
21
+ readonly schemaVersion: 1;
22
+ readonly vendor: 'hotjar';
23
+ readonly category: 'measurement';
22
24
  readonly install: [{
23
- readonly type: "setGlobal";
24
- readonly name: "_hjSettings";
25
+ readonly type: 'setGlobal';
26
+ readonly name: '_hjSettings';
25
27
  readonly value: {
26
- readonly hjid: "{{siteId}}";
27
- readonly hjsv: "{{version}}";
28
+ readonly hjid: '{{siteId}}';
29
+ readonly hjsv: '{{version}}';
28
30
  };
29
31
  readonly ifUndefined: true;
30
32
  }, {
31
- readonly type: "defineStubFunction";
32
- readonly name: "hj";
33
+ readonly type: 'defineStubFunction';
34
+ readonly name: 'hj';
33
35
  readonly queue: {
34
- readonly property: "q";
36
+ readonly property: 'q';
35
37
  };
36
- readonly queueFormat: "array";
38
+ readonly queueFormat: 'array';
37
39
  readonly ifUndefined: true;
38
40
  }, {
39
- readonly type: "loadScript";
40
- readonly src: "{{scriptUrl}}";
41
+ readonly type: 'loadScript';
42
+ readonly src: '{{scriptUrl}}';
41
43
  readonly async: true;
42
44
  }];
43
- readonly kind: "c15t.vendor-manifest";
44
- readonly schemaVersion: 1;
45
45
  };
46
46
  export interface HotjarOptions {
47
47
  /**