@c15t/scripts 2.2.0 → 3.0.0-alpha.1

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 (202) hide show
  1. package/AGENTS.md +77 -48
  2. package/README.md +4 -3
  3. package/dist/e2e-test-utils.js +60 -24
  4. package/dist/engine/compile.js +45 -45
  5. package/dist/engine/runtime.js +130 -119
  6. package/dist/registry.js +196 -176
  7. package/dist/resolve.js +12 -12
  8. package/dist/vendors/_shared/attributes.js +5 -5
  9. package/dist/vendors/_shared/google-consent.js +10 -10
  10. package/dist/vendors/_shared/install-builders.js +9 -9
  11. package/dist/vendors/_shared/script-url.js +12 -12
  12. package/dist/vendors/ads-and-pixels/linkedin-insights.js +16 -16
  13. package/dist/vendors/ads-and-pixels/meta-pixel.js +82 -82
  14. package/dist/vendors/ads-and-pixels/microsoft-uet.js +57 -57
  15. package/dist/vendors/ads-and-pixels/openai-pixel.js +88 -0
  16. package/dist/vendors/ads-and-pixels/reddit-pixel.js +39 -39
  17. package/dist/vendors/ads-and-pixels/snapchat-pixel.js +25 -25
  18. package/dist/vendors/ads-and-pixels/tiktok-pixel.js +31 -31
  19. package/dist/vendors/ads-and-pixels/x-pixel.js +17 -17
  20. package/dist/vendors/analytics/adobe-analytics.js +17 -17
  21. package/dist/vendors/analytics/ahrefs-analytics.js +8 -8
  22. package/dist/vendors/analytics/amplitude.js +39 -39
  23. package/dist/vendors/analytics/clearbit.js +11 -11
  24. package/dist/vendors/analytics/cloudflare-web-analytics.js +13 -13
  25. package/dist/vendors/analytics/databuddy.js +45 -45
  26. package/dist/vendors/analytics/fathom-analytics.js +15 -15
  27. package/dist/vendors/analytics/google-tag.js +23 -23
  28. package/dist/vendors/analytics/heap.js +37 -37
  29. package/dist/vendors/analytics/hightouch.js +30 -30
  30. package/dist/vendors/analytics/hotjar.js +14 -14
  31. package/dist/vendors/analytics/logrocket.js +24 -24
  32. package/dist/vendors/analytics/matomo-analytics.js +51 -51
  33. package/dist/vendors/analytics/microsoft-clarity.js +34 -31
  34. package/dist/vendors/analytics/mixpanel-analytics.js +31 -31
  35. package/dist/vendors/analytics/pirsch.js +27 -27
  36. package/dist/vendors/analytics/plausible-analytics.js +24 -24
  37. package/dist/vendors/analytics/posthog.js +84 -79
  38. package/dist/vendors/analytics/promptwatch.js +8 -8
  39. package/dist/vendors/analytics/rudderstack.js +50 -50
  40. package/dist/vendors/analytics/rybbit-analytics.js +30 -30
  41. package/dist/vendors/analytics/segment.js +16 -16
  42. package/dist/vendors/analytics/umami-analytics.js +16 -16
  43. package/dist/vendors/analytics/vercel-analytics.js +22 -22
  44. package/dist/vendors/functional/crisp.js +49 -51
  45. package/dist/vendors/functional/intercom.js +18 -18
  46. package/dist/vendors/tag-managers/cloudflare-zaraz.js +98 -0
  47. package/dist/vendors/tag-managers/google-tag-manager.js +20 -20
  48. package/dist-types/__tests__/helpers.d.ts +11 -11
  49. package/dist-types/engine/compile.d.ts +3 -3
  50. package/dist-types/engine/runtime.d.ts +3 -3
  51. package/dist-types/registry.d.ts +191 -173
  52. package/dist-types/resolve.d.ts +3 -3
  53. package/dist-types/types.d.ts +2 -2
  54. package/dist-types/vendors/_shared/attributes.d.ts +2 -2
  55. package/dist-types/vendors/_shared/google-consent.d.ts +2 -2
  56. package/dist-types/vendors/_shared/install-builders.d.ts +2 -2
  57. package/dist-types/vendors/_shared/script-url.d.ts +6 -6
  58. package/dist-types/vendors/ads-and-pixels/linkedin-insights.d.ts +14 -14
  59. package/dist-types/vendors/ads-and-pixels/meta-pixel.d.ts +27 -27
  60. package/dist-types/vendors/ads-and-pixels/microsoft-uet.d.ts +40 -40
  61. package/dist-types/vendors/ads-and-pixels/openai-pixel.d.ts +211 -0
  62. package/dist-types/vendors/ads-and-pixels/reddit-pixel.d.ts +28 -29
  63. package/dist-types/vendors/ads-and-pixels/snapchat-pixel.d.ts +23 -23
  64. package/dist-types/vendors/ads-and-pixels/tiktok-pixel.d.ts +22 -22
  65. package/dist-types/vendors/ads-and-pixels/x-pixel.d.ts +15 -15
  66. package/dist-types/vendors/analytics/adobe-analytics.d.ts +3 -3
  67. package/dist-types/vendors/analytics/ahrefs-analytics.d.ts +5 -5
  68. package/dist-types/vendors/analytics/amplitude.d.ts +24 -24
  69. package/dist-types/vendors/analytics/clearbit.d.ts +5 -5
  70. package/dist-types/vendors/analytics/cloudflare-web-analytics.d.ts +6 -6
  71. package/dist-types/vendors/analytics/databuddy.d.ts +34 -31
  72. package/dist-types/vendors/analytics/fathom-analytics.d.ts +8 -8
  73. package/dist-types/vendors/analytics/google-tag.d.ts +17 -17
  74. package/dist-types/vendors/analytics/heap.d.ts +17 -17
  75. package/dist-types/vendors/analytics/hightouch.d.ts +15 -15
  76. package/dist-types/vendors/analytics/hotjar.d.ts +9 -9
  77. package/dist-types/vendors/analytics/logrocket.d.ts +11 -11
  78. package/dist-types/vendors/analytics/matomo-analytics.d.ts +3 -3
  79. package/dist-types/vendors/analytics/microsoft-clarity.d.ts +12 -13
  80. package/dist-types/vendors/analytics/mixpanel-analytics.d.ts +20 -20
  81. package/dist-types/vendors/analytics/pirsch.d.ts +10 -10
  82. package/dist-types/vendors/analytics/plausible-analytics.d.ts +13 -13
  83. package/dist-types/vendors/analytics/posthog.d.ts +35 -32
  84. package/dist-types/vendors/analytics/promptwatch.d.ts +5 -5
  85. package/dist-types/vendors/analytics/rudderstack.d.ts +16 -16
  86. package/dist-types/vendors/analytics/rybbit-analytics.d.ts +15 -15
  87. package/dist-types/vendors/analytics/segment.d.ts +11 -11
  88. package/dist-types/vendors/analytics/umami-analytics.d.ts +9 -9
  89. package/dist-types/vendors/analytics/vercel-analytics.d.ts +13 -13
  90. package/dist-types/vendors/functional/crisp.d.ts +9 -9
  91. package/dist-types/vendors/functional/intercom.d.ts +12 -12
  92. package/dist-types/vendors/tag-managers/cloudflare-zaraz.d.ts +39 -0
  93. package/dist-types/vendors/tag-managers/google-tag-manager.d.ts +16 -16
  94. package/docs/README.md +77 -48
  95. package/docs/assets/v3/brand-bar.png +0 -0
  96. package/docs/assets/v3/brand-card.png +0 -0
  97. package/docs/assets/v3/choice-wall.png +0 -0
  98. package/docs/assets/v3/mobile-card.png +0 -0
  99. package/docs/assets/v3/preferences.png +0 -0
  100. package/docs/customization/overview.md +45 -0
  101. package/docs/customization/recipes.md +79 -0
  102. package/docs/customization/slots.md +55 -0
  103. package/docs/customization/tokens.md +76 -0
  104. package/docs/customization/translations.md +49 -0
  105. package/docs/frameworks/javascript/script-loader.md +81 -343
  106. package/docs/frameworks/next/script-loader.md +164 -455
  107. package/docs/frameworks/react/script-loader.md +41 -533
  108. package/docs/guides/consent-state.md +60 -0
  109. package/docs/guides/data-fetching.md +163 -0
  110. package/docs/guides/deployment-modes.md +75 -0
  111. package/docs/guides/troubleshooting.md +68 -0
  112. package/docs/guides/verify-consent.md +62 -0
  113. package/docs/integrations/adobe-analytics.md +239 -105
  114. package/docs/integrations/ahrefs-analytics.md +238 -104
  115. package/docs/integrations/amplitude.md +219 -157
  116. package/docs/integrations/building-integrations.md +36 -223
  117. package/docs/integrations/clear-on-revocation.md +167 -0
  118. package/docs/integrations/clearbit.md +247 -86
  119. package/docs/integrations/cloudflare-web-analytics.md +250 -84
  120. package/docs/integrations/cloudflare-zaraz.md +399 -0
  121. package/docs/integrations/crisp.md +251 -97
  122. package/docs/integrations/databuddy.md +259 -153
  123. package/docs/integrations/fathom-analytics.md +239 -96
  124. package/docs/integrations/google-maps.md +328 -207
  125. package/docs/integrations/google-tag-manager.md +248 -96
  126. package/docs/integrations/google-tag.md +261 -90
  127. package/docs/integrations/granular-consent.md +208 -0
  128. package/docs/integrations/heap.md +222 -149
  129. package/docs/integrations/hightouch.md +225 -131
  130. package/docs/integrations/hotjar.md +239 -90
  131. package/docs/integrations/intercom.md +239 -98
  132. package/docs/integrations/linkedin-insights.md +243 -113
  133. package/docs/integrations/logrocket.md +241 -123
  134. package/docs/integrations/matomo-analytics.md +256 -111
  135. package/docs/integrations/meta-pixel.md +197 -324
  136. package/docs/integrations/microsoft-clarity.md +233 -114
  137. package/docs/integrations/microsoft-uet.md +245 -110
  138. package/docs/integrations/mixpanel-analytics.md +252 -87
  139. package/docs/integrations/openai-pixel.md +441 -0
  140. package/docs/integrations/overview.md +96 -133
  141. package/docs/integrations/pirsch.md +249 -96
  142. package/docs/integrations/plausible-analytics.md +241 -100
  143. package/docs/integrations/posthog.md +353 -214
  144. package/docs/integrations/promptwatch.md +251 -81
  145. package/docs/integrations/reddit-pixel.md +226 -173
  146. package/docs/integrations/rudderstack.md +244 -187
  147. package/docs/integrations/rybbit-analytics.md +244 -91
  148. package/docs/integrations/segment.md +238 -92
  149. package/docs/integrations/snapchat-pixel.md +240 -110
  150. package/docs/integrations/tiktok-pixel.md +249 -81
  151. package/docs/integrations/umami-analytics.md +242 -95
  152. package/docs/integrations/vercel-analytics.md +242 -90
  153. package/docs/integrations/x-pixel.md +238 -104
  154. package/docs/integrations/youtube.md +359 -142
  155. package/docs/upgrade-v3.md +381 -0
  156. package/package.json +90 -78
  157. package/dist/e2e-test-utils.cjs +0 -166
  158. package/dist/engine/compile.cjs +0 -130
  159. package/dist/engine/runtime.cjs +0 -475
  160. package/dist/registry.cjs +0 -423
  161. package/dist/resolve.cjs +0 -71
  162. package/dist/types.cjs +0 -69
  163. package/dist/vendors/_shared/attributes.cjs +0 -55
  164. package/dist/vendors/_shared/google-consent.cjs +0 -69
  165. package/dist/vendors/_shared/install-builders.cjs +0 -59
  166. package/dist/vendors/_shared/script-url.cjs +0 -78
  167. package/dist/vendors/ads-and-pixels/linkedin-insights.cjs +0 -89
  168. package/dist/vendors/ads-and-pixels/meta-pixel.cjs +0 -206
  169. package/dist/vendors/ads-and-pixels/microsoft-uet.cjs +0 -151
  170. package/dist/vendors/ads-and-pixels/reddit-pixel.cjs +0 -151
  171. package/dist/vendors/ads-and-pixels/snapchat-pixel.cjs +0 -131
  172. package/dist/vendors/ads-and-pixels/tiktok-pixel.cjs +0 -130
  173. package/dist/vendors/ads-and-pixels/x-pixel.cjs +0 -92
  174. package/dist/vendors/analytics/adobe-analytics.cjs +0 -90
  175. package/dist/vendors/analytics/ahrefs-analytics.cjs +0 -68
  176. package/dist/vendors/analytics/amplitude.cjs +0 -193
  177. package/dist/vendors/analytics/clearbit.cjs +0 -69
  178. package/dist/vendors/analytics/cloudflare-web-analytics.cjs +0 -73
  179. package/dist/vendors/analytics/databuddy.cjs +0 -144
  180. package/dist/vendors/analytics/fathom-analytics.cjs +0 -76
  181. package/dist/vendors/analytics/google-tag.cjs +0 -107
  182. package/dist/vendors/analytics/heap.cjs +0 -181
  183. package/dist/vendors/analytics/hightouch.cjs +0 -153
  184. package/dist/vendors/analytics/hotjar.cjs +0 -85
  185. package/dist/vendors/analytics/logrocket.cjs +0 -99
  186. package/dist/vendors/analytics/matomo-analytics.cjs +0 -232
  187. package/dist/vendors/analytics/microsoft-clarity.cjs +0 -138
  188. package/dist/vendors/analytics/mixpanel-analytics.cjs +0 -134
  189. package/dist/vendors/analytics/pirsch.cjs +0 -108
  190. package/dist/vendors/analytics/plausible-analytics.cjs +0 -122
  191. package/dist/vendors/analytics/posthog.cjs +0 -236
  192. package/dist/vendors/analytics/promptwatch.cjs +0 -70
  193. package/dist/vendors/analytics/rudderstack.cjs +0 -227
  194. package/dist/vendors/analytics/rybbit-analytics.cjs +0 -104
  195. package/dist/vendors/analytics/segment.cjs +0 -97
  196. package/dist/vendors/analytics/umami-analytics.cjs +0 -80
  197. package/dist/vendors/analytics/vercel-analytics.cjs +0 -94
  198. package/dist/vendors/functional/crisp.cjs +0 -143
  199. package/dist/vendors/functional/intercom.cjs +0 -89
  200. package/dist/vendors/tag-managers/google-tag-manager.cjs +0 -100
  201. package/docs/shared/react/guides/script-loader.md +0 -311
  202. package/readme.json +0 -19
