@c15t/scripts 2.2.0 → 3.0.0-alpha.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 (197) hide show
  1. package/AGENTS.md +74 -48
  2. package/README.md +3 -3
  3. package/dist/e2e-test-utils.js +60 -24
  4. package/dist/engine/compile.js +45 -45
  5. package/dist/engine/runtime.js +119 -119
  6. package/dist/registry.js +186 -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 +31 -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/google-tag-manager.js +20 -20
  47. package/dist-types/__tests__/helpers.d.ts +10 -10
  48. package/dist-types/engine/compile.d.ts +2 -2
  49. package/dist-types/engine/runtime.d.ts +3 -3
  50. package/dist-types/registry.d.ts +182 -173
  51. package/dist-types/resolve.d.ts +2 -2
  52. package/dist-types/types.d.ts +2 -2
  53. package/dist-types/vendors/_shared/attributes.d.ts +2 -2
  54. package/dist-types/vendors/_shared/google-consent.d.ts +2 -2
  55. package/dist-types/vendors/_shared/install-builders.d.ts +1 -1
  56. package/dist-types/vendors/_shared/script-url.d.ts +6 -6
  57. package/dist-types/vendors/ads-and-pixels/linkedin-insights.d.ts +14 -14
  58. package/dist-types/vendors/ads-and-pixels/meta-pixel.d.ts +27 -27
  59. package/dist-types/vendors/ads-and-pixels/microsoft-uet.d.ts +40 -40
  60. package/dist-types/vendors/ads-and-pixels/openai-pixel.d.ts +211 -0
  61. package/dist-types/vendors/ads-and-pixels/reddit-pixel.d.ts +28 -29
  62. package/dist-types/vendors/ads-and-pixels/snapchat-pixel.d.ts +23 -23
  63. package/dist-types/vendors/ads-and-pixels/tiktok-pixel.d.ts +22 -22
  64. package/dist-types/vendors/ads-and-pixels/x-pixel.d.ts +15 -15
  65. package/dist-types/vendors/analytics/adobe-analytics.d.ts +3 -3
  66. package/dist-types/vendors/analytics/ahrefs-analytics.d.ts +5 -5
  67. package/dist-types/vendors/analytics/amplitude.d.ts +24 -24
  68. package/dist-types/vendors/analytics/clearbit.d.ts +5 -5
  69. package/dist-types/vendors/analytics/cloudflare-web-analytics.d.ts +6 -6
  70. package/dist-types/vendors/analytics/databuddy.d.ts +34 -31
  71. package/dist-types/vendors/analytics/fathom-analytics.d.ts +8 -8
  72. package/dist-types/vendors/analytics/google-tag.d.ts +17 -17
  73. package/dist-types/vendors/analytics/heap.d.ts +17 -17
  74. package/dist-types/vendors/analytics/hightouch.d.ts +15 -15
  75. package/dist-types/vendors/analytics/hotjar.d.ts +9 -9
  76. package/dist-types/vendors/analytics/logrocket.d.ts +11 -11
  77. package/dist-types/vendors/analytics/matomo-analytics.d.ts +3 -3
  78. package/dist-types/vendors/analytics/microsoft-clarity.d.ts +12 -13
  79. package/dist-types/vendors/analytics/mixpanel-analytics.d.ts +20 -20
  80. package/dist-types/vendors/analytics/pirsch.d.ts +10 -10
  81. package/dist-types/vendors/analytics/plausible-analytics.d.ts +13 -13
  82. package/dist-types/vendors/analytics/posthog.d.ts +35 -32
  83. package/dist-types/vendors/analytics/promptwatch.d.ts +5 -5
  84. package/dist-types/vendors/analytics/rudderstack.d.ts +16 -16
  85. package/dist-types/vendors/analytics/rybbit-analytics.d.ts +15 -15
  86. package/dist-types/vendors/analytics/segment.d.ts +11 -11
  87. package/dist-types/vendors/analytics/umami-analytics.d.ts +9 -9
  88. package/dist-types/vendors/analytics/vercel-analytics.d.ts +13 -13
  89. package/dist-types/vendors/functional/crisp.d.ts +9 -9
  90. package/dist-types/vendors/functional/intercom.d.ts +12 -12
  91. package/dist-types/vendors/tag-managers/google-tag-manager.d.ts +16 -16
  92. package/docs/README.md +74 -48
  93. package/docs/assets/v3/brand-bar.png +0 -0
  94. package/docs/assets/v3/brand-card.png +0 -0
  95. package/docs/assets/v3/choice-wall.png +0 -0
  96. package/docs/assets/v3/mobile-card.png +0 -0
  97. package/docs/assets/v3/preferences.png +0 -0
  98. package/docs/customization/overview.md +45 -0
  99. package/docs/customization/recipes.md +79 -0
  100. package/docs/customization/slots.md +55 -0
  101. package/docs/customization/tokens.md +76 -0
  102. package/docs/customization/translations.md +49 -0
  103. package/docs/frameworks/javascript/script-loader.md +30 -339
  104. package/docs/frameworks/next/script-loader.md +134 -467
  105. package/docs/frameworks/react/script-loader.md +35 -535
  106. package/docs/guides/consent-state.md +60 -0
  107. package/docs/guides/data-fetching.md +163 -0
  108. package/docs/guides/deployment-modes.md +63 -0
  109. package/docs/guides/troubleshooting.md +68 -0
  110. package/docs/guides/verify-consent.md +62 -0
  111. package/docs/integrations/adobe-analytics.md +239 -105
  112. package/docs/integrations/ahrefs-analytics.md +238 -104
  113. package/docs/integrations/amplitude.md +219 -157
  114. package/docs/integrations/building-integrations.md +32 -224
  115. package/docs/integrations/clearbit.md +247 -86
  116. package/docs/integrations/cloudflare-web-analytics.md +250 -84
  117. package/docs/integrations/crisp.md +251 -97
  118. package/docs/integrations/databuddy.md +259 -153
  119. package/docs/integrations/fathom-analytics.md +239 -96
  120. package/docs/integrations/google-maps.md +328 -207
  121. package/docs/integrations/google-tag-manager.md +248 -96
  122. package/docs/integrations/google-tag.md +261 -90
  123. package/docs/integrations/heap.md +222 -149
  124. package/docs/integrations/hightouch.md +225 -131
  125. package/docs/integrations/hotjar.md +239 -90
  126. package/docs/integrations/intercom.md +239 -98
  127. package/docs/integrations/linkedin-insights.md +243 -113
  128. package/docs/integrations/logrocket.md +241 -123
  129. package/docs/integrations/matomo-analytics.md +256 -111
  130. package/docs/integrations/meta-pixel.md +197 -324
  131. package/docs/integrations/microsoft-clarity.md +233 -114
  132. package/docs/integrations/microsoft-uet.md +245 -110
  133. package/docs/integrations/mixpanel-analytics.md +252 -87
  134. package/docs/integrations/openai-pixel.md +441 -0
  135. package/docs/integrations/overview.md +95 -133
  136. package/docs/integrations/pirsch.md +249 -96
  137. package/docs/integrations/plausible-analytics.md +241 -100
  138. package/docs/integrations/posthog.md +353 -214
  139. package/docs/integrations/promptwatch.md +251 -81
  140. package/docs/integrations/reddit-pixel.md +226 -173
  141. package/docs/integrations/rudderstack.md +244 -187
  142. package/docs/integrations/rybbit-analytics.md +244 -91
  143. package/docs/integrations/segment.md +238 -92
  144. package/docs/integrations/snapchat-pixel.md +240 -110
  145. package/docs/integrations/tiktok-pixel.md +249 -81
  146. package/docs/integrations/umami-analytics.md +242 -95
  147. package/docs/integrations/vercel-analytics.md +242 -90
  148. package/docs/integrations/x-pixel.md +238 -104
  149. package/docs/integrations/youtube.md +354 -142
  150. package/docs/upgrade-v3.md +334 -0
  151. package/package.json +85 -78
  152. package/readme.json +2 -2
  153. package/dist/e2e-test-utils.cjs +0 -166
  154. package/dist/engine/compile.cjs +0 -130
  155. package/dist/engine/runtime.cjs +0 -475
  156. package/dist/registry.cjs +0 -423
  157. package/dist/resolve.cjs +0 -71
  158. package/dist/types.cjs +0 -69
  159. package/dist/vendors/_shared/attributes.cjs +0 -55
  160. package/dist/vendors/_shared/google-consent.cjs +0 -69
  161. package/dist/vendors/_shared/install-builders.cjs +0 -59
  162. package/dist/vendors/_shared/script-url.cjs +0 -78
  163. package/dist/vendors/ads-and-pixels/linkedin-insights.cjs +0 -89
  164. package/dist/vendors/ads-and-pixels/meta-pixel.cjs +0 -206
  165. package/dist/vendors/ads-and-pixels/microsoft-uet.cjs +0 -151
  166. package/dist/vendors/ads-and-pixels/reddit-pixel.cjs +0 -151
  167. package/dist/vendors/ads-and-pixels/snapchat-pixel.cjs +0 -131
  168. package/dist/vendors/ads-and-pixels/tiktok-pixel.cjs +0 -130
  169. package/dist/vendors/ads-and-pixels/x-pixel.cjs +0 -92
  170. package/dist/vendors/analytics/adobe-analytics.cjs +0 -90
  171. package/dist/vendors/analytics/ahrefs-analytics.cjs +0 -68
  172. package/dist/vendors/analytics/amplitude.cjs +0 -193
  173. package/dist/vendors/analytics/clearbit.cjs +0 -69
  174. package/dist/vendors/analytics/cloudflare-web-analytics.cjs +0 -73
  175. package/dist/vendors/analytics/databuddy.cjs +0 -144
  176. package/dist/vendors/analytics/fathom-analytics.cjs +0 -76
  177. package/dist/vendors/analytics/google-tag.cjs +0 -107
  178. package/dist/vendors/analytics/heap.cjs +0 -181
  179. package/dist/vendors/analytics/hightouch.cjs +0 -153
  180. package/dist/vendors/analytics/hotjar.cjs +0 -85
  181. package/dist/vendors/analytics/logrocket.cjs +0 -99
  182. package/dist/vendors/analytics/matomo-analytics.cjs +0 -232
  183. package/dist/vendors/analytics/microsoft-clarity.cjs +0 -138
  184. package/dist/vendors/analytics/mixpanel-analytics.cjs +0 -134
  185. package/dist/vendors/analytics/pirsch.cjs +0 -108
  186. package/dist/vendors/analytics/plausible-analytics.cjs +0 -122
  187. package/dist/vendors/analytics/posthog.cjs +0 -236
  188. package/dist/vendors/analytics/promptwatch.cjs +0 -70
  189. package/dist/vendors/analytics/rudderstack.cjs +0 -227
  190. package/dist/vendors/analytics/rybbit-analytics.cjs +0 -104
  191. package/dist/vendors/analytics/segment.cjs +0 -97
  192. package/dist/vendors/analytics/umami-analytics.cjs +0 -80
  193. package/dist/vendors/analytics/vercel-analytics.cjs +0 -94
  194. package/dist/vendors/functional/crisp.cjs +0 -143
  195. package/dist/vendors/functional/intercom.cjs +0 -89
  196. package/dist/vendors/tag-managers/google-tag-manager.cjs +0 -100
  197. package/docs/shared/react/guides/script-loader.md +0 -311
