@c15t/scripts 2.0.1 → 2.1.0

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 (106) hide show
  1. package/README.md +9 -9
  2. package/dist/engine/runtime.cjs +11 -0
  3. package/dist/engine/runtime.js +11 -0
  4. package/dist/registry.cjs +338 -0
  5. package/dist/registry.js +292 -0
  6. package/dist/types.cjs +18 -0
  7. package/dist/types.js +10 -1
  8. package/dist/vendors/_shared/attributes.cjs +51 -0
  9. package/dist/vendors/_shared/attributes.js +14 -0
  10. package/dist/vendors/_shared/google-consent.cjs +64 -0
  11. package/dist/vendors/_shared/google-consent.js +27 -0
  12. package/dist/vendors/_shared/install-builders.cjs +55 -0
  13. package/dist/vendors/_shared/install-builders.js +21 -0
  14. package/dist/vendors/_shared/script-url.cjs +74 -0
  15. package/dist/vendors/_shared/script-url.js +28 -0
  16. package/dist/{linkedin-insights.cjs → vendors/ads-and-pixels/linkedin-insights.cjs} +2 -2
  17. package/dist/{linkedin-insights.js → vendors/ads-and-pixels/linkedin-insights.js} +2 -2
  18. package/dist/vendors/ads-and-pixels/meta-pixel.cjs +202 -0
  19. package/dist/vendors/ads-and-pixels/meta-pixel.js +153 -0
  20. package/dist/{microsoft-uet.cjs → vendors/ads-and-pixels/microsoft-uet.cjs} +31 -14
  21. package/dist/{microsoft-uet.js → vendors/ads-and-pixels/microsoft-uet.js} +31 -14
  22. package/dist/vendors/ads-and-pixels/reddit-pixel.cjs +147 -0
  23. package/dist/vendors/ads-and-pixels/reddit-pixel.js +107 -0
  24. package/dist/vendors/ads-and-pixels/snapchat-pixel.cjs +127 -0
  25. package/dist/vendors/ads-and-pixels/snapchat-pixel.js +87 -0
  26. package/dist/{tiktok-pixel.cjs → vendors/ads-and-pixels/tiktok-pixel.cjs} +2 -2
  27. package/dist/{tiktok-pixel.js → vendors/ads-and-pixels/tiktok-pixel.js} +2 -2
  28. package/dist/{x-pixel.cjs → vendors/ads-and-pixels/x-pixel.cjs} +6 -3
  29. package/dist/{x-pixel.js → vendors/ads-and-pixels/x-pixel.js} +6 -3
  30. package/dist/vendors/analytics/ahrefs-analytics.cjs +64 -0
  31. package/dist/vendors/analytics/ahrefs-analytics.js +27 -0
  32. package/dist/vendors/analytics/cloudflare-web-analytics.cjs +69 -0
  33. package/dist/vendors/analytics/cloudflare-web-analytics.js +32 -0
  34. package/dist/{databuddy.cjs → vendors/analytics/databuddy.cjs} +3 -3
  35. package/dist/{databuddy.js → vendors/analytics/databuddy.js} +3 -3
  36. package/dist/vendors/analytics/fathom-analytics.cjs +72 -0
  37. package/dist/vendors/analytics/fathom-analytics.js +35 -0
  38. package/dist/{google-tag.cjs → vendors/analytics/google-tag.cjs} +7 -28
  39. package/dist/{google-tag.js → vendors/analytics/google-tag.js} +7 -28
  40. package/dist/vendors/analytics/hotjar.cjs +81 -0
  41. package/dist/vendors/analytics/hotjar.js +44 -0
  42. package/dist/vendors/analytics/matomo-analytics.cjs +228 -0
  43. package/dist/vendors/analytics/matomo-analytics.js +191 -0
  44. package/dist/vendors/analytics/microsoft-clarity.cjs +110 -0
  45. package/dist/vendors/analytics/microsoft-clarity.js +73 -0
  46. package/dist/vendors/analytics/mixpanel-analytics.cjs +119 -0
  47. package/dist/vendors/analytics/mixpanel-analytics.js +82 -0
  48. package/dist/vendors/analytics/plausible-analytics.cjs +118 -0
  49. package/dist/vendors/analytics/plausible-analytics.js +81 -0
  50. package/dist/{posthog.cjs → vendors/analytics/posthog.cjs} +69 -6
  51. package/dist/vendors/analytics/posthog.js +163 -0
  52. package/dist/vendors/analytics/promptwatch.cjs +66 -0
  53. package/dist/vendors/analytics/promptwatch.js +29 -0
  54. package/dist/vendors/analytics/rybbit-analytics.cjs +100 -0
  55. package/dist/vendors/analytics/rybbit-analytics.js +63 -0
  56. package/dist/vendors/analytics/segment.cjs +93 -0
  57. package/dist/vendors/analytics/segment.js +56 -0
  58. package/dist/vendors/analytics/umami-analytics.cjs +76 -0
  59. package/dist/vendors/analytics/umami-analytics.js +39 -0
  60. package/dist/vendors/analytics/vercel-analytics.cjs +90 -0
  61. package/dist/vendors/analytics/vercel-analytics.js +53 -0
  62. package/dist/vendors/functional/crisp.cjs +139 -0
  63. package/dist/vendors/functional/crisp.js +102 -0
  64. package/dist/vendors/functional/intercom.cjs +85 -0
  65. package/dist/vendors/functional/intercom.js +45 -0
  66. package/dist/{google-tag-manager.cjs → vendors/tag-managers/google-tag-manager.cjs} +6 -27
  67. package/dist/{google-tag-manager.js → vendors/tag-managers/google-tag-manager.js} +6 -27
  68. package/dist-types/__tests__/helpers.d.ts +141 -0
  69. package/dist-types/engine/runtime.d.ts +1 -1
  70. package/dist-types/registry.d.ts +368 -0
  71. package/dist-types/types.d.ts +13 -0
  72. package/dist-types/vendors/_shared/attributes.d.ts +35 -0
  73. package/dist-types/vendors/_shared/google-consent.d.ts +47 -0
  74. package/dist-types/vendors/_shared/install-builders.d.ts +30 -0
  75. package/dist-types/vendors/_shared/script-url.d.ts +75 -0
  76. package/dist-types/{linkedin-insights.d.ts → vendors/ads-and-pixels/linkedin-insights.d.ts} +22 -9
  77. package/dist-types/vendors/ads-and-pixels/meta-pixel.d.ts +289 -0
  78. package/dist-types/{microsoft-uet.d.ts → vendors/ads-and-pixels/microsoft-uet.d.ts} +21 -10
  79. package/dist-types/vendors/ads-and-pixels/reddit-pixel.d.ts +211 -0
  80. package/dist-types/vendors/ads-and-pixels/snapchat-pixel.d.ts +171 -0
  81. package/dist-types/{tiktok-pixel.d.ts → vendors/ads-and-pixels/tiktok-pixel.d.ts} +20 -5
  82. package/dist-types/{x-pixel.d.ts → vendors/ads-and-pixels/x-pixel.d.ts} +21 -4
  83. package/dist-types/vendors/analytics/ahrefs-analytics.d.ts +62 -0
  84. package/dist-types/vendors/analytics/cloudflare-web-analytics.d.ts +67 -0
  85. package/dist-types/vendors/analytics/fathom-analytics.d.ts +90 -0
  86. package/dist-types/{google-tag.d.ts → vendors/analytics/google-tag.d.ts} +5 -8
  87. package/dist-types/vendors/analytics/hotjar.d.ts +73 -0
  88. package/dist-types/vendors/analytics/matomo-analytics.d.ts +41 -0
  89. package/dist-types/vendors/analytics/microsoft-clarity.d.ts +86 -0
  90. package/dist-types/vendors/analytics/mixpanel-analytics.d.ts +101 -0
  91. package/dist-types/vendors/analytics/plausible-analytics.d.ts +122 -0
  92. package/dist-types/{posthog.d.ts → vendors/analytics/posthog.d.ts} +47 -5
  93. package/dist-types/vendors/analytics/promptwatch.d.ts +36 -0
  94. package/dist-types/vendors/analytics/rybbit-analytics.d.ts +82 -0
  95. package/dist-types/vendors/analytics/segment.d.ts +158 -0
  96. package/dist-types/vendors/analytics/umami-analytics.d.ts +93 -0
  97. package/dist-types/vendors/analytics/vercel-analytics.d.ts +66 -0
  98. package/dist-types/vendors/functional/crisp.d.ts +78 -0
  99. package/dist-types/vendors/functional/intercom.d.ts +135 -0
  100. package/dist-types/{google-tag-manager.d.ts → vendors/tag-managers/google-tag-manager.d.ts} +5 -8
  101. package/package.json +165 -4
  102. package/dist/meta-pixel.cjs +0 -129
  103. package/dist/meta-pixel.js +0 -89
  104. package/dist/posthog.js +0 -100
  105. package/dist-types/meta-pixel.d.ts +0 -185
  106. /package/dist-types/{databuddy.d.ts → vendors/analytics/databuddy.d.ts} +0 -0
