@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
@@ -7,64 +7,74 @@ declare global {
7
7
  /**
8
8
  * Microsoft UET vendor manifest.
9
9
  *
10
- * Uses structured startup steps and manages consent via the UET push API:
11
- * `window.uetq.push('consent', 'default'|'update', { ad_storage: 'granted'|'denied' })`
10
+ * Loads in consent mode and manages consent via the UET push API:
11
+ * `window.uetq.push('consent', 'default'|'update', consentState)`.
12
12
  */
13
13
  export declare const microsoftUetManifest: {
14
- readonly vendor: "microsoft-uet";
15
- readonly category: "marketing";
14
+ readonly kind: "c15t.vendor-manifest";
15
+ readonly schemaVersion: 1;
16
+ readonly vendor: 'microsoft-uet';
17
+ readonly category: 'marketing';
18
+ readonly alwaysLoad: true;
16
19
  readonly persistAfterConsentRevoked: true;
17
20
  readonly bootstrap: [{
18
- readonly type: "setGlobal";
19
- readonly name: "uetq";
21
+ readonly type: 'setGlobal';
22
+ readonly name: 'uetq';
20
23
  readonly value: readonly [];
21
24
  readonly ifUndefined: true;
22
25
  }];
26
+ readonly onBeforeLoadGranted: [{
27
+ readonly type: 'callGlobal';
28
+ readonly global: 'uetq';
29
+ readonly method: 'push';
30
+ readonly args: ["consent", "default", {
31
+ readonly ad_storage: 'granted';
32
+ }];
33
+ }];
34
+ readonly onBeforeLoadDenied: [{
35
+ readonly type: 'callGlobal';
36
+ readonly global: 'uetq';
37
+ readonly method: 'push';
38
+ readonly args: ["consent", "default", {
39
+ readonly ad_storage: 'denied';
40
+ }];
41
+ }];
23
42
  readonly install: [{
24
- readonly type: "loadScript";
25
- readonly src: "{{scriptSrc}}";
43
+ readonly type: 'loadScript';
44
+ readonly src: '{{scriptSrc}}';
26
45
  readonly async: true;
27
46
  }];
28
47
  readonly afterLoad: [{
29
- readonly type: "constructGlobal";
30
- readonly constructor: "UET";
31
- readonly assignTo: "uetq";
48
+ readonly type: 'constructGlobal';
49
+ readonly constructor: 'UET';
50
+ readonly assignTo: 'uetq';
32
51
  readonly args: [{
33
- readonly ti: "{{id}}";
52
+ readonly ti: '{{id}}';
34
53
  readonly enableAutoSpaTracking: true;
35
54
  }];
36
- readonly copyAssignedValueToArgProperty: "q";
55
+ readonly copyAssignedValueToArgProperty: 'q';
37
56
  }, {
38
- readonly type: "callGlobal";
39
- readonly global: "uetq";
40
- readonly method: "push";
57
+ readonly type: 'callGlobal';
58
+ readonly global: 'uetq';
59
+ readonly method: 'push';
41
60
  readonly args: ["pageLoad"];
42
- }, {
43
- readonly type: "callGlobal";
44
- readonly global: "uetq";
45
- readonly method: "push";
46
- readonly args: ["consent", "default", {
47
- readonly ad_storage: "granted";
48
- }];
49
61
  }];
50
62
  readonly onConsentGranted: [{
51
- readonly type: "callGlobal";
52
- readonly global: "uetq";
53
- readonly method: "push";
63
+ readonly type: 'callGlobal';
64
+ readonly global: 'uetq';
65
+ readonly method: 'push';
54
66
  readonly args: ["consent", "update", {
55
- readonly ad_storage: "granted";
67
+ readonly ad_storage: 'granted';
56
68
  }];
57
69
  }];
58
70
  readonly onConsentDenied: [{
59
- readonly type: "callGlobal";
60
- readonly global: "uetq";
61
- readonly method: "push";
71
+ readonly type: 'callGlobal';
72
+ readonly global: 'uetq';
73
+ readonly method: 'push';
62
74
  readonly args: ["consent", "update", {
63
- readonly ad_storage: "denied";
75
+ readonly ad_storage: 'denied';
64
76
  }];
65
77
  }];
66
- readonly kind: "c15t.vendor-manifest";
67
- readonly schemaVersion: 1;
68
78
  };
69
79
  export interface MicrosoftUetOptions {
70
80
  /**
@@ -77,7 +87,8 @@ export interface MicrosoftUetOptions {
77
87
  }
78
88
  /**
79
89
  * Microsoft UET Script
80
- * This script is persistent after consent is revoked because it has built-in functionality to opt into and out of tracking based on consent, which allows us to not need to load the script again when consent is revoked.
90
+ * This script loads in consent mode and stays persistent because UET can opt
91
+ * into and out of tracking based on consent.
81
92
  *
82
93
  * @param options - The options for the Microsoft UET script
83
94
  * @returns The Microsoft UET script configuration
@@ -0,0 +1,211 @@
1
+ import type { Script } from 'c15t';
2
+ /**
3
+ * Reddit Pixel standard conversion event names.
4
+ *
5
+ * @see {@link https://business.reddithelp.com/s/article/supported-conversion-events | Reddit supported conversion events}
6
+ */
7
+ export type RedditPixelEventName = 'PageVisit' | 'ViewContent' | 'Search' | 'AddToCart' | 'AddToWishlist' | 'Purchase' | 'Lead' | 'SignUp';
8
+ /**
9
+ * Controls Reddit Pixel automatic advanced matching signals.
10
+ *
11
+ * @see {@link https://business.reddithelp.com/s/article/reddit-pixel | Reddit Pixel setup}
12
+ */
13
+ export interface RedditPixelAdvancedMatchingOptions {
14
+ /** Automatically scan page content for email addresses. */
15
+ email?: boolean;
16
+ /** Automatically scan page content for phone numbers. */
17
+ phone_number?: boolean;
18
+ }
19
+ /**
20
+ * Reddit Pixel initialization options.
21
+ *
22
+ * @see {@link https://business.reddithelp.com/s/article/reddit-pixel | Reddit Pixel setup}
23
+ * @see {@link https://business.reddithelp.com/s/article/Limited-Data-Use | Reddit Limited Data Use}
24
+ */
25
+ export interface RedditPixelInitOptions {
26
+ /**
27
+ * Opt the user out of Reddit Pixel tracking.
28
+ *
29
+ * Reddit sends this as `opt_out=1` on pixel requests.
30
+ */
31
+ optOut?: boolean;
32
+ /**
33
+ * Disable Reddit first-party cookies during initialization.
34
+ */
35
+ disableFirstPartyCookies?: boolean;
36
+ /** Email address or SHA-256 email hash for attribution matching. */
37
+ email?: string;
38
+ /** Phone number or SHA-256 phone hash for attribution matching. */
39
+ phoneNumber?: string;
40
+ /** External user identifier or SHA-256 hash for attribution matching. */
41
+ externalId?: string;
42
+ /** Android Advertising ID or SHA-256 hash. */
43
+ aaid?: string;
44
+ /** iOS Identifier for Advertisers or SHA-256 hash. */
45
+ idfa?: string;
46
+ /** Automatic advanced matching controls. */
47
+ aam?: RedditPixelAdvancedMatchingOptions;
48
+ /**
49
+ * Data processing mode, including Reddit Limited Data Use values.
50
+ *
51
+ * @see {@link https://business.reddithelp.com/s/article/Limited-Data-Use | Reddit Limited Data Use}
52
+ */
53
+ dpm?: string | string[];
54
+ /**
55
+ * Data processing country code.
56
+ *
57
+ * @see {@link https://business.reddithelp.com/s/article/Limited-Data-Use | Reddit Limited Data Use}
58
+ */
59
+ dpcc?: string;
60
+ /**
61
+ * Data processing region code.
62
+ *
63
+ * @see {@link https://business.reddithelp.com/s/article/Limited-Data-Use | Reddit Limited Data Use}
64
+ */
65
+ dprc?: string;
66
+ /** Integration partner name. */
67
+ partner?: string;
68
+ /** Integration partner version. */
69
+ partner_version?: string;
70
+ /** Source integration name reported to Reddit. */
71
+ integration?: 'reddit' | 'gtm' | (string & {});
72
+ /** Enable Reddit Pixel debug logging. */
73
+ debug?: boolean;
74
+ /**
75
+ * Send monetary `value` metadata as `valueDecimal`.
76
+ *
77
+ * @default true
78
+ */
79
+ useDecimalCurrencyValues?: boolean;
80
+ [key: string]: unknown;
81
+ }
82
+ /**
83
+ * Metadata supported by Reddit Pixel conversion events.
84
+ *
85
+ * @see {@link https://business.reddithelp.com/s/article/about-event-metadata | Reddit event metadata}
86
+ * @see {@link https://business.reddithelp.com/s/article/manual-conversion-events-with-the-reddit-pixel | Reddit manual conversion events}
87
+ */
88
+ export interface RedditPixelEventMetadata {
89
+ itemCount?: number | string;
90
+ value?: number | string;
91
+ valueDecimal?: number | string;
92
+ currency?: string;
93
+ transactionId?: string;
94
+ customEventName?: string;
95
+ products?: string | Array<{
96
+ id?: string | number;
97
+ name?: string;
98
+ category?: string;
99
+ quantity?: number | string;
100
+ itemPrice?: number | string;
101
+ }>;
102
+ /**
103
+ * Conversion ID used to deduplicate Pixel events against Conversions API
104
+ * events.
105
+ *
106
+ * @see {@link https://business.reddithelp.com/s/article/event-deduplication | Reddit event deduplication}
107
+ */
108
+ conversionId?: string;
109
+ [key: string]: unknown;
110
+ }
111
+ type RedditPixelFunction = {
112
+ (command: 'init', pixelId: string, options?: RedditPixelInitOptions): void;
113
+ (command: 'enableFirstPartyCookies'): void;
114
+ (command: 'disableFirstPartyCookies'): void;
115
+ (command: 'track', eventName: RedditPixelEventName | (string & {}), properties?: RedditPixelEventMetadata): void;
116
+ (command: string, ...args: unknown[]): void;
117
+ };
118
+ declare global {
119
+ interface Window {
120
+ rdt?: RedditPixelFunction & {
121
+ callQueue?: unknown[][];
122
+ sendEvent?: (...args: unknown[]) => void;
123
+ };
124
+ }
125
+ }
126
+ /**
127
+ * Reddit Pixel vendor manifest.
128
+ *
129
+ * Sets up Reddit's queue stub and optionally queues the standard page visit
130
+ * event before the external bundle loads.
131
+ */
132
+ export declare const redditPixelManifest: {
133
+ readonly kind: "c15t.vendor-manifest";
134
+ readonly schemaVersion: 1;
135
+ readonly vendor: 'reddit-pixel';
136
+ readonly category: 'marketing';
137
+ readonly persistAfterConsentRevoked: true;
138
+ readonly bootstrap: [{
139
+ readonly type: 'defineStubFunction';
140
+ readonly name: 'rdt';
141
+ readonly queue: {
142
+ readonly property: 'callQueue';
143
+ };
144
+ readonly dispatchProperty: 'sendEvent';
145
+ readonly queueFormat: 'array';
146
+ readonly ifUndefined: true;
147
+ }];
148
+ readonly install: [{
149
+ readonly type: 'callGlobal';
150
+ readonly global: 'rdt';
151
+ readonly args: ["init", "{{pixelId}}"];
152
+ }, {
153
+ readonly type: 'callGlobal';
154
+ readonly global: 'rdt';
155
+ readonly args: ["track", "PageVisit"];
156
+ }, {
157
+ readonly type: 'loadScript';
158
+ readonly src: '{{scriptUrl}}';
159
+ readonly async: true;
160
+ }];
161
+ readonly onConsentGranted: [{
162
+ readonly type: 'callGlobal';
163
+ readonly global: 'rdt';
164
+ readonly args: ["enableFirstPartyCookies"];
165
+ }];
166
+ readonly onConsentDenied: [{
167
+ readonly type: 'callGlobal';
168
+ readonly global: 'rdt';
169
+ readonly args: ["disableFirstPartyCookies"];
170
+ }];
171
+ };
172
+ export interface RedditPixelOptions {
173
+ /**
174
+ * Your Reddit Pixel ID.
175
+ * @example `t2_abcdef`
176
+ */
177
+ pixelId: string;
178
+ /**
179
+ * Queue the standard `PageVisit` event during setup.
180
+ * @default true
181
+ */
182
+ trackPageVisit?: boolean;
183
+ /**
184
+ * Optional payload passed as the third argument to `rdt('init', ...)`.
185
+ */
186
+ initOptions?: RedditPixelInitOptions;
187
+ /**
188
+ * Disable Reddit first-party cookies during setup.
189
+ *
190
+ * This is merged into `initOptions.disableFirstPartyCookies`.
191
+ */
192
+ disableFirstPartyCookies?: boolean;
193
+ /** Reddit Pixel loader URL. */
194
+ scriptUrl?: string;
195
+ }
196
+ /**
197
+ * Creates a Reddit Pixel script.
198
+ *
199
+ * @param options - The options for the Reddit Pixel script.
200
+ * @returns The Reddit Pixel script configuration.
201
+ */
202
+ export declare function redditPixel({ pixelId, trackPageVisit, initOptions, disableFirstPartyCookies, scriptUrl, }: RedditPixelOptions): Script;
203
+ /**
204
+ * Tracks a Reddit Pixel event.
205
+ *
206
+ * @param eventName - Reddit standard event name or a custom event name.
207
+ * @param metadata - Optional event metadata, including `conversionId` for
208
+ * Pixel plus Conversions API deduplication.
209
+ */
210
+ export declare const redditPixelEvent: (eventName: RedditPixelEventName | (string & {}), metadata?: RedditPixelEventMetadata) => void;
211
+ export {};
@@ -0,0 +1,171 @@
1
+ import type { Script } from 'c15t';
2
+ export type SnapchatPixelEventName = 'PAGE_VIEW' | 'VIEW_CONTENT' | 'ADD_CART' | 'PURCHASE' | 'SIGN_UP' | 'SAVE' | 'START_CHECKOUT' | 'APP_OPEN' | 'ADD_BILLING' | 'SEARCH' | 'SUBSCRIBE' | 'AD_CLICK' | 'AD_VIEW' | 'COMPLETE_TUTORIAL' | 'LEVEL_COMPLETE' | 'INVITE' | 'LOGIN' | 'SHARE' | 'RESERVE' | 'ACHIEVEMENT_UNLOCKED' | 'ADD_TO_WISHLIST' | 'SPENT_CREDITS' | 'RATE' | 'START_TRIAL' | 'LIST_VIEW';
3
+ export interface SnapchatPixelEventProperties {
4
+ /** Total monetary value for commerce events such as `PURCHASE`. */
5
+ price?: number;
6
+ /**
7
+ * Event identifier used to deduplicate browser Pixel events against
8
+ * server-side Conversions API events.
9
+ */
10
+ client_dedup_id?: string;
11
+ /** ISO 4217 currency code, for example `USD`. */
12
+ currency?: string;
13
+ /** Transaction/order identifier for purchase events. */
14
+ transaction_id?: string;
15
+ /** Product, SKU, or content identifiers associated with the event. */
16
+ item_ids?: string[];
17
+ /** Product or content category associated with the event. */
18
+ item_category?: string;
19
+ /** Free-form description for the event. */
20
+ description?: string;
21
+ /** Query text for `SEARCH` events. */
22
+ search_string?: string;
23
+ /** Number of items represented by the event. */
24
+ number_items?: number;
25
+ /** Whether payment information was available, represented as `0` or `1`. */
26
+ payment_info_available?: 0 | 1;
27
+ /** Signup method for `SIGN_UP` events. */
28
+ sign_up_method?: string;
29
+ /** Whether the action succeeded, represented as `0` or `1`. */
30
+ success?: 0 | 1;
31
+ /** Brand names associated with the event contents. */
32
+ brands?: string[];
33
+ /** Fulfillment method for commerce events. */
34
+ delivery_method?: 'in_store' | 'curbside' | 'delivery';
35
+ /** Customer lifecycle status associated with the event. */
36
+ customer_status?: 'new' | 'returning' | 'reactivated';
37
+ /** Optional custom tag for event segmentation in Snapchat. */
38
+ event_tag?: string;
39
+ [key: string]: unknown;
40
+ }
41
+ type SnapchatPixelFunction = {
42
+ (command: 'track', eventName: SnapchatPixelEventName | (string & {}), properties?: SnapchatPixelEventProperties): void;
43
+ (command: 'init', pixelId: string, config?: Record<string, unknown>): void;
44
+ (command: string, ...args: unknown[]): void;
45
+ };
46
+ declare global {
47
+ interface Window {
48
+ snaptr?: SnapchatPixelFunction & {
49
+ handleRequest?: (...args: unknown[]) => void;
50
+ loaded?: boolean;
51
+ push?: Window['snaptr'];
52
+ queue?: unknown[][];
53
+ version?: string;
54
+ };
55
+ _snaptr?: Window['snaptr'];
56
+ }
57
+ }
58
+ /**
59
+ * Snapchat Pixel vendor manifest.
60
+ *
61
+ * Uses a structured queue stub and queues `init` plus an optional
62
+ * `PAGE_VIEW` event before the vendor bundle loads.
63
+ */
64
+ export declare const snapchatPixelManifest: {
65
+ readonly kind: "c15t.vendor-manifest";
66
+ readonly schemaVersion: 1;
67
+ readonly vendor: 'snapchat-pixel';
68
+ readonly category: 'marketing';
69
+ readonly bootstrap: [{
70
+ readonly type: 'defineStubFunction';
71
+ readonly name: 'snaptr';
72
+ readonly queue: {
73
+ readonly property: 'queue';
74
+ };
75
+ readonly dispatchProperty: 'handleRequest';
76
+ readonly queueFormat: 'array';
77
+ readonly aliases: ["_snaptr"];
78
+ readonly selfReferences: ["push"];
79
+ readonly properties: {
80
+ readonly loaded: true;
81
+ readonly version: '1.0';
82
+ };
83
+ readonly ifUndefined: true;
84
+ }];
85
+ readonly install: [{
86
+ readonly type: 'callGlobal';
87
+ readonly global: 'snaptr';
88
+ readonly args: ["init", "{{pixelId}}"];
89
+ }, {
90
+ readonly type: 'callGlobal';
91
+ readonly global: 'snaptr';
92
+ readonly args: ["track", "PAGE_VIEW"];
93
+ }, {
94
+ readonly type: 'loadScript';
95
+ readonly src: '{{scriptUrl}}';
96
+ readonly async: true;
97
+ }];
98
+ };
99
+ export interface SnapchatPixelOptions {
100
+ /**
101
+ * Your Snapchat Pixel ID.
102
+ * @example `123456789012345`
103
+ */
104
+ pixelId: string;
105
+ /** Optional init payload passed to `snaptr('init', ...)`. */
106
+ initOptions?: Record<string, unknown>;
107
+ /**
108
+ * Queue the default `PAGE_VIEW` event during setup.
109
+ * @default true
110
+ */
111
+ trackPageView?: boolean;
112
+ /** Snapchat Pixel loader URL. */
113
+ scriptUrl?: string;
114
+ }
115
+ /**
116
+ * Creates a Snapchat Pixel script.
117
+ *
118
+ * @param options.pixelId - Snapchat Pixel ID used in `snaptr('init', ...)`.
119
+ * Expected format is a numeric string (commonly 15 digits), for example
120
+ * `'123456789012345'`. This value is required and should come directly from
121
+ * Snapchat Ads Manager.
122
+ * @param options.initOptions - Optional object passed as the third argument to
123
+ * `snaptr('init', pixelId, initOptions)`, for advanced initialization values.
124
+ * Example: `{ user_email: 'user@example.com', user_phone_number: '+15551234567' }`.
125
+ * @param options.trackPageView - Whether to queue the default
126
+ * `snaptr('track', 'PAGE_VIEW')` call during setup. Defaults to `true`; set to
127
+ * `false` when you want to control page-view tracking manually.
128
+ * @returns A resolved c15t `Script` configuration that defines the Snapchat
129
+ * queue stub, runs `init` (and optionally `PAGE_VIEW`), and then loads the
130
+ * Snapchat SDK script URL.
131
+ * @throws `resolveManifest` may throw when required placeholders cannot be
132
+ * resolved (for example, when `pixelId` is missing/empty) or when provided
133
+ * manifest values are invalid for interpolation.
134
+ *
135
+ * Edge cases:
136
+ * - Missing `pixelId` causes manifest resolution to fail.
137
+ * - Non-numeric or malformed `pixelId` values may initialize incorrectly in
138
+ * Snapchat even if local script construction succeeds.
139
+ *
140
+ * @example
141
+ * ```ts
142
+ * const script = snapchatPixel({
143
+ * pixelId: '123456789012345',
144
+ * initOptions: {
145
+ * user_email: 'user@example.com',
146
+ * user_phone_number: '+15551234567',
147
+ * },
148
+ * trackPageView: false,
149
+ * });
150
+ * ```
151
+ */
152
+ export declare function snapchatPixel({ pixelId, initOptions, trackPageView, scriptUrl, }: SnapchatPixelOptions): Script;
153
+ /**
154
+ * Tracks a Snapchat Pixel event.
155
+ *
156
+ * @param eventName - Snapchat standard event name or a custom event name.
157
+ * @param properties - Optional event properties, including
158
+ * `client_dedup_id` for Pixel plus Conversions API deduplication.
159
+ *
160
+ * @example
161
+ * ```ts
162
+ * snapchatPixelEvent('PURCHASE', {
163
+ * price: 99,
164
+ * currency: 'USD',
165
+ * transaction_id: 'order-123',
166
+ * client_dedup_id: 'event-123',
167
+ * });
168
+ * ```
169
+ */
170
+ export declare const snapchatPixelEvent: (eventName: SnapchatPixelEventName | (string & {}), properties?: SnapchatPixelEventProperties) => void;
171
+ export {};
@@ -1,11 +1,25 @@
1
1
  import type { Script } from 'c15t';
2
+ interface TikTokPixelFunction {
3
+ grantConsent: () => void;
4
+ revokeConsent: () => void;
5
+ page: () => void;
6
+ track: (eventName: string, properties?: Record<string, unknown>) => void;
7
+ identify: (properties?: Record<string, unknown>) => void;
8
+ instances: (...args: unknown[]) => void;
9
+ debug: (...args: unknown[]) => void;
10
+ on: (...args: unknown[]) => void;
11
+ off: (...args: unknown[]) => void;
12
+ once: (...args: unknown[]) => void;
13
+ ready: (...args: unknown[]) => void;
14
+ alias: (...args: unknown[]) => void;
15
+ group: (...args: unknown[]) => void;
16
+ enableCookie: (...args: unknown[]) => void;
17
+ disableCookie: (...args: unknown[]) => void;
18
+ holdConsent: (...args: unknown[]) => void;
19
+ }
2
20
  declare global {
3
21
  interface Window {
4
- ttq: {
5
- grantConsent: () => void;
6
- revokeConsent: () => void;
7
- page: () => void;
8
- };
22
+ ttq: TikTokPixelFunction;
9
23
  }
10
24
  }
11
25
  /**
@@ -15,53 +29,53 @@ declare global {
15
29
  * via `ttq.grantConsent()` / `ttq.revokeConsent()`.
16
30
  */
17
31
  export declare const tiktokPixelManifest: {
18
- readonly vendor: "tiktok-pixel";
19
- readonly category: "marketing";
32
+ readonly kind: "c15t.vendor-manifest";
33
+ readonly schemaVersion: 1;
34
+ readonly vendor: 'tiktok-pixel';
35
+ readonly category: 'marketing';
20
36
  readonly persistAfterConsentRevoked: true;
21
37
  readonly bootstrap: [{
22
- readonly type: "setGlobal";
23
- readonly name: "TiktokAnalyticsObject";
24
- readonly value: "ttq";
38
+ readonly type: 'setGlobal';
39
+ readonly name: 'TiktokAnalyticsObject';
40
+ readonly value: 'ttq';
25
41
  }, {
26
- readonly type: "setGlobal";
27
- readonly name: "ttq";
42
+ readonly type: 'setGlobal';
43
+ readonly name: 'ttq';
28
44
  readonly value: readonly [];
29
45
  readonly ifUndefined: true;
30
46
  }, {
31
- readonly type: "defineQueueMethods";
32
- readonly target: "ttq";
47
+ readonly type: 'defineQueueMethods';
48
+ readonly target: 'ttq';
33
49
  readonly methods: ["page", "track", "identify", "instances", "debug", "on", "off", "once", "ready", "alias", "group", "enableCookie", "disableCookie", "holdConsent", "revokeConsent", "grantConsent"];
34
50
  }];
35
51
  readonly install: [{
36
- readonly type: "callGlobal";
37
- readonly global: "ttq";
38
- readonly method: "grantConsent";
52
+ readonly type: 'callGlobal';
53
+ readonly global: 'ttq';
54
+ readonly method: 'grantConsent';
39
55
  }, {
40
- readonly type: "callGlobal";
41
- readonly global: "ttq";
42
- readonly method: "page";
56
+ readonly type: 'callGlobal';
57
+ readonly global: 'ttq';
58
+ readonly method: 'page';
43
59
  }, {
44
- readonly type: "loadScript";
45
- readonly src: "{{scriptSrc}}?sdkid={{pixelId}}&lib=ttq";
60
+ readonly type: 'loadScript';
61
+ readonly src: '{{scriptSrc}}?sdkid={{pixelId}}&lib=ttq';
46
62
  readonly async: true;
47
63
  }];
48
64
  readonly afterLoad: [{
49
- readonly type: "callGlobal";
50
- readonly global: "ttq";
51
- readonly method: "grantConsent";
65
+ readonly type: 'callGlobal';
66
+ readonly global: 'ttq';
67
+ readonly method: 'grantConsent';
52
68
  }];
53
69
  readonly onConsentGranted: [{
54
- readonly type: "callGlobal";
55
- readonly global: "ttq";
56
- readonly method: "grantConsent";
70
+ readonly type: 'callGlobal';
71
+ readonly global: 'ttq';
72
+ readonly method: 'grantConsent';
57
73
  }];
58
74
  readonly onConsentDenied: [{
59
- readonly type: "callGlobal";
60
- readonly global: "ttq";
61
- readonly method: "revokeConsent";
75
+ readonly type: 'callGlobal';
76
+ readonly global: 'ttq';
77
+ readonly method: 'revokeConsent';
62
78
  }];
63
- readonly kind: "c15t.vendor-manifest";
64
- readonly schemaVersion: 1;
65
79
  };
66
80
  export interface TikTokPixelOptions {
67
81
  /**
@@ -89,3 +103,4 @@ export interface TikTokPixelOptions {
89
103
  * @see {@link https://ads.tiktok.com/help/article/tiktok-pixel} TikTok Pixel documentation
90
104
  */
91
105
  export declare function tiktokPixel({ pixelId, scriptSrc, }: TikTokPixelOptions): Script;
106
+ export {};