@@ -3,30 +3,30 @@ import { vendorManifestContract } from "../../types.js";
3
3
  import { resolveScriptUrl } from "../_shared/script-url.js";
4
4
  const cloudflareWebAnalyticsManifest = {
5
5
  ...vendorManifestContract,
6
- vendor: 'cloudflare-web-analytics',
7
6
  category: 'measurement',
8
7
  install: [
9
8
  {
10
- type: 'loadScript',
11
- src: "{{scriptUrl}}",
12
- defer: true,
13
9
  attributes: {
14
10
  'data-cf-beacon': '{{beaconConfig}}'
15
- }
11
+ },
12
+ defer: true,
13
+ src: "{{scriptUrl}}",
14
+ type: 'loadScript'
16
15
  }
17
- ]
16
+ ],
17
+ vendor: 'cloudflare-web-analytics'
18
18
  };
19
- function cloudflareWebAnalytics(options) {
19
+ const cloudflare_web_analytics_cloudflareWebAnalytics = function(options) {
20
20
  let token;
21
21
  token = 'string' == typeof options.token ? options.token.trim() : '';
22
22
  if (0 === token.length) throw new Error('cloudflareWebAnalytics: missing token');
23
23
  const resolved = resolveManifest(cloudflareWebAnalyticsManifest, {
24
- scriptUrl: resolveScriptUrl(options.scriptUrl, 'https://static.cloudflareinsights.com/beacon.min.js'),
25
24
  beaconConfig: JSON.stringify({
26
- token,
27
- spa: options.spa ?? true
28
- })
25
+ spa: options.spa ?? true,
26
+ token
27
+ }),
28
+ scriptUrl: resolveScriptUrl(options.scriptUrl, 'https://static.cloudflareinsights.com/beacon.min.js')
29
29
  });