@@ -1,21 +1,21 @@
1
- function buildQueuePixelInstall({ global, initArgs, trackStep, scriptPlaceholder = "{{scriptUrl}}" }) {
1
+ const install_builders_buildQueuePixelInstall = function({ global, initArgs, trackStep, scriptPlaceholder = "{{scriptUrl}}" }) {
2
2
  const install = [
3
3
  {
4
- type: 'callGlobal',
4
+ args: initArgs,
5
5
  global,
6
- args: initArgs
6
+ type: 'callGlobal'
7
7
  }
8
8
  ];
9
9
  if (void 0 !== trackStep) install.push({
10
- type: 'callGlobal',
10
+ args: trackStep.args,
11
11
  global,
12
- args: trackStep.args
12
+ type: 'callGlobal'
13
13
  });
14
14
  install.push({
15
- type: 'loadScript',
15
+ async: true,
16
16
  src: scriptPlaceholder,
17
- async: true
17
+ type: 'loadScript'
18
18
  });
19
19
  return install;
20
- }
21
- export { buildQueuePixelInstall };
20
+ };
21
+ export { install_builders_buildQueuePixelInstall as buildQueuePixelInstall };
@@ -1,28 +1,28 @@
1
- function trimToUndefined(value) {
1
+ const script_url_trimToUndefined = function(value) {
2
2
  if (void 0 === value) return;
3
3
  const trimmed = value.trim();
4
4
  if (0 === trimmed.length) return;
5
5
  return trimmed;
6
- }
7
- function resolveScriptUrl(override, fallback) {
6
+ };
7
+ const script_url_resolveScriptUrl = function(override, fallback) {
8
8
  if (void 0 !== override) return override;
9
9
  return fallback;
10
- }
11
- function stripLeadingSlashes(value) {
10
+ };
11
+ const script_url_stripLeadingSlashes = function(value) {
12
12
  let index = 0;
13
13
  while(index < value.length && 47 === value.charCodeAt(index))index += 1;
14
14
  return 0 === index ? value : value.slice(index);
15
- }
16
- function stripTrailingSlashes(value) {
15
+ };
16
+ const script_url_stripTrailingSlashes = function(value) {
17
17
  let end = value.length;
18
18
  while(end > 0 && 47 === value.charCodeAt(end - 1))end -= 1;
19
19
  return end === value.length ? value : value.slice(0, end);
20
- }
21
- function joinUrlPath(base, path) {
20
+ };
21
+ const script_url_joinUrlPath = function(base, path) {
22
22
  const trimmedBase = base.trim();
23
23
  const trimmedPath = path.trim();
24
24
  if (0 === trimmedBase.length) throw new TypeError(`joinUrlPath requires a non-empty base URL. Received base=${JSON.stringify(base)}, path=${JSON.stringify(path)}.`);
25
25
  if (0 === trimmedPath.length) throw new TypeError(`joinUrlPath requires a non-empty path. Received base=${JSON.stringify(base)}, path=${JSON.stringify(path)}.`);
26
- return `${stripTrailingSlashes(trimmedBase)}/${stripLeadingSlashes(trimmedPath)}`;
27
- }
28
- export { joinUrlPath, resolveScriptUrl, stripLeadingSlashes, stripTrailingSlashes, trimToUndefined };
26
+ return `${script_url_stripTrailingSlashes(trimmedBase)}/${script_url_stripLeadingSlashes(trimmedPath)}`;
27
+ };
28
+ export { script_url_joinUrlPath as joinUrlPath, script_url_resolveScriptUrl as resolveScriptUrl, script_url_stripLeadingSlashes as stripLeadingSlashes, script_url_stripTrailingSlashes as stripTrailingSlashes, script_url_trimToUndefined as trimToUndefined };
@@ -2,47 +2,47 @@ import { resolveManifest } from "../../resolve.js";
2
2
  import { vendorManifestContract } from "../../types.js";
