@c15t/scripts 2.0.0 → 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 (110) hide show
  1. package/README.md +9 -9
  2. package/dist/e2e-test-utils.cjs +125 -0
  3. package/dist/e2e-test-utils.js +67 -0
  4. package/dist/engine/runtime.cjs +19 -9
  5. package/dist/engine/runtime.js +19 -9
  6. package/dist/registry.cjs +338 -0
  7. package/dist/registry.js +292 -0
  8. package/dist/types.cjs +18 -0
  9. package/dist/types.js +10 -1
  10. package/dist/vendors/_shared/attributes.cjs +51 -0
  11. package/dist/vendors/_shared/attributes.js +14 -0
  12. package/dist/vendors/_shared/google-consent.cjs +64 -0
  13. package/dist/vendors/_shared/google-consent.js +27 -0
  14. package/dist/vendors/_shared/install-builders.cjs +55 -0
  15. package/dist/vendors/_shared/install-builders.js +21 -0
  16. package/dist/vendors/_shared/script-url.cjs +74 -0
  17. package/dist/vendors/_shared/script-url.js +28 -0
  18. package/dist/{linkedin-insights.cjs → vendors/ads-and-pixels/linkedin-insights.cjs} +2 -2
  19. package/dist/{linkedin-insights.js → vendors/ads-and-pixels/linkedin-insights.js} +2 -2
  20. package/dist/vendors/ads-and-pixels/meta-pixel.cjs +202 -0
  21. package/dist/vendors/ads-and-pixels/meta-pixel.js +153 -0
  22. package/dist/{microsoft-uet.cjs → vendors/ads-and-pixels/microsoft-uet.cjs} +31 -14
  23. package/dist/{microsoft-uet.js → vendors/ads-and-pixels/microsoft-uet.js} +31 -14
  24. package/dist/vendors/ads-and-pixels/reddit-pixel.cjs +147 -0
  25. package/dist/vendors/ads-and-pixels/reddit-pixel.js +107 -0
  26. package/dist/vendors/ads-and-pixels/snapchat-pixel.cjs +127 -0
  27. package/dist/vendors/ads-and-pixels/snapchat-pixel.js +87 -0
  28. package/dist/{tiktok-pixel.cjs → vendors/ads-and-pixels/tiktok-pixel.cjs} +2 -2
  29. package/dist/{tiktok-pixel.js → vendors/ads-and-pixels/tiktok-pixel.js} +2 -2
  30. package/dist/{x-pixel.cjs → vendors/ads-and-pixels/x-pixel.cjs} +6 -3
  31. package/dist/{x-pixel.js → vendors/ads-and-pixels/x-pixel.js} +6 -3
  32. package/dist/vendors/analytics/ahrefs-analytics.cjs +64 -0
  33. package/dist/vendors/analytics/ahrefs-analytics.js +27 -0
  34. package/dist/vendors/analytics/cloudflare-web-analytics.cjs +69 -0
  35. package/dist/vendors/analytics/cloudflare-web-analytics.js +32 -0
  36. package/dist/{databuddy.cjs → vendors/analytics/databuddy.cjs} +3 -3
  37. package/dist/{databuddy.js → vendors/analytics/databuddy.js} +3 -3
  38. package/dist/vendors/analytics/fathom-analytics.cjs +72 -0
  39. package/dist/vendors/analytics/fathom-analytics.js +35 -0
  40. package/dist/{google-tag.cjs → vendors/analytics/google-tag.cjs} +7 -28
  41. package/dist/{google-tag.js → vendors/analytics/google-tag.js} +7 -28
  42. package/dist/vendors/analytics/hotjar.cjs +81 -0
  43. package/dist/vendors/analytics/hotjar.js +44 -0
  44. package/dist/vendors/analytics/matomo-analytics.cjs +228 -0
  45. package/dist/vendors/analytics/matomo-analytics.js +191 -0
  46. package/dist/vendors/analytics/microsoft-clarity.cjs +110 -0
  47. package/dist/vendors/analytics/microsoft-clarity.js +73 -0
  48. package/dist/vendors/analytics/mixpanel-analytics.cjs +119 -0
  49. package/dist/vendors/analytics/mixpanel-analytics.js +82 -0
  50. package/dist/vendors/analytics/plausible-analytics.cjs +118 -0
  51. package/dist/vendors/analytics/plausible-analytics.js +81 -0
  52. package/dist/{posthog.cjs → vendors/analytics/posthog.cjs} +69 -6
  53. package/dist/vendors/analytics/posthog.js +163 -0
  54. package/dist/vendors/analytics/promptwatch.cjs +66 -0
  55. package/dist/vendors/analytics/promptwatch.js +29 -0
  56. package/dist/vendors/analytics/rybbit-analytics.cjs +100 -0
  57. package/dist/vendors/analytics/rybbit-analytics.js +63 -0
  58. package/dist/vendors/analytics/segment.cjs +93 -0
  59. package/dist/vendors/analytics/segment.js +56 -0
  60. package/dist/vendors/analytics/umami-analytics.cjs +76 -0
  61. package/dist/vendors/analytics/umami-analytics.js +39 -0
  62. package/dist/vendors/analytics/vercel-analytics.cjs +90 -0
  63. package/dist/vendors/analytics/vercel-analytics.js +53 -0
  64. package/dist/vendors/functional/crisp.cjs +139 -0
  65. package/dist/vendors/functional/crisp.js +102 -0
  66. package/dist/vendors/functional/intercom.cjs +85 -0
  67. package/dist/vendors/functional/intercom.js +45 -0
  68. package/dist/{google-tag-manager.cjs → vendors/tag-managers/google-tag-manager.cjs} +6 -27
  69. package/dist/{google-tag-manager.js → vendors/tag-managers/google-tag-manager.js} +6 -27
  70. package/dist-types/__tests__/helpers.d.ts +141 -0
  71. package/dist-types/engine/runtime.d.ts +1 -1
  72. package/dist-types/registry.d.ts +368 -0
  73. package/dist-types/types.d.ts +13 -0
  74. package/dist-types/vendors/_shared/attributes.d.ts +35 -0
  75. package/dist-types/vendors/_shared/google-consent.d.ts +47 -0
  76. package/dist-types/vendors/_shared/install-builders.d.ts +30 -0
  77. package/dist-types/vendors/_shared/script-url.d.ts +75 -0
  78. package/dist-types/{linkedin-insights.d.ts → vendors/ads-and-pixels/linkedin-insights.d.ts} +22 -9
  79. package/dist-types/vendors/ads-and-pixels/meta-pixel.d.ts +289 -0
  80. package/dist-types/{microsoft-uet.d.ts → vendors/ads-and-pixels/microsoft-uet.d.ts} +21 -10
  81. package/dist-types/vendors/ads-and-pixels/reddit-pixel.d.ts +211 -0
  82. package/dist-types/vendors/ads-and-pixels/snapchat-pixel.d.ts +171 -0
  83. package/dist-types/{tiktok-pixel.d.ts → vendors/ads-and-pixels/tiktok-pixel.d.ts} +20 -5
  84. package/dist-types/{x-pixel.d.ts → vendors/ads-and-pixels/x-pixel.d.ts} +21 -4
  85. package/dist-types/vendors/analytics/ahrefs-analytics.d.ts +62 -0
  86. package/dist-types/vendors/analytics/cloudflare-web-analytics.d.ts +67 -0
  87. package/dist-types/vendors/analytics/fathom-analytics.d.ts +90 -0
  88. package/dist-types/{google-tag.d.ts → vendors/analytics/google-tag.d.ts} +5 -8
  89. package/dist-types/vendors/analytics/hotjar.d.ts +73 -0
  90. package/dist-types/vendors/analytics/matomo-analytics.d.ts +41 -0
  91. package/dist-types/vendors/analytics/microsoft-clarity.d.ts +86 -0
  92. package/dist-types/vendors/analytics/mixpanel-analytics.d.ts +101 -0
  93. package/dist-types/vendors/analytics/plausible-analytics.d.ts +122 -0
  94. package/dist-types/{posthog.d.ts → vendors/analytics/posthog.d.ts} +47 -5
  95. package/dist-types/vendors/analytics/promptwatch.d.ts +36 -0
  96. package/dist-types/vendors/analytics/rybbit-analytics.d.ts +82 -0
  97. package/dist-types/vendors/analytics/segment.d.ts +158 -0
  98. package/dist-types/vendors/analytics/umami-analytics.d.ts +93 -0
  99. package/dist-types/vendors/analytics/vercel-analytics.d.ts +66 -0
  100. package/dist-types/vendors/functional/crisp.d.ts +78 -0
  101. package/dist-types/vendors/functional/intercom.d.ts +135 -0
  102. package/dist-types/{google-tag-manager.d.ts → vendors/tag-managers/google-tag-manager.d.ts} +5 -8
  103. package/package.json +166 -5
  104. package/dist/meta-pixel.cjs +0 -129
  105. package/dist/meta-pixel.js +0 -89
  106. package/dist/posthog.js +0 -100
  107. package/dist-types/engine.test.d.ts +0 -1
  108. package/dist-types/helpers.test.d.ts +0 -1
  109. package/dist-types/meta-pixel.d.ts +0 -185
  110. /package/dist-types/{databuddy.d.ts → vendors/analytics/databuddy.d.ts} +0 -0
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Trims an optional string and treats empty or whitespace-only values as
3
+ * missing.
4
+ *
5
+ * @param value - Optional string value, usually a user-provided override.
6
+ * @returns The trimmed string when it contains non-whitespace characters,
7
+ * otherwise `undefined`.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * trimToUndefined(' https://cdn.example.com '); // 'https://cdn.example.com'
12
+ * trimToUndefined(' '); // undefined
13
+ * trimToUndefined(undefined); // undefined
14
+ * ```
15
+ */
16
+ export declare function trimToUndefined(value: string | undefined): string | undefined;
17
+ /**
18
+ * Resolves a script URL from an optional override and a required fallback.
19
+ *
20
+ * @param override - Explicit script URL supplied by the integration caller.
21
+ * @param fallback - Default vendor script URL.
22
+ * @returns `override` when it is defined, otherwise `fallback`.
23
+ *
24
+ * @remarks
25
+ * This helper intentionally does not trim or validate the override. Use
26
+ * `trimToUndefined` before calling this helper when blank string overrides
27
+ * should fall back to the vendor default.
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * resolveScriptUrl(undefined, 'https://cdn.example.com/default.js');
32
+ * // 'https://cdn.example.com/default.js'
33
+ * ```
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * resolveScriptUrl(
38
+ * 'https://custom.com/script.js',
39
+ * 'https://cdn.example.com/default.js'
40
+ * );
41
+ * // 'https://custom.com/script.js'
42
+ * ```
43
+ */
44
+ export declare function resolveScriptUrl(override: string | undefined, fallback: string): string;
45
+ /**
46
+ * Removes leading slash characters without using a regular expression.
47
+ *
48
+ * This helper is used on caller-controlled URL fragments, so it intentionally
49
+ * stays linear even for very long repeated slash input.
50
+ */
51
+ export declare function stripLeadingSlashes(value: string): string;
52
+ /**
53
+ * Removes trailing slash characters without using a regular expression.
54
+ *
55
+ * This helper is used on caller-controlled URL fragments, so it intentionally
56
+ * stays linear even for very long repeated slash input.
57
+ */
58
+ export declare function stripTrailingSlashes(value: string): string;
59
+ /**
60
+ * Joins a base URL and path with exactly one slash between them.
61
+ *
62
+ * @param base - Base URL or origin. Trailing slashes are removed before joining.
63
+ * @param path - Path segment. Leading slashes are removed before joining.
64
+ * @returns A slash-joined URL string.
65
+ *
66
+ * @example
67
+ * ```ts
68
+ * joinUrlPath('https://example.com///', '///script.js');
69
+ * // 'https://example.com/script.js'
70
+ *
71
+ * joinUrlPath('https://example.com', 'script.js');
72
+ * // 'https://example.com/script.js'
73
+ * ```
74
+ */
75
+ export declare function joinUrlPath(base: string, path: string): string;
@@ -1,7 +1,15 @@
1
1
  import type { Script } from 'c15t';
2
+ export interface LinkedInInsightsConversionEvent {
3
+ conversion_id: string | number;
4
+ [key: string]: unknown;
5
+ }
6
+ type LinkedInInsightsFunction = {
7
+ (command: 'track', event: LinkedInInsightsConversionEvent): void;
8
+ (command: string, ...args: unknown[]): void;
9
+ };
2
10
  declare global {
3
11
  interface Window {
4
- lintrk: ((...args: unknown[]) => void) & {
12
+ lintrk: LinkedInInsightsFunction & {
5
13
  q?: unknown[][];
6
14
  };
7
15
  _linkedin_partner_id?: string;
@@ -14,9 +22,9 @@ declare global {
14
22
  }
15
23
  }
16
24
  /**
17
- * LinkedIn Insights vendor manifest.
25
+ * LinkedIn Insight Tag vendor manifest.
18
26
  *
19
- * Sets up the LinkedIn partner ID globals and loads the insights script
27
+ * Sets up the LinkedIn partner ID globals and loads the Insight Tag script
20
28
  * via structured startup steps.
21
29
  */
22
30
  export declare const linkedinInsightsManifest: {
@@ -54,18 +62,22 @@ export declare const linkedinInsightsManifest: {
54
62
  };
55
63
  export interface LinkedInInsightsOptions {
56
64
  /**
57
- * Your LinkedIn Insights ID
65
+ * Your LinkedIn Insight Tag partner ID.
66
+ *
67
+ * LinkedIn shows this in Campaign Manager under Data -> Signals manager ->
68
+ * Insight Tag.
69
+ *
58
70
  * @example `123456789012345`
59
71
  */
60
72
  id: string;
61
- /** LinkedIn Insights loader URL. */
73
+ /** LinkedIn Insight Tag loader URL. */
62
74
  scriptSrc?: string;
63
75
  }
64
76
  /**
65
- * LinkedIn Insights Script
77
+ * LinkedIn Insight Tag script.
66
78
  *
67
- * @param options - The options for the LinkedIn Insights script
68
- * @returns The LinkedIn Insights script configuration
79
+ * @param options - The options for the LinkedIn Insight Tag script.
80
+ * @returns The LinkedIn Insight Tag script configuration.
69
81
  *
70
82
  * @example
71
83
  * ```ts
@@ -74,6 +86,7 @@ export interface LinkedInInsightsOptions {
74
86
  * });
75
87
  * ```
76
88
  *
77
- * @see {@link https://business.linkedin.com/marketing-solutions/ad-libraries/insights} LinkedIn Insights documentation
89
+ * @see {@link https://www.linkedin.com/help/lms/answer/a418880} Add the LinkedIn Insight Tag to your website
78
90
  */
79
91
  export declare function linkedinInsights({ id, scriptSrc, }: LinkedInInsightsOptions): Script;
92
+ export {};
@@ -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