30
30
  return resolved;
31
- }
32
- export { cloudflareWebAnalytics, cloudflareWebAnalyticsManifest };
31
+ };
32
+ export { cloudflareWebAnalyticsManifest, cloudflare_web_analytics_cloudflareWebAnalytics as cloudflareWebAnalytics };
@@ -2,102 +2,102 @@ import { resolveManifest } from "../../resolve.js";
2
2
  import { vendorManifestContract } from "../../types.js";
3
3
  const databuddyManifest = {
4
4
  ...vendorManifestContract,
5
- vendor: 'databuddy',
6
- category: 'measurement',
7
5
  alwaysLoad: true,
6
+ category: 'measurement',
8
7
  install: [
9
8
  {
10
- type: 'loadScript',
11
- src: "{{scriptUrl}}",
12
9
  async: true,
13
10
  attributes: {
14
11
  crossorigin: 'anonymous',
15
- 'data-client-id': '{{clientId}}',
16
- 'data-api-url': '{{apiUrl}}'
17
- }
12
+ 'data-api-url': '{{apiUrl}}',
13
+ 'data-client-id': '{{clientId}}'
14
+ },
15
+ src: "{{scriptUrl}}",
16
+ type: 'loadScript'
18
17
  }
19
18
  ],
20
- onBeforeLoadGranted: [
19
+ onBeforeLoadDenied: [
21
20
  {
22
- type: 'setGlobal',
21
+ ifUndefined: true,
23
22
  name: 'databuddyConfig',
24
- value: '{{configWhenGranted}}',
25
- ifUndefined: true
23
+ type: 'setGlobal',
24
+ value: '{{configWhenDenied}}'
26
25
  }
27
26
  ],
28
- onBeforeLoadDenied: [
27
+ onBeforeLoadGranted: [
29
28
  {
30
- type: 'setGlobal',
29
+ ifUndefined: true,
31
30
  name: 'databuddyConfig',
32
- value: '{{configWhenDenied}}',
33
- ifUndefined: true
31
+ type: 'setGlobal',
32
+ value: '{{configWhenGranted}}'
34
33
  }
35
34
  ],
36
- onLoadGranted: [
35
+ onConsentDenied: [
37
36
  {
38
- type: 'setGlobalPath',
39
- path: [
40
- 'databuddy',
41
- 'options',
42
- 'disabled'
43
- ],
44
- value: false
45
- }
46
- ],
47
- onLoadDenied: [
37
+ ifUndefined: false,
38
+ name: 'databuddyConfig',
39
+ type: 'setGlobal',
40
+ value: '{{configWhenDenied}}'
41
+ },
48
42
  {
49
- type: 'setGlobalPath',
50
43
  path: [
51
44
  'databuddy',
52
45
  'options',
53
46
  'disabled'
54
47
  ],
48
+ type: 'setGlobalPath',
55
49
  value: true
56
50
  }
57
51
  ],
58
52
  onConsentGranted: [
59
53
  {
60
- type: 'setGlobal',
54
+ ifUndefined: false,
61
55
  name: 'databuddyConfig',
62
- value: '{{configWhenGranted}}',
63
- ifUndefined: false
56
+ type: 'setGlobal',
57
+ value: '{{configWhenGranted}}'
64
58
  },
65
59
  {
66
- type: 'setGlobalPath',
67
60
  path: [
68
61
  'databuddy',
69
62
  'options',
70
63
  'disabled'
71
64
  ],
65
+ type: 'setGlobalPath',
72
66
  value: false
73
67
  }
74
68
  ],
75
- onConsentDenied: [
76
- {
77
- type: 'setGlobal',
78
- name: 'databuddyConfig',
79
- value: '{{configWhenDenied}}',
80
- ifUndefined: false
81
- },
69
+ onLoadDenied: [
82
70
  {
83
- type: 'setGlobalPath',
84
71
  path: [
85
72
  'databuddy',
86
73
  'options',
87
74
  'disabled'
88
75
  ],
76
+ type: 'setGlobalPath',
89
77
  value: true
90
78
  }
91
- ]
79
+ ],
80
+ onLoadGranted: [
81
+ {
82
+ path: [
83
+ 'databuddy',
84
+ 'options',
85
+ 'disabled'
86
+ ],
87
+ type: 'setGlobalPath',
88
+ value: false
89
+ }
90
+ ],
91
+ vendor: 'databuddy'
92
92
  };
93
- function databuddy(options) {
93
+ const databuddy_databuddy = function(options) {
94
94
  const resolved = resolveManifest(databuddyManifest, {
95
- clientId: options.clientId,
96
95
  apiUrl: options.apiUrl ?? 'https://basket.databuddy.cc',
97
- configWhenGranted: options.configWhenGranted,
96
+ clientId: options.clientId,
98
97
  configWhenDenied: options.configWhenDenied,
98
+ configWhenGranted: options.configWhenGranted,
99
99
  scriptUrl: options.scriptUrl ?? 'https://cdn.databuddy.cc/databuddy.js'
100
100
  });
101
101
  return resolved;
102
- }
103
- export { databuddy, databuddyManifest };
102
+ };
103
+ export { databuddyManifest, databuddy_databuddy as databuddy };
@@ -4,32 +4,32 @@ import { booleanDataAttribute } from "../_shared/attributes.js";
4
4
  import { resolveScriptUrl } from "../_shared/script-url.js";
5
5
  const fathomAnalyticsManifest = {
6
6
  ...vendorManifestContract,
7
- vendor: 'fathom-analytics',
8
7
  category: 'measurement',
9
8
  install: [
10
9
  {
11
- type: 'loadScript',
12
- src: "{{scriptUrl}}",
13
- defer: true,
14
10
  attributes: {
15
- 'data-site': '{{site}}',
16
- 'data-spa': '{{spa}}',
17
11
  'data-auto': '{{autoAttribute}}',
18
12
  'data-canonical': '{{canonicalAttribute}}',
19
- 'data-honor-dnt': '{{honorDntAttribute}}'
20
- }
13
+ 'data-honor-dnt': '{{honorDntAttribute}}',
14
+ 'data-site': '{{site}}',
15
+ 'data-spa': '{{spa}}'
16
+ },
17
+ defer: true,
18
+ src: "{{scriptUrl}}",
19
+ type: 'loadScript'
21
20
  }
22
- ]
21
+ ],
22
+ vendor: 'fathom-analytics'
23
23
  };