3
3
  const linkedinInsightsManifest = {
4
4
  ...vendorManifestContract,
5
- vendor: 'linkedin-insights',
6
5
  category: 'marketing',
7
6
  install: [
8
7
  {
9
- type: 'setGlobal',
8
+ ifUndefined: false,
10
9
  name: '_linkedin_partner_id',
11
- value: '{{id}}',
12
- ifUndefined: false
10
+ type: 'setGlobal',
11
+ value: '{{id}}'
13
12
  },
14
13
  {
15
- type: 'setGlobal',
14
+ ifUndefined: true,
16
15
  name: '_linkedin_data_partner_ids',
17
- value: [],
18
- ifUndefined: true
16
+ type: 'setGlobal',
17
+ value: []
19
18
  },
20
19
  {
21
- type: 'pushToQueue',
22
20
  queue: '_linkedin_data_partner_ids',
21
+ type: 'pushToQueue',
23
22
  value: '{{id}}'
24
23
  },
25
24
  {
26
- type: 'defineStubFunction',
25
+ ifUndefined: true,
27
26
  name: 'lintrk',
28
27
  queue: {
29
28
  property: 'q'
30
29
  },
31
30
  queueFormat: 'array',
32
- ifUndefined: true
31
+ type: 'defineStubFunction'
33
32
  },
34
33
  {
35
- type: 'loadScript',
34
+ async: true,
36
35
  src: "{{scriptSrc}}",
37
- async: true
36
+ type: 'loadScript'
38
37
  }
39
- ]
38
+ ],
39
+ vendor: 'linkedin-insights'
40
40
  };
