@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,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 {};
@@ -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 vendor: "snapchat-pixel";
66
+ readonly category: "marketing";
67
+ readonly bootstrap: [{
68
+ readonly type: "defineStubFunction";
69
+ readonly name: "snaptr";
70
+ readonly queue: {
71
+ readonly property: "queue";
72
+ };
73
+ readonly dispatchProperty: "handleRequest";
74
+ readonly queueFormat: "array";
75
+ readonly aliases: ["_snaptr"];
76
+ readonly selfReferences: ["push"];
77
+ readonly properties: {
78
+ readonly loaded: true;
79
+ readonly version: "1.0";
80
+ };
81
+ readonly ifUndefined: true;
82
+ }];
83
+ readonly install: [{
84
+ readonly type: "callGlobal";
85
+ readonly global: "snaptr";
86
+ readonly args: ["init", "{{pixelId}}"];
87
+ }, {
88
+ readonly type: "callGlobal";
89
+ readonly global: "snaptr";
90
+ readonly args: ["track", "PAGE_VIEW"];
91
+ }, {
92
+ readonly type: "loadScript";
93
+ readonly src: "{{scriptUrl}}";
94
+ readonly async: true;
95
+ }];
96
+ readonly kind: "c15t.vendor-manifest";
97
+ readonly schemaVersion: 1;
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
  /**
@@ -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 {};
@@ -69,9 +69,23 @@ export interface XPixelEvent {
69
69
  twclid?: string;
70
70
  /**
71
71
  * Status of the conversion event
72
- * @example completed
72
+ * Should be set to values like "started" or "completed".
73
+ * @example "completed"
73
74
  */
74
- status?: boolean;
75
+ status?: 'started' | 'completed';
76
+ /**
77
+ * Email address used for user matching.
78
+ * The X Pixel hashes this value before transmission.
79
+ * @example "[email protected]"
80
+ */
81
+ email_address?: string;
82
+ /**
83
+ * Phone number used for user matching.
84
+ * Include country code in E.164 format (for example, +11234567890).
85
+ * The X Pixel hashes this value before transmission.
86
+ * @example "+11234567890"
87
+ */
88
+ phone_number?: string;
75
89
  /**
76
90
  * Content/products associated with the conversion event
77
91
  * @example [{content_id: 'OT001', content_name: 'bird seed', content_price: 50, num_items: 1}]
@@ -141,7 +155,7 @@ export interface XPixelOptions {
141
155
  * });
142
156
  * ```
143
157
  *
144
- * @see {@link https://ads.twitter.com/help/article/x-pixel} X Pixel documentation
158
+ * @see {@link https://business.x.com/en/help/campaign-measurement-and-analytics/conversion-tracking-for-websites} X conversion tracking documentation
145
159
  */
146
160
  export declare function xPixel({ pixelId, scriptSrc }: XPixelOptions): Script;
147
161
  /**
@@ -162,5 +176,8 @@ export declare function xPixel({ pixelId, scriptSrc }: XPixelOptions): Script;
162
176
  * ```
163
177
  *
164
178
  * @see {@link https://business.x.com/en/help/campaign-measurement-and-analytics/conversion-tracking-for-websites#event-types-and-parameters}
179
+ * @throws {Error} Throws when `window` is unavailable or `window.twq` is not a
180
+ * function. Ensure marketing consent is granted and the X Pixel has loaded
181
+ * before calling this helper.
165
182
  */