24
- function fathomAnalytics(options) {
24
+ const fathom_analytics_fathomAnalytics = function(options) {
25
25
  const resolved = resolveManifest(fathomAnalyticsManifest, {
26
- site: options.site,
27
- spa: options.spa,
28
26
  autoAttribute: booleanDataAttribute(options.auto),
29
27
  canonicalAttribute: booleanDataAttribute(options.canonical),
30
28
  honorDntAttribute: booleanDataAttribute(options.honorDnt),
31
- scriptUrl: resolveScriptUrl(options.scriptUrl, "https://cdn.usefathom.com/script.js")
29
+ scriptUrl: resolveScriptUrl(options.scriptUrl, "https://cdn.usefathom.com/script.js"),
30
+ site: options.site,
31
+ spa: options.spa
32
32
  });
33
33
  return resolved;
34
- }
35
- export { fathomAnalytics, fathomAnalyticsManifest };
34
+ };
35
+ export { fathomAnalyticsManifest, fathom_analytics_fathomAnalytics as fathomAnalytics };
@@ -3,55 +3,55 @@ import { runtimeDateValue, vendorManifestContract } from "../../types.js";
3
3
  import { GOOGLE_CONSENT_MODE_V2_DEFAULT_MAPPING, withOptionalConsentMapping } from "../_shared/google-consent.js";
