@c15t/scripts 2.0.1 → 2.2.0-canary-20260727202135

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 (182) hide show
  1. package/AGENTS.md +62 -0
  2. package/README.md +41 -29
  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 +111 -17
  7. package/dist/engine/runtime.js +102 -12
  8. package/dist/registry.cjs +423 -0
  9. package/dist/registry.js +372 -0
  10. package/dist/resolve.cjs +9 -5
  11. package/dist/types.cjs +32 -10
  12. package/dist/types.js +10 -1
  13. package/dist/vendors/_shared/attributes.cjs +55 -0
  14. package/dist/vendors/_shared/attributes.js +14 -0
  15. package/dist/vendors/_shared/google-consent.cjs +69 -0
  16. package/dist/vendors/_shared/google-consent.js +27 -0
  17. package/dist/vendors/_shared/install-builders.cjs +59 -0
  18. package/dist/vendors/_shared/install-builders.js +21 -0
  19. package/dist/vendors/_shared/script-url.cjs +78 -0
  20. package/dist/vendors/_shared/script-url.js +28 -0
  21. package/dist/{linkedin-insights.cjs → vendors/ads-and-pixels/linkedin-insights.cjs} +11 -7
  22. package/dist/{linkedin-insights.js → vendors/ads-and-pixels/linkedin-insights.js} +2 -2
  23. package/dist/vendors/ads-and-pixels/meta-pixel.cjs +206 -0
  24. package/dist/vendors/ads-and-pixels/meta-pixel.js +153 -0
  25. package/dist/{microsoft-uet.cjs → vendors/ads-and-pixels/microsoft-uet.cjs} +42 -21
  26. package/dist/{microsoft-uet.js → vendors/ads-and-pixels/microsoft-uet.js} +31 -14
  27. package/dist/vendors/ads-and-pixels/reddit-pixel.cjs +151 -0
  28. package/dist/vendors/ads-and-pixels/reddit-pixel.js +107 -0
  29. package/dist/vendors/ads-and-pixels/snapchat-pixel.cjs +131 -0
  30. package/dist/vendors/ads-and-pixels/snapchat-pixel.js +87 -0
  31. package/dist/{tiktok-pixel.cjs → vendors/ads-and-pixels/tiktok-pixel.cjs} +11 -7
  32. package/dist/{tiktok-pixel.js → vendors/ads-and-pixels/tiktok-pixel.js} +2 -2
  33. package/dist/{x-pixel.cjs → vendors/ads-and-pixels/x-pixel.cjs} +15 -8
  34. package/dist/{x-pixel.js → vendors/ads-and-pixels/x-pixel.js} +6 -3
  35. package/dist/vendors/analytics/adobe-analytics.cjs +90 -0
  36. package/dist/vendors/analytics/adobe-analytics.js +49 -0
  37. package/dist/vendors/analytics/ahrefs-analytics.cjs +68 -0
  38. package/dist/vendors/analytics/ahrefs-analytics.js +27 -0
  39. package/dist/vendors/analytics/amplitude.cjs +193 -0
  40. package/dist/vendors/analytics/amplitude.js +134 -0
  41. package/dist/vendors/analytics/clearbit.cjs +69 -0
  42. package/dist/vendors/analytics/clearbit.js +28 -0
  43. package/dist/vendors/analytics/cloudflare-web-analytics.cjs +73 -0
  44. package/dist/vendors/analytics/cloudflare-web-analytics.js +32 -0
  45. package/dist/{databuddy.cjs → vendors/analytics/databuddy.cjs} +14 -10
  46. package/dist/{databuddy.js → vendors/analytics/databuddy.js} +3 -3
  47. package/dist/vendors/analytics/fathom-analytics.cjs +76 -0
  48. package/dist/vendors/analytics/fathom-analytics.js +35 -0
  49. package/dist/{google-tag.cjs → vendors/analytics/google-tag.cjs} +18 -35
  50. package/dist/{google-tag.js → vendors/analytics/google-tag.js} +7 -28
  51. package/dist/vendors/analytics/heap.cjs +181 -0
  52. package/dist/vendors/analytics/heap.js +134 -0
  53. package/dist/vendors/analytics/hightouch.cjs +153 -0
  54. package/dist/vendors/analytics/hightouch.js +109 -0
  55. package/dist/vendors/analytics/hotjar.cjs +85 -0
  56. package/dist/vendors/analytics/hotjar.js +44 -0
  57. package/dist/vendors/analytics/logrocket.cjs +99 -0
  58. package/dist/vendors/analytics/logrocket.js +58 -0
  59. package/dist/vendors/analytics/matomo-analytics.cjs +232 -0
  60. package/dist/vendors/analytics/matomo-analytics.js +191 -0
  61. package/dist/vendors/analytics/microsoft-clarity.cjs +138 -0
  62. package/dist/vendors/analytics/microsoft-clarity.js +97 -0
  63. package/dist/vendors/analytics/mixpanel-analytics.cjs +134 -0
  64. package/dist/vendors/analytics/mixpanel-analytics.js +93 -0
  65. package/dist/vendors/analytics/pirsch.cjs +108 -0
  66. package/dist/vendors/analytics/pirsch.js +67 -0
  67. package/dist/vendors/analytics/plausible-analytics.cjs +122 -0
  68. package/dist/vendors/analytics/plausible-analytics.js +81 -0
  69. package/dist/vendors/analytics/posthog.cjs +204 -0
  70. package/dist/vendors/analytics/posthog.js +163 -0
  71. package/dist/vendors/analytics/promptwatch.cjs +70 -0
  72. package/dist/vendors/analytics/promptwatch.js +29 -0
  73. package/dist/vendors/analytics/rudderstack.cjs +227 -0
  74. package/dist/vendors/analytics/rudderstack.js +183 -0
  75. package/dist/vendors/analytics/rybbit-analytics.cjs +104 -0
  76. package/dist/vendors/analytics/rybbit-analytics.js +63 -0
  77. package/dist/vendors/analytics/segment.cjs +97 -0
  78. package/dist/vendors/analytics/segment.js +56 -0
  79. package/dist/vendors/analytics/umami-analytics.cjs +80 -0
  80. package/dist/vendors/analytics/umami-analytics.js +39 -0
  81. package/dist/vendors/analytics/vercel-analytics.cjs +94 -0
  82. package/dist/vendors/analytics/vercel-analytics.js +53 -0
  83. package/dist/vendors/functional/crisp.cjs +143 -0
  84. package/dist/vendors/functional/crisp.js +102 -0
  85. package/dist/vendors/functional/intercom.cjs +89 -0
  86. package/dist/vendors/functional/intercom.js +45 -0
  87. package/dist/{google-tag-manager.cjs → vendors/tag-managers/google-tag-manager.cjs} +17 -34
  88. package/dist/{google-tag-manager.js → vendors/tag-managers/google-tag-manager.js} +6 -27
  89. package/dist-types/__tests__/helpers.d.ts +141 -0
  90. package/dist-types/engine/runtime.d.ts +1 -1
  91. package/dist-types/registry.d.ts +440 -0
  92. package/dist-types/types.d.ts +53 -2
  93. package/dist-types/vendors/_shared/attributes.d.ts +35 -0
  94. package/dist-types/vendors/_shared/google-consent.d.ts +47 -0
  95. package/dist-types/vendors/_shared/install-builders.d.ts +30 -0
  96. package/dist-types/vendors/_shared/script-url.d.ts +75 -0
  97. package/dist-types/vendors/ads-and-pixels/linkedin-insights.d.ts +92 -0
  98. package/dist-types/vendors/ads-and-pixels/meta-pixel.d.ts +289 -0
  99. package/dist-types/{microsoft-uet.d.ts → vendors/ads-and-pixels/microsoft-uet.d.ts} +45 -34
  100. package/dist-types/vendors/ads-and-pixels/reddit-pixel.d.ts +211 -0
  101. package/dist-types/vendors/ads-and-pixels/snapchat-pixel.d.ts +171 -0
  102. package/dist-types/{tiktok-pixel.d.ts → vendors/ads-and-pixels/tiktok-pixel.d.ts} +48 -33
  103. package/dist-types/{x-pixel.d.ts → vendors/ads-and-pixels/x-pixel.d.ts} +34 -17
  104. package/dist-types/vendors/analytics/adobe-analytics.d.ts +75 -0
  105. package/dist-types/vendors/analytics/ahrefs-analytics.d.ts +62 -0
  106. package/dist-types/vendors/analytics/amplitude.d.ts +234 -0
  107. package/dist-types/vendors/analytics/clearbit.d.ts +60 -0
  108. package/dist-types/vendors/analytics/cloudflare-web-analytics.d.ts +67 -0
  109. package/dist-types/{databuddy.d.ts → vendors/analytics/databuddy.d.ts} +25 -25
  110. package/dist-types/vendors/analytics/fathom-analytics.d.ts +90 -0
  111. package/dist-types/{google-tag.d.ts → vendors/analytics/google-tag.d.ts} +21 -24
  112. package/dist-types/vendors/analytics/heap.d.ts +316 -0
  113. package/dist-types/vendors/analytics/hightouch.d.ts +285 -0
  114. package/dist-types/vendors/analytics/hotjar.d.ts +73 -0
  115. package/dist-types/vendors/analytics/logrocket.d.ts +101 -0
  116. package/dist-types/vendors/analytics/matomo-analytics.d.ts +41 -0
  117. package/dist-types/vendors/analytics/microsoft-clarity.d.ts +98 -0
  118. package/dist-types/vendors/analytics/mixpanel-analytics.d.ts +113 -0
  119. package/dist-types/vendors/analytics/pirsch.d.ts +96 -0
  120. package/dist-types/vendors/analytics/plausible-analytics.d.ts +122 -0
  121. package/dist-types/vendors/analytics/posthog.d.ts +154 -0
  122. package/dist-types/vendors/analytics/promptwatch.d.ts +36 -0
  123. package/dist-types/vendors/analytics/rudderstack.d.ts +330 -0
  124. package/dist-types/vendors/analytics/rybbit-analytics.d.ts +82 -0
  125. package/dist-types/vendors/analytics/segment.d.ts +158 -0
  126. package/dist-types/vendors/analytics/umami-analytics.d.ts +93 -0
  127. package/dist-types/vendors/analytics/vercel-analytics.d.ts +66 -0
  128. package/dist-types/vendors/functional/crisp.d.ts +78 -0
  129. package/dist-types/vendors/functional/intercom.d.ts +135 -0
  130. package/dist-types/{google-tag-manager.d.ts → vendors/tag-managers/google-tag-manager.d.ts} +22 -25
  131. package/docs/README.md +62 -0
  132. package/docs/frameworks/javascript/script-loader.md +354 -0
  133. package/docs/frameworks/next/script-loader.md +499 -0
  134. package/docs/frameworks/react/script-loader.md +553 -0
  135. package/docs/integrations/adobe-analytics.md +160 -0
  136. package/docs/integrations/ahrefs-analytics.md +157 -0
  137. package/docs/integrations/amplitude.md +230 -0
  138. package/docs/integrations/building-integrations.md +239 -0
  139. package/docs/integrations/clearbit.md +130 -0
  140. package/docs/integrations/cloudflare-web-analytics.md +126 -0
  141. package/docs/integrations/crisp.md +140 -0
  142. package/docs/integrations/databuddy.md +205 -0
  143. package/docs/integrations/fathom-analytics.md +150 -0
  144. package/docs/integrations/google-maps.md +263 -0
  145. package/docs/integrations/google-tag-manager.md +154 -0
  146. package/docs/integrations/google-tag.md +134 -0
  147. package/docs/integrations/heap.md +219 -0
  148. package/docs/integrations/hightouch.md +199 -0
  149. package/docs/integrations/hotjar.md +143 -0
  150. package/docs/integrations/intercom.md +144 -0
  151. package/docs/integrations/linkedin-insights.md +161 -0
  152. package/docs/integrations/logrocket.md +175 -0
  153. package/docs/integrations/matomo-analytics.md +171 -0
  154. package/docs/integrations/meta-pixel.md +412 -0
  155. package/docs/integrations/microsoft-clarity.md +173 -0
  156. package/docs/integrations/microsoft-uet.md +156 -0
  157. package/docs/integrations/mixpanel-analytics.md +130 -0
  158. package/docs/integrations/overview.md +149 -0
  159. package/docs/integrations/pirsch.md +142 -0
  160. package/docs/integrations/plausible-analytics.md +154 -0
  161. package/docs/integrations/posthog.md +258 -0
  162. package/docs/integrations/promptwatch.md +121 -0
  163. package/docs/integrations/reddit-pixel.md +241 -0
  164. package/docs/integrations/rudderstack.md +271 -0
  165. package/docs/integrations/rybbit-analytics.md +143 -0
  166. package/docs/integrations/segment.md +146 -0
  167. package/docs/integrations/snapchat-pixel.md +163 -0
  168. package/docs/integrations/tiktok-pixel.md +123 -0
  169. package/docs/integrations/umami-analytics.md +148 -0
  170. package/docs/integrations/vercel-analytics.md +141 -0
  171. package/docs/integrations/x-pixel.md +157 -0
  172. package/docs/integrations/youtube.md +193 -0
  173. package/docs/shared/react/guides/script-loader.md +309 -0
  174. package/package.json +223 -8
  175. package/readme.json +8 -4
  176. package/dist/meta-pixel.cjs +0 -129
  177. package/dist/meta-pixel.js +0 -89
  178. package/dist/posthog.cjs +0 -137
  179. package/dist/posthog.js +0 -100
  180. package/dist-types/linkedin-insights.d.ts +0 -79
  181. package/dist-types/meta-pixel.d.ts +0 -185
  182. package/dist-types/posthog.d.ts +0 -112