166
- export declare const xPixelEvent: (eventId: string, metadata?: XPixelEvent) => void | undefined;
183
+ export declare const xPixelEvent: (eventId: string, metadata?: XPixelEvent) => void;
@@ -0,0 +1,62 @@
1
+ import type { Script } from 'c15t';
2
+ declare global {
3
+ interface Window {
4
+ AhrefsAnalytics?: {
5
+ sendEvent: (name: string, options?: {
6
+ props?: Record<string, string>;
7
+ meta?: Record<string, unknown>;
8
+ }) => void;
9
+ };
10
+ }
11
+ }
12
+ /**
13
+ * Ahrefs Analytics vendor manifest.
14
+ *
15
+ * Loads Ahrefs Web Analytics and passes the project key via `data-key`. Ahrefs
16
+ * Web Analytics is cookieless, so the script is consent-gated on `measurement`
17
+ * and unloaded when consent is revoked.
18
+ */
19
+ export declare const ahrefsAnalyticsManifest: {
20
+ readonly vendor: "ahrefs-analytics";
21
+ readonly category: "measurement";
22
+ readonly install: [{
23
+ readonly type: "loadScript";
24
+ readonly src: "{{scriptUrl}}";
25
+ readonly async: true;
26
+ readonly attributes: {
27
+ readonly 'data-key': "{{key}}";
28
+ };
29
+ }];
30
+ readonly kind: "c15t.vendor-manifest";
31
+ readonly schemaVersion: 1;
32
+ };
33
+ export interface AhrefsAnalyticsOptions {
34
+ /**
35
+ * Your Ahrefs Web Analytics project key.
36
+ */
37
+ key: string;
38
+ /**
39
+ * Custom loader URL.
40
+ * @default 'https://analytics.ahrefs.com/analytics.js'
41
+ */
42
+ scriptUrl?: string;
43
+ }
44
+ /**
45
+ * Creates an Ahrefs Analytics script.
46
+ *
47
+ * The Ahrefs SDK exposes its runtime API on `window.AhrefsAnalytics` after
48
+ * load. This helper only models the serializable script manifest.
49
+ *
50
+ * @see https://ahrefs.com/web-analytics
51
+ *
52
+ * @param options - The options for the Ahrefs Analytics script.
53
+ * @returns The Ahrefs Analytics script.
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * import { ahrefsAnalytics } from '@c15t/scripts/ahrefs-analytics';
58
+ *
59
+ * ahrefsAnalytics({ key: 'YOUR_PROJECT_KEY' });
60
+ * ```
61
+ */
62
+ export declare function ahrefsAnalytics(options: AhrefsAnalyticsOptions): Script;
@@ -0,0 +1,67 @@
1
+ import type { Script } from 'c15t';
2
+ declare global {
3
+ interface Window {
4
+ __cfBeacon?: {
5
+ spa?: boolean;
6
+ token: string;
7
+ };
8
+ }
9
+ }
10
+ /**
11
+ * Cloudflare Web Analytics vendor manifest.
12
+ *
13
+ * Serializes Cloudflare's beacon config into the `data-cf-beacon` attribute.
14
+ * Cloudflare Web Analytics is cookieless, so the script is consent-gated on
15
+ * `measurement` and unloaded when consent is revoked.
16
+ */
17
+ export declare const cloudflareWebAnalyticsManifest: {
18
+ readonly vendor: "cloudflare-web-analytics";
19
+ readonly category: "measurement";
20
+ readonly install: [{
21
+ readonly type: "loadScript";
22
+ readonly src: "{{scriptUrl}}";
23
+ readonly defer: true;
24
+ readonly attributes: {
25
+ readonly 'data-cf-beacon': "{{beaconConfig}}";
26
+ };
27
+ }];
28
+ readonly kind: "c15t.vendor-manifest";
29
+ readonly schemaVersion: 1;
30
+ };
31
+ export interface CloudflareWebAnalyticsOptions {
32
+ /**
33
+ * Your Cloudflare Web Analytics token.
34
+ */
35
+ token: string;
36
+ /**
37
+ * Enable Cloudflare's SPA route tracking.
38
+ * @default true
39
+ */
40
+ spa?: boolean;
41
+ /**
42
+ * Custom loader URL.
43
+ * @default 'https://static.cloudflareinsights.com/beacon.min.js'
44
+ */
45
+ scriptUrl?: string;
46
+ }
47
+ /**
48
+ * Creates a Cloudflare Web Analytics script.
49
+ *
50
+ * @see https://developers.cloudflare.com/analytics/web-analytics/get-started/
51
+ *
52
+ * @param options - The options for the Cloudflare Web Analytics script.
53
+ * @returns The Cloudflare Web Analytics script.
54
+ * @throws {Error} Throws `cloudflareWebAnalytics: missing token` when
55
+ * `options.token` is missing, invalid, or trims to an empty string.
56
+ *
57
+ * @example
58
+ * ```ts
59
+ * import { cloudflareWebAnalytics } from '@c15t/scripts/cloudflare-web-analytics';
60
+ *
61
+ * cloudflareWebAnalytics({
62
+ * token: 'abc123...',
63
+ * spa: true,
64
+ * });
65
+ * ```
66
+ */
67
+ export declare function cloudflareWebAnalytics(options: CloudflareWebAnalyticsOptions): Script;
@@ -0,0 +1,90 @@
1
+ import type { Script } from 'c15t';
2
+ declare global {
3
+ interface Window {
4
+ fathom?: {
5
+ blockTrackingForMe: () => void;
6
+ enableTrackingForMe: () => void;
7
+ trackEvent: (eventName: string, opts?: {
8
+ _value?: number;
9
+ }) => void;
10
+ trackGoal: (goalId: string, cents: number) => void;
11
+ trackPageview: (opts?: {
12
+ url: string;
13
+ referrer?: string;
14
+ }) => void;
15
+ };
16
+ }
17
+ }
18
+ /**
19
+ * Fathom Analytics vendor manifest.
20
+ *
21
+ * Configures Fathom via script `data-*` attributes. Fathom is a cookieless
22
+ * analytics product, so the script is consent-gated on `measurement` and
23
+ * unloaded when consent is revoked.
24
+ */
25
+ export declare const fathomAnalyticsManifest: {
26
+ readonly vendor: "fathom-analytics";
27
+ readonly category: "measurement";
28
+ readonly install: [{
29
+ readonly type: "loadScript";
30
+ readonly src: "{{scriptUrl}}";
31
+ readonly defer: true;
32
+ readonly attributes: {
33
+ readonly 'data-site': "{{site}}";
34
+ readonly 'data-spa': "{{spa}}";
35
+ readonly 'data-auto': "{{autoAttribute}}";
36
+ readonly 'data-canonical': "{{canonicalAttribute}}";
37
+ readonly 'data-honor-dnt': "{{honorDntAttribute}}";
38
+ };
39
+ }];
40
+ readonly kind: "c15t.vendor-manifest";
41
+ readonly schemaVersion: 1;
42
+ };
43
+ export interface FathomAnalyticsOptions {
44
+ /**
45
+ * Your Fathom Analytics site ID.
46
+ */
47
+ site: string;
48
+ /**
49
+ * The SPA tracking mode. When undefined, SPA auto-routing is disabled and
50
+ * the `data-spa` attribute is omitted.
51
+ */
52
+ spa?: 'auto' | 'history' | 'hash';
53
+ /**
54
+ * Automatically track page views.
55
+ */
56
+ auto?: boolean;
57
+ /**
58
+ * Enable canonical URL tracking.
59
+ */
60
+ canonical?: boolean;
61
+ /**
62
+ * Honor Do Not Track requests.
63
+ */
64
+ honorDnt?: boolean;
65
+ /**
66
+ * Custom loader URL.
67
+ * @default 'https://cdn.usefathom.com/script.js'
68
+ */
69
+ scriptUrl?: string;
70
+ }
71
+ /**
72
+ * Creates a Fathom Analytics script.
73
+ *
74
+ * @see https://usefathom.com/docs/script/script-settings
75
+ *
76
+ * @param options - The options for the Fathom Analytics script.
77
+ * @returns The Fathom Analytics script.
78
+ *
79
+ * @example
80
+ * ```ts
81
+ * import { fathomAnalytics } from '@c15t/scripts/fathom-analytics';
82
+ *
83
+ * fathomAnalytics({
84
+ * site: 'SITE123',
85
+ * spa: 'history',
86
+ * canonical: true,
87
+ * });
88
+ * ```
89
+ */
90
+ export declare function fathomAnalytics(options: FathomAnalyticsOptions): Script;