4
4
  const gtagManifest = {
5
5
  ...vendorManifestContract,
6
- vendor: 'gtag',
7
- category: '{{category}}',
8
6
  alwaysLoad: true,
9
- persistAfterConsentRevoked: true,
10
7
  bootstrap: [
11
8
  {
12
- type: 'setGlobal',
9
+ ifUndefined: true,
13
10
  name: 'dataLayer',
14
- value: [],
15
- ifUndefined: true
11
+ type: 'setGlobal',
12
+ value: []
16
13
  },
17
14
  {
18
- type: 'defineQueueFunction',
15
+ ifUndefined: true,
19
16
  name: 'gtag',
20
17
  queue: 'dataLayer',
21
- ifUndefined: true
18
+ type: 'defineQueueFunction'
22
19
  }
23
20
  ],
21
+ category: '{{category}}',
22
+ consentMapping: GOOGLE_CONSENT_MODE_V2_DEFAULT_MAPPING,
23
+ consentSignal: 'gtag',
24
24
  install: [
25
25
  {
26
- type: 'callGlobal',
27
- global: 'gtag',
28
26
  args: [
29
27
  'js',
30
28
  runtimeDateValue
31
- ]
29
+ ],
30
+ global: 'gtag',
31
+ type: 'callGlobal'
32
32
  },
33
33
  {
34
- type: 'callGlobal',
35
- global: 'gtag',
36
34
  args: [
37
35
  'config',
38
36
  '{{id}}'
39
- ]
37
+ ],
38
+ global: 'gtag',
39
+ type: 'callGlobal'
40
40
  },
41
41
  {
42
- type: 'loadScript',
42
+ async: true,
43
43
  src: 'https://www.googletagmanager.com/gtag/js?id={{id}}',
44
- async: true
44
+ type: 'loadScript'
45
45
  }
46
46
  ],
47
- consentMapping: GOOGLE_CONSENT_MODE_V2_DEFAULT_MAPPING,
48
- consentSignal: 'gtag'
47
+ persistAfterConsentRevoked: true,
48
+ vendor: 'gtag'
49
49
  };