@@ -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;
@@ -0,0 +1,73 @@
1
+ import type { Script } from 'c15t';
2
+ declare global {
3
+ interface Window {
4
+ hj?: ((...args: unknown[]) => void) & {
5
+ q?: unknown[][];
6
+ };
7
+ _hjSettings?: {
8
+ hjid: number | string;
9
+ hjsv: number;
10
+ };
11
+ }
12
+ }
13
+ /**
14
+ * Hotjar vendor manifest.
15
+ *
16
+ * Seeds the global Hotjar settings object and queue stub before loading
17
+ * the vendor bundle.
18
+ */
19
+ export declare const hotjarManifest: {
20
+ readonly kind: "c15t.vendor-manifest";
21
+ readonly schemaVersion: 1;
22
+ readonly vendor: 'hotjar';
23
+ readonly category: 'measurement';
24
+ readonly install: [{
25
+ readonly type: 'setGlobal';
26
+ readonly name: '_hjSettings';
27
+ readonly value: {
28
+ readonly hjid: '{{siteId}}';
29
+ readonly hjsv: '{{version}}';
30
+ };
31
+ readonly ifUndefined: true;
32
+ }, {
33
+ readonly type: 'defineStubFunction';
34
+ readonly name: 'hj';
35
+ readonly queue: {
36
+ readonly property: 'q';
37
+ };
38
+ readonly queueFormat: 'array';
39
+ readonly ifUndefined: true;
40
+ }, {
41
+ readonly type: 'loadScript';
42
+ readonly src: '{{scriptUrl}}';
43
+ readonly async: true;
44
+ }];
45
+ };
46
+ export interface HotjarOptions {
47
+ /**
48
+ * Your Hotjar site ID.
49
+ * @example `1234567`
50
+ */
51
+ siteId: number | string;
52
+ /**
53
+ * Hotjar script version.
54
+ * @default 6
55
+ */
56
+ version?: number;
57
+ /** Hotjar loader URL. */
58
+ scriptUrl?: string;
59
+ }
60
+ /**
61
+ * Creates a Hotjar script.
62
+ *
63
+ * @param options - The options for the Hotjar script.
64
+ * @returns The Hotjar script configuration.
65
+ *
66
+ * @example
67
+ * ```ts
68
+ * import { hotjar } from '@c15t/scripts/hotjar';
69
+ *
70
+ * hotjar({ siteId: 1234567 });
71
+ * ```
72
+ */
73
+ export declare function hotjar({ siteId, version, scriptUrl, }: HotjarOptions): Script;
@@ -0,0 +1,101 @@
1
+ import type { Script } from 'c15t';
2
+ declare global {
3
+ interface Window {
4
+ LogRocket?: {
5
+ init: (appId: string, options?: Record<string, unknown>) => void;
6
+ identify?: (id: string, traits?: Record<string, unknown>) => void;
7
+ track?: (event: string, properties?: Record<string, unknown>) => void;
8
+ getSessionURL?: (callback: (sessionUrl: string) => void) => void;
9
+ start?: () => void;
10
+ startNewSession?: () => void;
11
+ uninstall?: () => void;
12
+ };
13
+ }
14
+ }
15
+ /**
16
+ * LogRocket vendor manifest.
17
+ *
18
+ * Loads the browser SDK and initializes it after the loader fires its `load`
19
+ * event. LogRocket does not document a consent opt-out or stop-recording API
20
+ * for the web SDK, so c15t gates the loader on measurement consent and unloads
21
+ * the script element when that consent is revoked.
22
+ */
23
+ export declare const logRocketManifest: {
24
+ readonly kind: "c15t.vendor-manifest";
25
+ readonly schemaVersion: 1;
26
+ readonly vendor: 'logrocket';
27
+ readonly category: 'measurement';
28
+ readonly install: [{
29
+ readonly type: 'loadScript';
30
+ readonly src: '{{scriptUrl}}';
31
+ readonly attributes: {
32
+ readonly crossorigin: 'anonymous';
33
+ };
34
+ }];
35
+ readonly afterLoad: [{
36
+ readonly type: 'callGlobal';
37
+ readonly global: 'LogRocket';
38
+ readonly method: 'init';
39
+ readonly args: ["{{appId}}", "{{initOptions}}"];
40
+ }];
41
+ };
42
+ export interface LogRocketOptions {
43
+ /**
44
+ * Your LogRocket app ID in `org-slug/app-slug` format.
45
+ */
46
+ appId: string;
47
+ /**
48
+ * LogRocket init options passed as the second `LogRocket.init()` argument.
49
+ *
50
+ * The manifest engine serializes this object as a template variable, so use
51
+ * JSON-serializable values only (no functions, class instances, prototypes,
52
+ * `Map`, `Set`, or other non-JSON types).
53
+ */
54
+ initOptions?: Record<string, unknown>;
55
+ /**
56
+ * Custom LogRocket loader URL.
57
+ * @default 'https://cdn.logrocket.io/LogRocket.min.js'
58
+ */
59
+ scriptUrl?: string;
60
+ /**
61
+ * Proxied URL for LogRocket's asynchronously loaded logger bundle.
62
+ *
63
+ * LogRocket's proxy setup requires `window._lrAsyncScript` in addition to
64
+ * the main `scriptUrl`, because the SDK chain-loads its logger bundle from
65
+ * this location. Only needed when proxying traffic through your own
66
+ * domain.
67
+ *
68
+ * @see https://docs.logrocket.com/docs/proxying-traffic-through-your-own-domain
69
+ */
70
+ asyncScriptUrl?: string;
71
+ }
72
+ /**
73
+ * Creates a LogRocket script.
74
+ *
75
+ * @see https://docs.logrocket.com/reference/init
76
+ *
77
+ * @param options - The options for the LogRocket script.
78
+ * @returns The LogRocket script.
79
+ * @throws {Error} When `appId` is missing, empty, or not in `org/app` format.
80
+ * Provide the app ID from LogRocket Project Setup to prevent this error.
81
+ *
82
+ * @remarks
83
+ * LogRocket records session replay and monitoring data. Configure LogRocket's
84
+ * privacy and sanitization options before deployment so sensitive DOM, input,
85
+ * network, or application state data is excluded from recordings.
86
+ *
87
+ * @example
88
+ * ```ts
89
+ * import { logRocket } from '@c15t/scripts/logrocket';
90
+ *
91
+ * logRocket({
92
+ * appId: 'org-slug/app-slug',
93
+ * initOptions: {
94
+ * dom: {
95
+ * inputSanitizer: true,
96
+ * },
97
+ * },
98
+ * });
99
+ * ```
100
+ */
101
+ export declare function logRocket(options: LogRocketOptions): Script;
@@ -0,0 +1,41 @@
1
+ import type { Script } from 'c15t';
2
+ import { type VendorManifest } from '../../types';
3
+ declare global {
4
+ interface Window {
5
+ _paq?: unknown[];
6
+ }
7
+ }
8
+ export declare const matomoAnalyticsManifest: VendorManifest;
9
+ export interface MatomoAnalyticsOptions {
10
+ /** Your Matomo site ID. */
11
+ siteId?: string | number;
12
+ /** Your Matomo base URL, for example `https://analytics.example.com`. */
13
+ matomoUrl?: string;
14
+ /** Your Matomo Cloud identifier, for example `my-site.matomo.cloud`. */
15
+ cloudId?: string;
16
+ /** Optional explicit tracker endpoint override. */
17
+ trackerUrl?: string;
18
+ /** Optional explicit script URL override. */
19
+ scriptUrl?: string;
20
+ /** Queue `enableLinkTracking`. */
21
+ enableLinkTracking?: boolean;
22
+ /** Queue `disableCookies`. */
23
+ disableCookies?: boolean;
24
+ /** Queue an initial `trackPageView`. */
25
+ trackPageView?: boolean;
26
+ /** Default Matomo consent state (`required` blocks, `given` starts enabled). */
27
+ defaultConsent?: 'required' | 'given';
28
+ }
29
+ /**
30
+ * Creates a Matomo Analytics script.
31
+ *
32
+ * @param options - The options for the Matomo Analytics script.
33
+ * @returns The Matomo Analytics script configuration.
34
+ * @throws {Error} Throws
35
+ * `'matomoAnalytics requires \`matomoUrl\`, \`cloudId\`, or explicit \`trackerUrl\` and \`scriptUrl\` values.'`
36
+ * when either resolved `trackerUrl` or `scriptUrl` is missing (for example,
37
+ * when neither `matomoUrl` nor `cloudId` is provided and explicit
38
+ * `trackerUrl`/`scriptUrl` values are not supplied). Provide `matomoUrl`, or
39
+ * provide both explicit `trackerUrl` and `scriptUrl`.
40
+ */
41
+ export declare function matomoAnalytics(options?: MatomoAnalyticsOptions): Script;
@@ -0,0 +1,98 @@
1
+ import type { Script } from 'c15t';
2
+ /**
3
+ * Microsoft Clarity Consent V2 storage state.
4
+ *
5
+ * Clarity accepts string consent values instead of booleans for its granular
6
+ * `ad_Storage` and `analytics_Storage` channels.
7
+ */
8
+ export type ClarityConsentState = 'granted' | 'denied';
9
+ /**
10
+ * Consent V2 payload sent to Microsoft Clarity.
11
+ *
12
+ * c15t maps `marketing` consent to `ad_Storage` and `measurement` consent to
13
+ * `analytics_Storage`.
14
+ */
15
+ export interface ClarityConsentV2Payload {
16
+ ad_Storage: ClarityConsentState;
17
+ analytics_Storage: ClarityConsentState;
18
+ }
19
+ /**
20
+ * Optional boot-time consent override accepted by the Clarity helper.
21
+ *
22
+ * Booleans apply the same value to both Clarity Consent V2 channels. Object
23
+ * values may use Clarity keys or c15t category aliases and are merged over the
24
+ * current c15t consent state.
25
+ */
26
+ export type ClarityConsentValue = boolean | Partial<Record<keyof ClarityConsentV2Payload | 'ad_storage' | 'analytics_storage' | 'marketing' | 'measurement' | 'analytics', ClarityConsentState | boolean>>;
27
+ type ClarityFunction = {
28
+ (command: 'consent', value?: boolean): void;
29
+ (command: 'consentv2', value: ClarityConsentV2Payload): void;
30
+ (command: 'event', value: string): void;
31
+ (command: 'identify', id: string, session?: string, page?: string): unknown;
32
+ (command: 'set', key: string, value: string | string[]): void;
33
+ (command: 'start', options?: Record<string, unknown>): void;
34
+ (command: 'upgrade', reason: string): void;
35
+ (command: string, ...args: unknown[]): unknown;
36
+ };
37
+ declare global {
38
+ interface Window {
39
+ clarity?: ClarityFunction & {
40
+ q?: unknown[][];
41
+ };
42
+ }
43
+ }
44
+ /**
45
+ * Microsoft Clarity vendor manifest.
46
+ *
47
+ * Seeds the global queue stub before loading the vendor bundle and uses
48
+ * Clarity's Consent V2 API for granular analytics and ad storage transitions.
49
+ */
50
+ export declare const clarityManifest: {
51
+ readonly kind: "c15t.vendor-manifest";
52
+ readonly schemaVersion: 1;
53
+ readonly vendor: 'microsoft-clarity';
54
+ readonly category: 'measurement';
55
+ readonly persistAfterConsentRevoked: true;
56
+ readonly bootstrap: [{
57
+ readonly type: 'defineStubFunction';
58
+ readonly name: 'clarity';
59
+ readonly queue: {
60
+ readonly property: 'q';
61
+ };
62
+ readonly queueFormat: 'array';
63
+ readonly ifUndefined: true;
64
+ }];
65
+ readonly install: [{
66
+ readonly type: 'loadScript';
67
+ readonly src: '{{scriptUrl}}';
68
+ readonly async: true;
69
+ }];
70
+ };
71
+ export interface ClarityOptions {
72
+ /**
73
+ * Your Microsoft Clarity project ID.
74
+ * @example `abcdef1234`
75
+ */
76
+ id: string;
77
+ /**
78
+ * Optional initial Consent V2 value queued before the script loads.
79
+ *
80
+ * By default, c15t maps `measurement` to `analytics_Storage` and `marketing`
81
+ * to `ad_Storage`. Pass this only when boot-time consent must override the
82
+ * current c15t consent state.
83
+ */
84
+ defaultConsent?: ClarityConsentValue;
85
+ /** Clarity loader URL. */
86
+ scriptUrl?: string;
87
+ }
88
+ /**
89
+ * Creates a Microsoft Clarity script.
90
+ *
91
+ * @param options - The options for the Clarity script.
92
+ * @returns The Clarity script configuration.
93
+ * @throws {Error} When `options.id` is missing or invalid and no `scriptUrl`
94
+ * override is provided. Provide a valid Clarity project id string to prevent
95
+ * this error.
96
+ */
97
+ export declare function clarity({ id, defaultConsent, scriptUrl, }: ClarityOptions): Script;
98
+ export {};