41
- function linkedinInsights({ id, scriptSrc }) {
41
+ const linkedin_insights_linkedinInsights = function({ id, scriptSrc }) {
42
42
  const resolved = resolveManifest(linkedinInsightsManifest, {
43
43
  id,
44
44
  scriptSrc: scriptSrc ?? 'https://snap.licdn.com/li.lms-analytics/insight.min.js'
45
45
  });
46
46
  return resolved;
47
- }
48
- export { linkedinInsights, linkedinInsightsManifest };
47
+ };
48
+ export { linkedinInsightsManifest, linkedin_insights_linkedinInsights as linkedinInsights };
@@ -4,100 +4,99 @@ import { buildQueuePixelInstall } from "../_shared/install-builders.js";
4
4
  import { resolveScriptUrl } from "../_shared/script-url.js";
5
5
  const metaPixelManifest = {
6
6
  ...vendorManifestContract,
7
- vendor: 'meta-pixel',
8
- category: 'marketing',
9
- persistAfterConsentRevoked: true,
10
7
  bootstrap: [
11
8
  {
12
- type: 'defineStubFunction',
13
- name: 'fbq',
14
- queue: {
15
- property: 'queue'
16
- },
17
- dispatchProperty: 'callMethod',
18
- selfReferences: [
19
- 'push'
20
- ],
21
9
  aliases: [
22
10
  '_fbq'
23
11
  ],
12
+ dispatchProperty: 'callMethod',
13
+ ifUndefined: true,
14
+ name: 'fbq',
24
15
  properties: {
25
16
  loaded: true,
26
17
  version: '2.0'
27
18
  },
28
- ifUndefined: true
19
+ queue: {
20
+ property: 'queue'
21
+ },
22
+ selfReferences: [
23
+ 'push'
24
+ ],
25
+ type: 'defineStubFunction'
29
26
  }
30
27
  ],
28
+ category: 'marketing',
31
29
  install: [
32
30
  {
33
- type: 'callGlobal',
34
- global: 'fbq',
35
31
  args: [
36
32
  'consent',
37
33
  'grant'
38
- ]
34
+ ],
35
+ global: 'fbq',
36
+ type: 'callGlobal'
39
37
  },
40
38
  {
41
- type: 'callGlobal',
42
- global: 'fbq',
43
39
  args: [
44
40
  'init',
45
41
  '{{pixelId}}'
46
- ]
42
+ ],
43
+ global: 'fbq',
44
+ type: 'callGlobal'
47
45
  },