50
- function gtag({ id, category, consentMapping, script }) {
50
+ const google_tag_gtag = function({ id, category, consentMapping, script }) {
51
51
  const manifest = withOptionalConsentMapping(gtagManifest, consentMapping);
52
52
  const resolved = resolveManifest(manifest, {
53
- id,
54
- category
53
+ category,
54
+ id
55
55
  });
56
56
  if (!script) return resolved;
57
57
  return {
@@ -62,5 +62,5 @@ function gtag({ id, category, consentMapping, script }) {
62
62
  ...script.attributes ?? {}
63
63
  }
64
64
  };
65
- }
66
- export { gtag, gtagManifest };
65
+ };
66
+ export { google_tag_gtag as gtag, gtagManifest };
@@ -29,74 +29,74 @@ const HEAP_QUEUE_METHODS = [
29
29
  ];
30
30
  const heapManifest = {
31
31
  ...vendorManifestContract,
32
- vendor: 'heap',
33
32
  category: 'measurement',
34
33
  install: [
35
34
  {
36
- type: 'setGlobal',
35
+ ifUndefined: true,
37
36
  name: 'heapReadyCb',
38
- value: [],
39
- ifUndefined: true
37
+ type: 'setGlobal',
38
+ value: []
40
39
  },
41
40
  {
42
- type: 'setGlobal',
41
+ ifUndefined: true,
43
42
  name: 'heap',
44
- value: [],
45
- ifUndefined: true
43
+ type: 'setGlobal',
44
+ value: []
46
45
  },
47
46
  {
48
- type: 'setGlobalPath',
49
47
  path: [
50
48
  'heap',
51
49
  'envId'
52
50
  ],
51
+ type: 'setGlobalPath',
53
52
  value: '{{envId}}'
54
53
  },
55
54
  {
56
- type: 'setGlobalPath',
57
55
  path: [
58
56
  'heap',
59
57
  'appid'
60
58
  ],
59
+ type: 'setGlobalPath',
61
60
  value: '{{envId}}'
62
61
  },
63
62
  {
64
- type: 'setGlobalPath',
65
63
  path: [
66
64
  'heap',
67
65
  'clientConfig'
68
66
  ],
67
+ type: 'setGlobalPath',
69
68
  value: '{{clientConfig}}'
70
69
  },
71
70
  {
72
- type: 'defineQueueMethods',
73
- target: 'heap',
71
+ methods: [
72
+ ...HEAP_QUEUE_METHODS
73
+ ],
74
74
  queue: {
75
75
  global: 'heapReadyCb'
76
76
  },
77
77
  queueFormat: 'callback',
78
- methods: [
79
- ...HEAP_QUEUE_METHODS
80
- ]
78
+ target: 'heap',
79
+ type: 'defineQueueMethods'
81
80
  },
82
81
  {
83
- type: 'loadScript',
82
+ async: true,
84
83
  src: "{{scriptUrl}}",
85
- async: true
84
+ type: 'loadScript'
86
85
  }
87
- ]
86
+ ],
87
+ vendor: 'heap'
88
88
  };