@@ -0,0 +1,289 @@
1
+ import type { Script } from 'c15t';
2
+ /**
3
+ * Represents the `contents` array object property.
4
+ */
5
+ export interface FbqContent {
6
+ id: string | number;
7
+ quantity: number;
8
+ [key: string]: unknown;
9
+ }
10
+ /**
11
+ * Base interface for all possible event parameters.
12
+ * All properties are optional here; specific event types will make them required.
13
+ */
14
+ export interface FbqBaseEventParams {
15
+ content_category?: string;
16
+ content_ids?: (string | number)[];
17
+ content_name?: string;
18
+ content_type?: 'product' | 'product_group';
19
+ contents?: FbqContent[];
20
+ currency?: string;
21
+ delivery_category?: 'in_store' | 'curbside' | 'home_delivery';
22
+ num_items?: number;
23
+ predicted_ltv?: number;
24
+ search_string?: string;
25
+ status?: boolean;
26
+ value?: number;
27
+ }
28
+ export type FbqCustomParams = Record<string, unknown>;
29
+ type WithCustomParams<TParams> = TParams & FbqCustomParams;
30
+ type AddPaymentInfoParams = WithCustomParams<Pick<FbqBaseEventParams, 'content_ids' | 'contents' | 'currency' | 'value'>>;
31
+ type AddToCartParams = WithCustomParams<Pick<FbqBaseEventParams, 'content_ids' | 'content_type' | 'contents' | 'currency' | 'value'>>;
32
+ type AddToWishlistParams = WithCustomParams<Pick<FbqBaseEventParams, 'content_ids' | 'contents' | 'currency' | 'value'>>;
33
+ type CompleteRegistrationParams = WithCustomParams<Pick<FbqBaseEventParams, 'currency' | 'value' | 'status'>>;
34
+ type InitiateCheckoutParams = WithCustomParams<Pick<FbqBaseEventParams, 'content_ids' | 'contents' | 'currency' | 'num_items' | 'value'>>;
35
+ type LeadParams = WithCustomParams<Pick<FbqBaseEventParams, 'currency' | 'value'>>;
36
+ type PageViewParams = FbqCustomParams;
37
+ type SearchParams = WithCustomParams<Pick<FbqBaseEventParams, 'content_ids' | 'content_type' | 'contents' | 'currency' | 'search_string' | 'value'>>;
38
+ type StartTrialParams = WithCustomParams<Pick<FbqBaseEventParams, 'currency' | 'predicted_ltv' | 'value'>>;
39
+ type SubscribeParams = WithCustomParams<Pick<FbqBaseEventParams, 'currency' | 'predicted_ltv' | 'value'>>;
40
+ type ViewContentParams = WithCustomParams<Pick<FbqBaseEventParams, 'content_ids' | 'content_type' | 'contents' | 'currency' | 'value'>>;
41
+ /**
42
+ * The 'Purchase' event has required properties.
43
+ * We use TypeScript's utility types to enforce this.
44
+ */
45
+ type PurchaseParams = WithCustomParams<Pick<FbqBaseEventParams, 'content_ids' | 'content_type' | 'contents' | 'num_items'> & Required<Pick<FbqBaseEventParams, 'currency' | 'value'>>>;
46
+ /**
47
+ * Events with no specific properties listed can accept any of the base parameters.
48
+ */
49
+ type ContactParams = WithCustomParams<FbqBaseEventParams>;
50
+ type CustomizeProductParams = WithCustomParams<FbqBaseEventParams>;
51
+ type DonateParams = WithCustomParams<FbqBaseEventParams>;
52
+ type FindLocationParams = WithCustomParams<FbqBaseEventParams>;
53
+ type ScheduleParams = WithCustomParams<FbqBaseEventParams>;
54
+ type SubmitApplicationParams = WithCustomParams<FbqBaseEventParams>;
55
+ /**
56
+ * A mapping of Standard Event names to their corresponding parameter types.
57
+ * This is the core of our type-safety mechanism.
58
+ */
59
+ export interface StandardEventParams {
60
+ AddPaymentInfo: AddPaymentInfoParams;
61
+ AddToCart: AddToCartParams;
62
+ AddToWishlist: AddToWishlistParams;
63
+ CompleteRegistration: CompleteRegistrationParams;
64
+ Contact: ContactParams;
65
+ CustomizeProduct: CustomizeProductParams;
66
+ Donate: DonateParams;
67
+ FindLocation: FindLocationParams;
68
+ InitiateCheckout: InitiateCheckoutParams;
69
+ Lead: LeadParams;
70
+ PageView: PageViewParams;
71
+ Purchase: PurchaseParams;
72
+ Schedule: ScheduleParams;
73
+ Search: SearchParams;
74
+ StartTrial: StartTrialParams;
75
+ SubmitApplication: SubmitApplicationParams;
76
+ Subscribe: SubscribeParams;
77
+ ViewContent: ViewContentParams;
78
+ }
79
+ export type StandardEventName = keyof StandardEventParams;
80
+ export interface MetaPixelEventOptions {
81
+ /**
82
+ * Event ID used to deduplicate browser events against Conversions API events.
83
+ *
84
+ * @see https://developers.facebook.com/docs/marketing-api/conversions-api/deduplicate-pixel-and-server-events
85
+ */
86
+ eventID?: string;
87
+ [key: string]: unknown;
88
+ }
89
+ export interface MetaPixelDataProcessingOptions {
90
+ /**
91
+ * Data processing flags sent to Meta before `init`.
92
+ *
93
+ * Use `['LDU']` to enable Limited Data Use, or `[]` to explicitly disable it.
94
+ */
95
+ options: 'LDU'[] | [];
96
+ /**
97
+ * Meta country code. Use `0` to let Meta geolocate the event or `1` for USA.
98
+ */
99
+ country?: number;
100
+ /**
101
+ * Meta state code. Use `0` to let Meta geolocate the event.
102
+ *
103
+ * @example `1000` for California
104
+ */
105
+ state?: number;
106
+ }
107
+ declare global {
108
+ interface Window {
109
+ fbq: {
110
+ (command: 'dataProcessingOptions', options: MetaPixelDataProcessingOptions['options'], country?: number, state?: number): void;
111
+ (command: 'init', pixelId: string, options?: Record<string, unknown>): void;
112
+ (command: 'track', eventName: StandardEventName, params?: StandardEventParams[StandardEventName], options?: MetaPixelEventOptions): void;
113
+ (command: 'trackCustom', eventName: string, params?: FbqCustomParams, options?: MetaPixelEventOptions): void;
114
+ (command: 'trackSingle', pixelId: string, eventName: StandardEventName, params?: StandardEventParams[StandardEventName], options?: MetaPixelEventOptions): void;
115
+ (command: 'trackSingleCustom', pixelId: string, eventName: string, params?: FbqCustomParams, options?: MetaPixelEventOptions): void;
116
+ (command: 'consent', action: 'grant' | 'revoke'): void;
117
+ (...args: unknown[]): void;
118
+ };
119
+ _fbq: Window['fbq'];
120
+ }
121
+ }
122
+ /**
123
+ * Meta Pixel vendor manifest.
124
+ *
125
+ * The Meta Pixel uses structured bootstrap steps to define the standard `fbq`
126
+ * stub and provides a consent API via `fbq('consent', 'grant'|'revoke')`.
127
+ */
128
+ export declare const metaPixelManifest: {
129
+ readonly vendor: "meta-pixel";
130
+ readonly category: "marketing";
131
+ readonly persistAfterConsentRevoked: true;
132
+ readonly bootstrap: [{
133
+ readonly type: "defineStubFunction";
134
+ readonly name: "fbq";
135
+ readonly queue: {
136
+ readonly property: "queue";
137
+ };
138
+ readonly dispatchProperty: "callMethod";
139
+ readonly selfReferences: ["push"];
140
+ readonly aliases: ["_fbq"];
141
+ readonly properties: {
142
+ readonly loaded: true;
143
+ readonly version: "2.0";
144
+ };
145
+ readonly ifUndefined: true;
146
+ }];
147
+ readonly install: [{
148
+ readonly type: "callGlobal";
149
+ readonly global: "fbq";
150
+ readonly args: ["consent", "grant"];
151
+ }, {
152
+ readonly type: "callGlobal";
153
+ readonly global: "fbq";
154
+ readonly args: ["init", "{{pixelId}}"];
155
+ }, {
156
+ readonly type: "callGlobal";
157
+ readonly global: "fbq";
158
+ readonly args: ["track", "PageView"];
159
+ }, {
160
+ readonly type: "loadScript";
161
+ readonly src: "{{scriptSrc}}";
162
+ readonly async: true;
163
+ }];
164
+ readonly onConsentGranted: [{
165
+ readonly type: "callGlobal";
166
+ readonly global: "fbq";
167
+ readonly args: ["consent", "grant"];
168
+ }];
169
+ readonly onConsentDenied: [{
170
+ readonly type: "callGlobal";
171
+ readonly global: "fbq";
172
+ readonly args: ["consent", "revoke"];
173
+ }];
174
+ readonly kind: "c15t.vendor-manifest";
175
+ readonly schemaVersion: 1;
176
+ };
177
+ export interface MetaPixelOptions {
178
+ /**
179
+ * Your Meta Pixel ID
180
+ * @example `123456789012345`
181
+ */
182
+ pixelId: string;
183
+ /** Optional payload passed as the third argument to `fbq('init', ...)`. */
184
+ initOptions?: Record<string, unknown>;
185
+ /**
186
+ * Queue the default `PageView` event during setup.
187
+ *
188
+ * @default true
189
+ */
190
+ trackPageView?: boolean;
191
+ /**
192
+ * Optional Meta data processing options, such as Limited Data Use.
193
+ *
194
+ * When provided, c15t queues `fbq('dataProcessingOptions', ...)` before
195
+ * `fbq('init', ...)`.
196
+ */
197
+ dataProcessingOptions?: MetaPixelDataProcessingOptions;
198
+ /** Meta Pixel loader URL. */
199
+ scriptSrc?: string;
200
+ }
201
+ /**
202
+ * Creates a Meta Pixel script.
203
+ *
204
+ * The manifest defines a structured `fbq` stub plus the external loader URL,
205
+ * avoiding raw inline vendor snippets in the manifest payload.
206
+ *
207
+ * @param options - The options for the Meta Pixel script
208
+ * @returns The Meta Pixel script configuration
209
+ *
210
+ * @example
211
+ * ```ts
212
+ * const metaPixelScript = metaPixel({
213
+ * pixelId: '123456789012345',
214
+ * });
215
+ * ```
216
+ *
217
+ * @see {@link https://developers.facebook.com/docs/meta-pixel/get-started} Meta Pixel documentation
218
+ */
219
+ export declare function metaPixel({ pixelId, initOptions, trackPageView, dataProcessingOptions, scriptSrc, }: MetaPixelOptions): Script;
220
+ /**
221
+ * Tracks a Meta Pixel standard event.
222
+ *
223
+ * This is a wrapper around `fbq('track', ...)`.
224
+ *
225
+ * @template TEventName - The Meta `StandardEventName` being tracked.
226
+ * @param eventName - The `StandardEventName` to track.
227
+ * @param params - Optional `StandardEventParams[TEventName]` payload.
228
+ * @param eventOptions - Optional `MetaPixelEventOptions` or event ID string.
229
+ * @returns `void`; calls `window.fbq`.
230
+ *
231
+ * @example
232
+ * ```ts
233
+ * metaPixelEvent('Purchase', { value: 10.0, currency: 'USD' }, 'event-123');
234
+ * ```
235
+ *
236
+ * @see {@link https://developers.facebook.com/docs/meta-pixel/reference} Meta Pixel documentation
237
+ */
238
+ export declare const metaPixelEvent: <TEventName extends StandardEventName>(eventName: TEventName, params?: StandardEventParams[TEventName], eventOptions?: MetaPixelEventOptions | string) => void;
239
+ /**
240
+ * Tracks a Meta Pixel custom event with optional custom parameters.
241
+ *
242
+ * @param eventName - The custom event name to track
243
+ * @param params - Optional custom parameters to track
244
+ * @param eventOptions - Optional event options, including Conversions API eventID
245
+ */
246
+ export declare const metaPixelCustomEvent: (eventName: string, params?: FbqCustomParams, eventOptions?: MetaPixelEventOptions | string) => void;
247
+ /**
248
+ * Tracks a standard event for a single Meta Pixel ID.
249
+ *
250
+ * Use this when multiple Meta Pixels are initialized on the same page and the
251
+ * event should not fire for every initialized pixel.
252
+ *
253
+ * @template TEventName - The Meta `StandardEventName` being tracked.
254
+ * @param pixelId - Meta Pixel ID that should receive the event.
255
+ * @param eventName - The `StandardEventName` to track.
256
+ * @param params - Optional `StandardEventParams[TEventName]` payload.
257
+ * @param eventOptions - Optional `MetaPixelEventOptions` or event ID string.
258
+ * @returns `void`; calls `window.fbq`.
259
+ *
260
+ * @example
261
+ * ```ts
262
+ * metaPixelSingleEvent(
263
+ * '123456',
264
+ * 'Purchase',
265
+ * { value: 9.99, currency: 'USD' },
266
+ * 'event-123'
267
+ * );
268
+ * ```
269
+ */
270
+ export declare const metaPixelSingleEvent: <TEventName extends StandardEventName>(pixelId: string, eventName: TEventName, params?: StandardEventParams[TEventName], eventOptions?: MetaPixelEventOptions | string) => void;
271
+ /**
272
+ * Tracks a custom event for a single Meta Pixel ID.
273
+ *
274
+ * Use this when multiple Meta Pixels are initialized on the same page and the
275
+ * custom event should not fire for every initialized pixel.
276
+ *
277
+ * @param pixelId - Meta Pixel ID that should receive the custom event.
278
+ * @param eventName - Custom event name to track.
279
+ * @param params - Optional `FbqCustomParams` payload.
280
+ * @param eventOptions - Optional `MetaPixelEventOptions` or event ID string.
281
+ * @returns `void`; calls `window.fbq`.
282
+ *
283
+ * @example
284
+ * ```ts
285
+ * metaPixelSingleCustomEvent('123456', 'MyCustomEvent', { foo: 'bar' });
286
+ * ```
287
+ */
288
+ export declare const metaPixelSingleCustomEvent: (pixelId: string, eventName: string, params?: FbqCustomParams, eventOptions?: MetaPixelEventOptions | string) => void;
289
+ export {};
@@ -7,12 +7,13 @@ 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
14
  readonly vendor: "microsoft-uet";