48
46
  {
49
- type: 'callGlobal',
50
- global: 'fbq',
51
47
  args: [
52
48
  'track',
53
49
  'PageView'
54
- ]
50
+ ],
51
+ global: 'fbq',
52
+ type: 'callGlobal'
55
53
  },
56
54
  {
57
- type: 'loadScript',
55
+ async: true,
58
56
  src: "{{scriptSrc}}",
59
- async: true
57
+ type: 'loadScript'
60
58
  }
61
59
  ],
62
- onConsentGranted: [
60
+ onConsentDenied: [
63
61
  {
64
- type: 'callGlobal',
65
- global: 'fbq',
66
62
  args: [
67
63
  'consent',
68
- 'grant'
69
- ]
64
+ 'revoke'
65
+ ],
66
+ global: 'fbq',
67
+ type: 'callGlobal'
70
68
  }
71
69
  ],
72
- onConsentDenied: [
70
+ onConsentGranted: [
73
71
  {
74
- type: 'callGlobal',
75
- global: 'fbq',
76
72
  args: [
77
73
  'consent',
78
- 'revoke'
79
- ]
74
+ 'grant'
75
+ ],
76
+ global: 'fbq',
77
+ type: 'callGlobal'
80
78
  }
81
- ]
79
+ ],
80
+ persistAfterConsentRevoked: true,
81
+ vendor: 'meta-pixel'
82
82
  };