89
- function validateEnvId(envId) {
89
+ const heap_validateEnvId = function(envId) {
90
90
  const normalized = 'string' == typeof envId ? envId.trim() : '';
91
91
  if (0 === normalized.length) throw new Error('heap: missing or invalid envId');
92
92
  return normalized;
93
- }
94
- function isPlainRecord(value) {
93
+ };
94
+ const heap_isPlainRecord = function(value) {
95
95
  if (null === value || 'object' != typeof value || Array.isArray(value)) return false;
96
96
  const prototype = Object.getPrototypeOf(value);
97
97
  return prototype === Object.prototype || null === prototype;
98
- }
99
- function toJsonValue(value, path) {
98
+ };
99
+ const heap_toJsonValue = function toJsonValue(value, path) {
100
100
  if (null === value) return null;
101
101
  if ('string' == typeof value || 'boolean' == typeof value) return value;
102
102
  if ('number' == typeof value) {
@@ -104,31 +104,31 @@ function toJsonValue(value, path) {
104
104
  throw new TypeError(`heap: clientConfig${path ? `.${path}` : ''} must be a finite number`);
105
105
  }
106
106
  if (Array.isArray(value)) return value.map((item, index)=>toJsonValue(item, `${path}[${index}]`));
107
- if (isPlainRecord(value)) {
107
+ if (heap_isPlainRecord(value)) {
108
108
  const result = {};
109
109
  for (const [key, nestedValue] of Object.entries(value))result[key] = toJsonValue(nestedValue, path ? `${path}.${key}` : key);
110
110
  return result;
111
111
  }
112
112
  throw new TypeError(`heap: clientConfig${path ? `.${path}` : ''} must be JSON-serializable`);
113
- }
114
- function normalizeClientConfig(clientConfig) {
113
+ };
114
+ const heap_normalizeClientConfig = function(clientConfig) {
115
115
  const config = clientConfig ?? {};
116
- const normalized = toJsonValue(config, '');
117
- if (!isPlainRecord(normalized)) throw new TypeError('heap: clientConfig must be a plain object');
116
+ const normalized = heap_toJsonValue(config, '');
117
+ if (!heap_isPlainRecord(normalized)) throw new TypeError('heap: clientConfig must be a plain object');
118
118
  return {
119
119
  ...normalized,
120
120
  shouldFetchServerConfig: false
121
121
  };
122
- }
123
- function resolveHeapScriptUrl(envId, scriptUrl) {
122
+ };
123
+ const heap_resolveHeapScriptUrl = function(envId, scriptUrl) {
124
124
  return resolveScriptUrl(trimToUndefined(scriptUrl), joinUrlPath(DEFAULT_HEAP_CONFIG_BASE_URL, `${envId}/heap_config.js`));
125
- }
126
- function heap({ envId, clientConfig, scriptUrl }) {
127
- const normalizedEnvId = validateEnvId(envId);
125
+ };
126
+ const heap_heap = function({ envId, clientConfig, scriptUrl }) {
127
+ const normalizedEnvId = heap_validateEnvId(envId);
128
128
  return resolveManifest(heapManifest, {
129
+ clientConfig: heap_normalizeClientConfig(clientConfig),
129
130
  envId: normalizedEnvId,
130
- clientConfig: normalizeClientConfig(clientConfig),
131
- scriptUrl: resolveHeapScriptUrl(normalizedEnvId, scriptUrl)
131
+ scriptUrl: heap_resolveHeapScriptUrl(normalizedEnvId, scriptUrl)
132
132
  });
133
- }
134
- export { DEFAULT_HEAP_CONFIG_BASE_URL, HEAP_QUEUE_METHODS, heap, heapManifest };
133
+ };
134
+ export { DEFAULT_HEAP_CONFIG_BASE_URL, HEAP_QUEUE_METHODS, heapManifest, heap_heap as heap };
@@ -27,73 +27,73 @@ const HIGHTOUCH_QUEUE_METHODS = [
27
27
  ];
28
28
  const hightouchManifest = {
29
29
  ...vendorManifestContract,
30
- vendor: 'hightouch',
31
- category: 'measurement',
32
30
  bootstrap: [
33
31
  {
34
- type: 'setGlobal',
32
+ ifUndefined: true,
35
33
  name: 'htevents',
36
- value: [],
37
- ifUndefined: true
34
+ type: 'setGlobal',
35
+ value: []
38
36
  },
39
37
  {
40
- type: 'defineQueueMethods',
41
- target: 'htevents',
42
38
  methods: [
43
39
  ...HIGHTOUCH_QUEUE_METHODS
44
- ]
40
+ ],
41
+ target: 'htevents',
42
+ type: 'defineQueueMethods'
45
43
  },
46
44
  {
47
- type: 'setGlobalPath',
48
45
  path: [
49
46
  'htevents',
50
47
  '_writeKey'
51
48
  ],
49
+ type: 'setGlobalPath',
52
50
  value: '{{writeKey}}'
53
51
  },
54
52
  {
55
- type: 'setGlobalPath',
56
53
  path: [
57
54
  'htevents',
58
55
  '_loadOptions'
59
56
  ],
57
+ type: 'setGlobalPath',
60
58
  value: '{{loadOptions}}'
61
59
  }
62
60
  ],
61
+ category: 'measurement',
63
62
  install: [
64
63
  {
65
- type: 'callGlobal',
66
- global: 'htevents',
67
- method: 'load',
68
64
  args: [
69
65
  '{{writeKey}}',
70
66
  '{{loadOptions}}'
71
- ]
67
+ ],
68
+ global: 'htevents',
69
+ method: 'load',
70
+ type: 'callGlobal'
72
71
  },
73
72
  {
74
- type: 'callGlobal',
75
73
  global: 'htevents',
76
- method: 'page'
74
+ method: 'page',
75
+ type: 'callGlobal'
77
76
  },
78
77
  {
79
- type: 'loadScript',
78
+ async: true,
80
79
  src: "{{scriptUrl}}",
81
- async: true
80
+ type: 'loadScript'
82
81
  }
83
- ]
82
+ ],
83
+ vendor: 'hightouch'
84
84
  };