15
15
  readonly category: "marketing";
16
+ readonly alwaysLoad: true;
16
17
  readonly persistAfterConsentRevoked: true;
17
18
  readonly bootstrap: [{
18
19
  readonly type: "setGlobal";
@@ -20,6 +21,22 @@ export declare const microsoftUetManifest: {
20
21
  readonly value: readonly [];
21
22
  readonly ifUndefined: true;
22
23
  }];
24
+ readonly onBeforeLoadGranted: [{
25
+ readonly type: "callGlobal";
26
+ readonly global: "uetq";
27
+ readonly method: "push";
28
+ readonly args: ["consent", "default", {
29
+ readonly ad_storage: "granted";
30
+ }];
31
+ }];
32
+ readonly onBeforeLoadDenied: [{
33
+ readonly type: "callGlobal";
34
+ readonly global: "uetq";
35
+ readonly method: "push";
36
+ readonly args: ["consent", "default", {
37
+ readonly ad_storage: "denied";
38
+ }];
39
+ }];
23
40
  readonly install: [{
24
41
  readonly type: "loadScript";
25
42
  readonly src: "{{scriptSrc}}";
@@ -39,13 +56,6 @@ export declare const microsoftUetManifest: {
39
56
  readonly global: "uetq";
40
57
  readonly method: "push";
41
58
  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
59
  }];
50
60
  readonly onConsentGranted: [{
51
61
  readonly type: "callGlobal";
@@ -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 vendor: "reddit-pixel";
134
+ readonly category: "marketing";
135
+ readonly persistAfterConsentRevoked: true;
136
+ readonly bootstrap: [{
137
+ readonly type: "defineStubFunction";
138
+ readonly name: "rdt";
139
+ readonly queue: {
140
+ readonly property: "callQueue";
141
+ };
142
+ readonly dispatchProperty: "sendEvent";
143
+ readonly queueFormat: "array";
144
+ readonly ifUndefined: true;
145
+ }];
146
+ readonly install: [{
147
+ readonly type: "callGlobal";
148
+ readonly global: "rdt";
149
+ readonly args: ["init", "{{pixelId}}"];
150
+ }, {
151
+ readonly type: "callGlobal";
152
+ readonly global: "rdt";
153
+ readonly args: ["track", "PageVisit"];
154
+ }, {
155
+ readonly type: "loadScript";
156
+ readonly src: "{{scriptUrl}}";
157
+ readonly async: true;
158
+ }];
159
+ readonly onConsentGranted: [{
160
+ readonly type: "callGlobal";
161
+ readonly global: "rdt";
162
+ readonly args: ["enableFirstPartyCookies"];
163
+ }];
164
+ readonly onConsentDenied: [{
165
+ readonly type: "callGlobal";
166
+ readonly global: "rdt";
167
+ readonly args: ["disableFirstPartyCookies"];
168
+ }];
169
+ readonly kind: "c15t.vendor-manifest";
170
+ readonly schemaVersion: 1;
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 {};