83
- function metaPixel({ pixelId, initOptions, trackPageView = true, dataProcessingOptions, scriptSrc }) {
84
- const install = buildMetaPixelInstall({
85
- hasInitOptions: void 0 !== initOptions,
86
- trackPageView,
87
- dataProcessingOptions
88
- });
89
- const manifest = {
90
- ...metaPixelManifest,
91
- install
83
+ const meta_pixel_getMetaPixelDataProcessingArgs = function({ options, country, state }) {
84
+ const args = [
85
+ 'dataProcessingOptions',
86
+ options
87
+ ];
88
+ if (void 0 !== country || void 0 !== state) args.push(country ?? 0, state ?? 0);
89
+ return args;
90
+ };
91
+ const meta_pixel_getMetaPixelPageViewStep = function(trackPageView) {
92
+ if (trackPageView) return {
93
+ args: [
94
+ 'track',
95
+ 'PageView'
96
+ ]
92
97
  };
93
- const resolved = resolveManifest(manifest, {
94
- pixelId,
95
- initOptions,
96
- scriptSrc: resolveScriptUrl(scriptSrc, 'https://connect.facebook.net/en_US/fbevents.js')
97
- });
98
- return resolved;
99
- }
100
- function buildMetaPixelInstall({ hasInitOptions, trackPageView, dataProcessingOptions }) {
98
+ };
99
+ const meta_pixel_buildMetaPixelInstall = function({ hasInitOptions, trackPageView, dataProcessingOptions }) {
101
100
  const initArgs = [
102
101
  'init',
103
102
  '{{pixelId}}'
@@ -106,48 +105,49 @@ function buildMetaPixelInstall({ hasInitOptions, trackPageView, dataProcessingOp
106
105
  const install = buildQueuePixelInstall({
107
106
  global: 'fbq',
108
107
  initArgs,
109
- trackStep: getMetaPixelPageViewStep(trackPageView),
110
- scriptPlaceholder: "{{scriptSrc}}"
108
+ scriptPlaceholder: "{{scriptSrc}}",
109
+ trackStep: meta_pixel_getMetaPixelPageViewStep(trackPageView)
111
110
  });
112
111
  if (void 0 !== dataProcessingOptions) install.unshift({
113
- type: 'callGlobal',
112
+ args: meta_pixel_getMetaPixelDataProcessingArgs(dataProcessingOptions),
114
113
  global: 'fbq',
115
- args: getMetaPixelDataProcessingArgs(dataProcessingOptions)
114
+ type: 'callGlobal'
116
115
  });
117
116
  install.unshift({
118
- type: 'callGlobal',
119
- global: 'fbq',
120
117
  args: [
121
118
  'consent',
122
119
  'grant'
123
- ]
120
+ ],
121
+ global: 'fbq',
122
+ type: 'callGlobal'
124
123
  });
125
124
  return install;
126
- }
127
- function getMetaPixelDataProcessingArgs({ options, country, state }) {
128
- const args = [
129
- 'dataProcessingOptions',
130
- options
131
- ];
132
- if (void 0 !== country || void 0 !== state) args.push(country ?? 0, state ?? 0);
133
- return args;
134
- }
135
- function getMetaPixelPageViewStep(trackPageView) {
136
- if (trackPageView) return {
137
- args: [
138
- 'track',
139
- 'PageView'
140
- ]
125
+ };
126
+ const meta_pixel_metaPixel = function({ pixelId, initOptions, trackPageView = true, dataProcessingOptions, scriptSrc }) {
127
+ const install = meta_pixel_buildMetaPixelInstall({
128
+ dataProcessingOptions,
129
+ hasInitOptions: void 0 !== initOptions,
130
+ trackPageView
131
+ });
132
+ const manifest = {
133
+ ...metaPixelManifest,
134
+ install
141
135
  };
142
- }
143
- function resolveMetaPixelEventOptions(eventOptions) {
136
+ const resolved = resolveManifest(manifest, {
137
+ initOptions,
138
+ pixelId,
139
+ scriptSrc: resolveScriptUrl(scriptSrc, 'https://connect.facebook.net/en_US/fbevents.js')
140
+ });
141
+ return resolved;
142
+ };
143
+ const meta_pixel_resolveMetaPixelEventOptions = function(eventOptions) {
144
144
  if ('string' == typeof eventOptions) return {
145
145
  eventID: eventOptions
146
146
  };
147
147
  return eventOptions;
148
- }
149
- const metaPixelEvent = (eventName, params, eventOptions)=>window.fbq('track', eventName, params, resolveMetaPixelEventOptions(eventOptions));
150
- const metaPixelCustomEvent = (eventName, params, eventOptions)=>window.fbq('trackCustom', eventName, params, resolveMetaPixelEventOptions(eventOptions));
151
- const metaPixelSingleEvent = (pixelId, eventName, params, eventOptions)=>window.fbq('trackSingle', pixelId, eventName, params, resolveMetaPixelEventOptions(eventOptions));
152
- const metaPixelSingleCustomEvent = (pixelId, eventName, params, eventOptions)=>window.fbq('trackSingleCustom', pixelId, eventName, params, resolveMetaPixelEventOptions(eventOptions));
153
- export { metaPixel, metaPixelCustomEvent, metaPixelEvent, metaPixelManifest, metaPixelSingleCustomEvent, metaPixelSingleEvent };
148
+ };
149
+ const metaPixelEvent = (eventName, params, eventOptions)=>window.fbq('track', eventName, params, meta_pixel_resolveMetaPixelEventOptions(eventOptions));
150
+ const metaPixelCustomEvent = (eventName, params, eventOptions)=>window.fbq('trackCustom', eventName, params, meta_pixel_resolveMetaPixelEventOptions(eventOptions));
151
+ const metaPixelSingleEvent = (pixelId, eventName, params, eventOptions)=>window.fbq('trackSingle', pixelId, eventName, params, meta_pixel_resolveMetaPixelEventOptions(eventOptions));
152
+ const metaPixelSingleCustomEvent = (pixelId, eventName, params, eventOptions)=>window.fbq('trackSingleCustom', pixelId, eventName, params, meta_pixel_resolveMetaPixelEventOptions(eventOptions));
153
+ export { metaPixelCustomEvent, metaPixelEvent, metaPixelManifest, metaPixelSingleCustomEvent, metaPixelSingleEvent, meta_pixel_metaPixel as metaPixel };
@@ -2,109 +2,109 @@ import { resolveManifest } from "../../resolve.js";
2
2
  import { vendorManifestContract } from "../../types.js";
3
3
  const microsoftUetManifest = {
4
4
  ...vendorManifestContract,
5
- vendor: 'microsoft-uet',
6
- category: 'marketing',
5
+ afterLoad: [
6
+ {
7
+ args: [
8
+ {
9
+ enableAutoSpaTracking: true,
10
+ ti: '{{id}}'
11
+ }
12
+ ],
13
+ assignTo: 'uetq',
14
+ constructor: 'UET',
15
+ copyAssignedValueToArgProperty: 'q',
16
+ type: 'constructGlobal'
17
+ },
18
+ {
19
+ args: [
20
+ 'pageLoad'
21
+ ],
22
+ global: 'uetq',
23
+ method: 'push',
24
+ type: 'callGlobal'
25
+ }
26
+ ],
7
27
  alwaysLoad: true,
8
- persistAfterConsentRevoked: true,
9
28
  bootstrap: [
10
29
  {
11
- type: 'setGlobal',
30
+ ifUndefined: true,
12
31
  name: 'uetq',
13
- value: [],
14
- ifUndefined: true
32
+ type: 'setGlobal',
33
+ value: []
15
34
  }
16
35
  ],
17
- onBeforeLoadGranted: [
36
+ category: 'marketing',
37
+ install: [
18
38
  {
19
- type: 'callGlobal',
20
- global: 'uetq',
21
- method: 'push',
22
- args: [
23
- 'consent',
24
- 'default',
25
- {
26
- ad_storage: 'granted'
27
- }
28
- ]
39
+ async: true,
40
+ src: "{{scriptSrc}}",
41
+ type: 'loadScript'
29
42
  }
30
43
  ],
31
44
  onBeforeLoadDenied: [
32
45
  {
33
- type: 'callGlobal',
34
- global: 'uetq',
35
- method: 'push',
36
46
  args: [
37
47
  'consent',
38
48
  'default',
39
49
  {
40
50
  ad_storage: 'denied'
41
51
  }
42
- ]
43
- }
44
- ],
45
- install: [
46
- {
47
- type: 'loadScript',
48
- src: "{{scriptSrc}}",
49
- async: true
52
+ ],
53
+ global: 'uetq',
54
+ method: 'push',
55
+ type: 'callGlobal'
50
56
  }
51
57
  ],
52
- afterLoad: [
58
+ onBeforeLoadGranted: [
53
59
  {
54
- type: 'constructGlobal',
55
- constructor: 'UET',
56
- assignTo: 'uetq',
57
60
  args: [
61
+ 'consent',
62
+ 'default',
58
63
  {
59
- ti: '{{id}}',
60
- enableAutoSpaTracking: true
64
+ ad_storage: 'granted'
61
65
  }
62
66
  ],
63
- copyAssignedValueToArgProperty: 'q'
64
- },
65
- {
66
- type: 'callGlobal',
67
67
  global: 'uetq',
68
68
  method: 'push',
69
- args: [
70
- 'pageLoad'
71
- ]
69
+ type: 'callGlobal'
72
70
  }
73
71
  ],
74
- onConsentGranted: [
72
+ onConsentDenied: [
75
73
  {
76
- type: 'callGlobal',
77
- global: 'uetq',
78
- method: 'push',
79
74
  args: [
80
75
  'consent',
81
76
  'update',
82
77
  {
83
- ad_storage: 'granted'
78
+ ad_storage: 'denied'
84
79
  }
85
- ]
80
+ ],
81
+ global: 'uetq',
82
+ method: 'push',
83
+ type: 'callGlobal'
86
84
  }
87
85
  ],
88
- onConsentDenied: [
86
+ onConsentGranted: [
89
87
  {
90
- type: 'callGlobal',
91
- global: 'uetq',
92
- method: 'push',
93
88
  args: [
94
89
  'consent',
95
90
  'update',
96
91
  {
97
- ad_storage: 'denied'
92
+ ad_storage: 'granted'
98
93
  }
99
- ]
94
+ ],
95
+ global: 'uetq',
96
+ method: 'push',
97
+ type: 'callGlobal'
100
98
  }
101
- ]
99
+ ],
100
+ persistAfterConsentRevoked: true,
101
+ vendor: 'microsoft-uet'
102
102
  };
103
- function microsoftUet({ id, scriptSrc }) {
103
+ const microsoft_uet_microsoftUet = function({ id, scriptSrc }) {
104
104
  const resolved = resolveManifest(microsoftUetManifest, {
105
105
  id,
106
106
  scriptSrc: scriptSrc ?? '//bat.bing.com/bat.js'
107
107
  });
108
108
  return resolved;
109
- }
110
- export { microsoftUet, microsoftUetManifest };
109
+ };
110
+ export { microsoftUetManifest, microsoft_uet_microsoftUet as microsoftUet };
@@ -0,0 +1,88 @@
1
+ import { resolveManifest } from "../../resolve.js";
2
+ import { vendorManifestContract } from "../../types.js";
3
+ import { resolveScriptUrl } from "../_shared/script-url.js";
4
+ const openaiPixelManifest = {
5
+ ...vendorManifestContract,
6
+ bootstrap: [
7
+ {
8
+ ifUndefined: true,
9
+ name: 'oaiq',
10
+ queue: {
11
+ property: 'q'
12
+ },
13
+ type: 'defineStubFunction'
14
+ },
15
+ {
16
+ args: [
17
+ 'consent',
18
+ false
19
+ ],
20
+ global: 'oaiq',
21
+ type: 'callGlobal'
22
+ }
23
+ ],
24
+ category: 'marketing',
25
+ install: [
26
+ {
27
+ args: [
28
+ 'init',
29
+ '{{initOptions}}'
30
+ ],
31
+ global: 'oaiq',
32
+ type: 'callGlobal'
33
+ },
34
+ {
35
+ async: true,
36
+ src: "{{scriptSrc}}",
37
+ type: 'loadScript'
38
+ }
39
+ ],
40
+ onBeforeLoadGranted: [
41
+ {
42
+ args: [
43
+ 'consent',
44
+ true
45
+ ],
46
+ global: 'oaiq',
47
+ type: 'callGlobal'
48
+ }
49
+ ],
50
+ onConsentDenied: [
51
+ {
52
+ args: [
53
+ 'consent',
54
+ false
55
+ ],
56
+ global: 'oaiq',
57
+ type: 'callGlobal'
58
+ }
59
+ ],
60
+ onConsentGranted: [
61
+ {
62
+ args: [
63
+ 'consent',
64
+ true
65
+ ],
66
+ global: 'oaiq',
67
+ type: 'callGlobal'
68
+ }
69
+ ],
70
+ persistAfterConsentRevoked: true,
71
+ vendor: 'openai-pixel'
72
+ };
73
+ const openai_pixel_openaiPixel = function({ pixelId, debug = false, user, scriptSrc }) {
74
+ const initOptions = {
75
+ debug,
76
+ pixelId
77
+ };
78
+ if (void 0 !== user) initOptions.user = user;
79
+ return resolveManifest(openaiPixelManifest, {
80
+ initOptions,
81
+ scriptSrc: resolveScriptUrl(scriptSrc, 'https://bzrcdn.openai.com/sdk/oaiq.min.js')
82
+ });
83
+ };
84
+ const openai_pixel_openaiPixelEvent = function(...args) {
85
+ if ("u" < typeof window || 'function' != typeof window.oaiq) return;
86
+ window.oaiq('measure', ...args);
87
+ };
88
+ export { openaiPixelManifest, openai_pixel_openaiPixel as openaiPixel, openai_pixel_openaiPixelEvent as openaiPixelEvent };