85
- function validateWriteKey(writeKey) {
85
+ const hightouch_validateWriteKey = function(writeKey) {
86
86
  const normalized = 'string' == typeof writeKey ? writeKey.trim() : '';
87
87
  if (0 === normalized.length) throw new Error('hightouch: missing or invalid writeKey');
88
88
  return normalized;
89
- }
90
- function normalizeApiHost(apiHost) {
89
+ };
90
+ const hightouch_normalizeApiHost = function(apiHost) {
91
91
  return trimToUndefined(apiHost);
92
- }
93
- function hightouch({ writeKey, apiHost, trackPageView = true, scriptUrl }) {
94
- const normalizedWriteKey = validateWriteKey(writeKey);
92
+ };
93
+ const hightouch_hightouch = function({ writeKey, apiHost, trackPageView = true, scriptUrl }) {
94
+ const normalizedWriteKey = hightouch_validateWriteKey(writeKey);
95
95
  const loadOptions = {
96
- apiHost: normalizeApiHost(apiHost)
96
+ apiHost: hightouch_normalizeApiHost(apiHost)
97
97
  };
98
98
  let manifest = hightouchManifest;
99
99
  if (!trackPageView) manifest = {
@@ -102,8 +102,8 @@ function hightouch({ writeKey, apiHost, trackPageView = true, scriptUrl }) {
102
102
  };
103
103
  return resolveManifest(manifest, {
104
104
  loadOptions,
105
- writeKey: normalizedWriteKey,
106
- scriptUrl: resolveScriptUrl(trimToUndefined(scriptUrl), DEFAULT_HIGHTOUCH_SCRIPT_URL)
105
+ scriptUrl: resolveScriptUrl(trimToUndefined(scriptUrl), DEFAULT_HIGHTOUCH_SCRIPT_URL),
106
+ writeKey: normalizedWriteKey
107
107
  });
108
- }
109
- export { HIGHTOUCH_QUEUE_METHODS, hightouch, hightouchManifest };
108
+ };
109
+ export { HIGHTOUCH_QUEUE_METHODS, hightouchManifest, hightouch_hightouch as hightouch };
@@ -3,42 +3,42 @@ import { vendorManifestContract } from "../../types.js";
3
3
  import { resolveScriptUrl } from "../_shared/script-url.js";
4
4
  const hotjarManifest = {
5
5
  ...vendorManifestContract,
6
- vendor: 'hotjar',
7
6
  category: 'measurement',
8
7
  install: [
9
8
  {
10
- type: 'setGlobal',
9
+ ifUndefined: true,
11
10
  name: '_hjSettings',
11
+ type: 'setGlobal',
12
12
  value: {
13
13
  hjid: '{{siteId}}',
14
14
  hjsv: '{{version}}'
15
- },
16
- ifUndefined: true
15
+ }
17
16
  },
18
17
  {
19
- type: 'defineStubFunction',
18
+ ifUndefined: true,
20
19
  name: 'hj',
21
20
  queue: {
22
21
  property: 'q'
23
22
  },
24
23
  queueFormat: 'array',
25
- ifUndefined: true
24
+ type: 'defineStubFunction'
26
25
  },
27
26
  {
28
- type: 'loadScript',
27
+ async: true,
29
28
  src: "{{scriptUrl}}",
30
- async: true
29
+ type: 'loadScript'
31
30
  }
32
- ]
31
+ ],
32
+ vendor: 'hotjar'
33
33
  };
34
- function hotjar({ siteId, version = 6, scriptUrl }) {
34
+ const hotjar_hotjar = function({ siteId, version = 6, scriptUrl }) {
35
35
  if (null == siteId) throw new Error('hotjar: missing or invalid siteId');
36
36
  const normalizedSiteId = String(siteId).trim();
37
37
  if (0 === normalizedSiteId.length || '0' === normalizedSiteId) throw new Error('hotjar: missing or invalid siteId');
38
38
  return resolveManifest(hotjarManifest, {
39
+ scriptUrl: resolveScriptUrl(scriptUrl, `https://static.hotjar.com/c/hotjar-${normalizedSiteId}.js?sv=${version}`),
39
40
  siteId: normalizedSiteId,
40
- version,
41
- scriptUrl: resolveScriptUrl(scriptUrl, `https://static.hotjar.com/c/hotjar-${normalizedSiteId}.js?sv=${version}`)
41
+ version
42
42
  });
43
- }
44
- export { hotjar, hotjarManifest };
43
+ };
44
+ export { hotjarManifest, hotjar_hotjar as hotjar };