@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
@@ -2,49 +2,49 @@ import { resolveManifest } from "../../resolve.js";
2
2
  import { vendorManifestContract } from "../../types.js";
3
3
  import { resolveScriptUrl, trimToUndefined } from "../_shared/script-url.js";
4
4
  const DEFAULT_LOGROCKET_SCRIPT_URL = 'https://cdn.logrocket.io/LogRocket.min.js';
5
- function validateLogRocketAppId(appId) {
5
+ const logrocket_validateLogRocketAppId = function(appId) {
6
6
  const normalized = 'string' == typeof appId ? appId.trim() : '';
7
7
  const segments = normalized.split('/');
8
8
  if (2 !== segments.length || segments.some((segment)=>0 === segment.length)) throw new Error("logRocket: invalid appId - must be a non-empty string in 'org/app' format");
9
9
  return normalized;
10
- }
10
+ };
11
11
  const logRocketManifest = {
12
12
  ...vendorManifestContract,
13
- vendor: 'logrocket',
13
+ afterLoad: [
14
+ {
15
+ args: [
16
+ '{{appId}}',
17
+ '{{initOptions}}'
18
+ ],
19
+ global: 'LogRocket',
20
+ method: 'init',
21
+ type: 'callGlobal'
22
+ }
23
+ ],
14
24
  category: 'measurement',
15
25
  install: [
16
26
  {
17
- type: 'loadScript',
18
- src: "{{scriptUrl}}",
19
27
  attributes: {
20
28
  crossorigin: 'anonymous'
21
- }
29
+ },
30
+ src: "{{scriptUrl}}",
31
+ type: 'loadScript'
22
32
  }
23
33
  ],
24
- afterLoad: [
25
- {
26
- type: 'callGlobal',
27
- global: 'LogRocket',
28
- method: 'init',
29
- args: [
30
- '{{appId}}',
31
- '{{initOptions}}'
32
- ]
33
- }
34
- ]
34
+ vendor: 'logrocket'
35
35
  };
36
- function logRocket(options) {
37
- const appId = validateLogRocketAppId(options?.appId);
36
+ const logrocket_logRocket = function(options) {
37
+ const appId = logrocket_validateLogRocketAppId(options?.appId);
38
38
  const asyncScriptUrl = trimToUndefined(options.asyncScriptUrl);
39
39
  let manifest = logRocketManifest;
40
40
  if (asyncScriptUrl) manifest = {
41
41
  ...logRocketManifest,
42
42
  bootstrap: [
43
43
  {
44
- type: 'setGlobal',
44
+ ifUndefined: false,
45
45
  name: '_lrAsyncScript',
46
- value: '{{asyncScriptUrl}}',
47
- ifUndefined: false
46
+ type: 'setGlobal',
47
+ value: '{{asyncScriptUrl}}'
48
48
  }
49
49
  ]
50
50
  };
@@ -54,5 +54,5 @@ function logRocket(options) {
54
54
  initOptions: options.initOptions ?? {},
55
55
  scriptUrl: resolveScriptUrl(trimToUndefined(options.scriptUrl), DEFAULT_LOGROCKET_SCRIPT_URL)
56
56
  });
57
- }
58
- export { logRocket, logRocketManifest };
57
+ };
58
+ export { logRocketManifest, logrocket_logRocket as logRocket };
@@ -1,38 +1,38 @@
1
1
  import { resolveManifest } from "../../resolve.js";
2
2
  import { vendorManifestContract } from "../../types.js";
3
3
  import { joinUrlPath, stripTrailingSlashes } from "../_shared/script-url.js";
4
- function stripProtocol(value) {
4
+ const matomo_analytics_stripProtocol = function(value) {
5
5
  if (value.startsWith('https://')) return value.slice(8);
6
6
  if (value.startsWith('http://')) return value.slice(7);
7
7
  return value;
8
- }
9
- function resolveMatomoOrigin(options) {
8
+ };
9
+ const matomo_analytics_resolveMatomoOrigin = function(options) {
10
10
  if (options.matomoUrl) return stripTrailingSlashes(options.matomoUrl);
11
11
  if (options.cloudId) {
12
- const cleanedCloudId = stripTrailingSlashes(stripProtocol(options.cloudId));
12
+ const cleanedCloudId = stripTrailingSlashes(matomo_analytics_stripProtocol(options.cloudId));
13
13
  if (cleanedCloudId.endsWith('.matomo.cloud')) return `https://${cleanedCloudId}`;
14
14
  return `https://cdn.matomo.cloud/${cleanedCloudId}`;
15
15
  }
16
- }
17
- function buildInstallSteps(options) {
16
+ };
17
+ const matomo_analytics_buildInstallSteps = function(options) {
18
18
  const install = [
19
19
  {
20
- type: 'setGlobal',
20
+ ifUndefined: true,
21
21
  name: '_paq',
22
- value: [],
23
- ifUndefined: true
22
+ type: 'setGlobal',
23
+ value: []
24
24
  },
25
25
  {
26
- type: 'pushToQueue',
27
26
  queue: '_paq',
27
+ type: 'pushToQueue',
28
28
  value: [
29
29
  'setTrackerUrl',
30
30
  '{{trackerUrl}}'
31
31
  ]
32
32
  },
33
33
  {
34
- type: 'pushToQueue',
35
34
  queue: '_paq',
35
+ type: 'pushToQueue',
36
36
  value: [
37
37
  'setSiteId',
38
38
  '{{siteId}}'
@@ -40,68 +40,68 @@ function buildInstallSteps(options) {
40
40
  }
41
41
  ];
42
42
  if (options.enableLinkTracking) install.push({
43
- type: 'pushToQueue',
44
43
  queue: '_paq',
44
+ type: 'pushToQueue',
45
45
  value: [
46
46
  'enableLinkTracking'
47
47
  ]
48
48
  });
49
49
  if (options.disableCookies) install.push({
50
- type: 'pushToQueue',
51
50
  queue: '_paq',
51
+ type: 'pushToQueue',
52
52
  value: [
53
53
  'disableCookies'
54
54
  ]
55
55
  });
56
56
  if (options.enableConsentMode && !options.consentInitiallyGiven) install.push({
57
- type: 'pushToQueue',
58
57
  queue: '_paq',
58
+ type: 'pushToQueue',
59
59
  value: [
60
60
  'requireConsent'
61
61
  ]
62
62
  });
63
63
  if (options.enableConsentMode && options.consentInitiallyGiven) {
64
64
  install.push({
65
- type: 'pushToQueue',
66
65
  queue: '_paq',
66
+ type: 'pushToQueue',
67
67
  value: [
68
68
  'setConsentGiven'
69
69
  ]
70
70
  });
71
71
  if (options.trackPageView) install.push({
72
- type: 'pushToQueue',
73
72
  queue: '_paq',
73
+ type: 'pushToQueue',
74
74
  value: [
75
75
  'trackPageView'
76
76
  ]
77
77
  });
78
78
  }
79
79
  if (options.trackPageView && !options.enableConsentMode) install.push({
80
- type: 'pushToQueue',
81
80
  queue: '_paq',
81
+ type: 'pushToQueue',
82
82
  value: [
83
83
  'trackPageView'
84
84
  ]
85
85
  });
86
86
  install.push({
87
- type: 'loadScript',
87
+ async: true,
88
88
  src: "{{scriptUrl}}",
89
- async: true
89
+ type: 'loadScript'
90
90
  });
91
91
  return install;
92
- }
93
- function buildGrantedHooks(options) {
92
+ };
93
+ const matomo_analytics_buildGrantedHooks = function(options) {
94
94
  const onBeforeLoadGranted = [];
95
95
  if (options.enableConsentMode && !options.consentInitiallyGiven) onBeforeLoadGranted.push({
96
- type: 'pushToQueue',
97
96
  queue: '_paq',
97
+ type: 'pushToQueue',
98
98
  value: [
99
99
  'setConsentGiven'
100
100
  ]
101
101
  });
102
102
  if (options.trackPageView && options.enableConsentMode && !options.consentInitiallyGiven) onBeforeLoadGranted.push({
103
- type: 'pushToQueue',
104
103
  queue: '_paq',
104
+ type: 'pushToQueue',
105
105
  value: [
106
106
  'trackPageView'
107
107
  ]
@@ -109,15 +109,15 @@ function buildGrantedHooks(options) {
109
109
  const onConsentGranted = [];
110
110
  if (options.enableConsentMode) {
111
111
  onConsentGranted.push({
112
- type: 'pushToQueue',
113
112
  queue: '_paq',
113
+ type: 'pushToQueue',
114
114
  value: [
115
115
  'setConsentGiven'
116
116
  ]
117
117
  });
118
118
  if (options.trackPageView) onConsentGranted.push({
119
- type: 'pushToQueue',
120
119
  queue: '_paq',
120
+ type: 'pushToQueue',
121
121
  value: [
122
122
  'trackPageView'
123
123
  ]
@@ -127,20 +127,20 @@ function buildGrantedHooks(options) {
127
127
  onBeforeLoadGranted,
128
128
  onConsentGranted
129
129
  };
130
- }
131
- function buildDeniedHooks(options) {
130
+ };
131
+ const matomo_analytics_buildDeniedHooks = function(options) {
132
132
  const onConsentDenied = [];
133
133
  if (options.enableConsentMode) onConsentDenied.push({
134
- type: 'pushToQueue',
135
134
  queue: '_paq',
135
+ type: 'pushToQueue',
136
136
  value: [
137
137
  'forgetConsentGiven'
138
138
  ]
139
139
  });
140
140
  return onConsentDenied;
141
- }
142
- function createMatomoAnalyticsManifest(options) {
143
- const { onBeforeLoadGranted, onConsentGranted } = buildGrantedHooks(options);
141
+ };
142
+ const matomo_analytics_createMatomoAnalyticsManifest = function(options) {
143
+ const { onBeforeLoadGranted, onConsentGranted } = matomo_analytics_buildGrantedHooks(options);
144
144
  let alwaysLoad;
145
145
  let persistAfterConsentRevoked;
146
146
  if (options.enableConsentMode) {
@@ -149,43 +149,43 @@ function createMatomoAnalyticsManifest(options) {
149
149
  }
150
150
  return {
151
151
  ...vendorManifestContract,
152
- vendor: 'matomo-analytics',
153
- category: 'measurement',
154
152
  alwaysLoad,
155
- persistAfterConsentRevoked,
156
- install: buildInstallSteps(options),
153
+ category: 'measurement',
154
+ install: matomo_analytics_buildInstallSteps(options),
157
155
  onBeforeLoadGranted,
156
+ onConsentDenied: matomo_analytics_buildDeniedHooks(options),
158
157
  onConsentGranted,
159
- onConsentDenied: buildDeniedHooks(options)
158
+ persistAfterConsentRevoked,
159
+ vendor: 'matomo-analytics'
160
160
  };
161
- }
162
- const matomoAnalyticsManifest = createMatomoAnalyticsManifest({
163
- enableConsentMode: false,
161
+ };
162
+ const matomoAnalyticsManifest = matomo_analytics_createMatomoAnalyticsManifest({
164
163
  consentInitiallyGiven: false,
165
- enableLinkTracking: false,
166
164
  disableCookies: false,
165
+ enableConsentMode: false,
166
+ enableLinkTracking: false,
167
167
  trackPageView: true
168
168
  });
169
- function matomoAnalytics(options = {}) {
170
- const origin = resolveMatomoOrigin(options);
171
- let trackerUrl = options.trackerUrl;
169
+ const matomo_analytics_matomoAnalytics = function(options = {}) {
170
+ const origin = matomo_analytics_resolveMatomoOrigin(options);
171
+ let { trackerUrl } = options;
172
172
  if (!trackerUrl && origin) trackerUrl = joinUrlPath(origin, 'matomo.php');
173
- let scriptUrl = options.scriptUrl;
173
+ let { scriptUrl } = options;
174
174
  if (!scriptUrl && origin) scriptUrl = joinUrlPath(origin, 'matomo.js');
175
175
  if (!trackerUrl || !scriptUrl) throw new Error("matomoAnalytics requires `matomoUrl`, `cloudId`, or explicit `trackerUrl` and `scriptUrl` values.");
176
176
  const enableConsentMode = 'required' === options.defaultConsent || 'given' === options.defaultConsent;
177
177
  const consentInitiallyGiven = 'given' === options.defaultConsent;
178
- const manifest = createMatomoAnalyticsManifest({
179
- enableConsentMode,
178
+ const manifest = matomo_analytics_createMatomoAnalyticsManifest({
180
179
  consentInitiallyGiven,
181
- enableLinkTracking: options.enableLinkTracking ?? false,
182
180
  disableCookies: options.disableCookies ?? false,
181
+ enableConsentMode,
182
+ enableLinkTracking: options.enableLinkTracking ?? false,
183
183
  trackPageView: options.trackPageView ?? true
184
184
  });
185
185
  return resolveManifest(manifest, {
186
+ scriptUrl,
186
187
  siteId: String(options.siteId ?? 1),
187
- trackerUrl,
188
- scriptUrl
188
+ trackerUrl
189
189
  });
190
- }
191
- export { matomoAnalytics, matomoAnalyticsManifest };
190
+ };
191
+ export { matomoAnalyticsManifest, matomo_analytics_matomoAnalytics as matomoAnalytics };
@@ -1,20 +1,20 @@
1
1
  import { resolveManifest } from "../../resolve.js";
2
2
  import { vendorManifestContract } from "../../types.js";
3
- function toClarityConsentState(value) {
3
+ const microsoft_clarity_toClarityConsentState = function(value) {
4
4
  if (true === value) return 'granted';
5
5
  if (false === value) return 'denied';
6
6
  if ('string' != typeof value) return;
7
7
  const normalized = value.toLowerCase();
8
8
  if ('granted' === normalized || 'true' === normalized) return 'granted';
9
9
  if ('denied' === normalized || 'false' === normalized) return 'denied';
10
- }
11
- function getConsentValue(value, keys) {
10
+ };
11
+ const microsoft_clarity_getConsentValue = function(value, keys) {
12
12
  for (const key of keys){
13
- const consent = toClarityConsentState(value[key]);
13
+ const consent = microsoft_clarity_toClarityConsentState(value[key]);
14
14
  if (consent) return consent;
15
15
  }
16
- }
17
- function getConsentPayloadFromState(consents) {
16
+ };
17
+ const microsoft_clarity_getConsentPayloadFromState = function(consents) {
18
18
  let adStorage;
19
19
  adStorage = consents.marketing ? 'granted' : 'denied';
20
20
  let analyticsStorage;
@@ -23,22 +23,22 @@ function getConsentPayloadFromState(consents) {
23
23
  ad_Storage: adStorage,
24
24
  analytics_Storage: analyticsStorage
25
25
  };
26
- }
27
- function getClarityConsentPayload(consents, defaultConsent) {
28
- const fallback = getConsentPayloadFromState(consents);
26
+ };
27
+ const microsoft_clarity_getClarityConsentPayload = function(consents, defaultConsent) {
28
+ const fallback = microsoft_clarity_getConsentPayloadFromState(consents);
29
29
  if (void 0 === defaultConsent) return fallback;
30
- const booleanConsent = toClarityConsentState(defaultConsent);
30
+ const booleanConsent = microsoft_clarity_toClarityConsentState(defaultConsent);
31
31
  if (booleanConsent) return {
32
32
  ad_Storage: booleanConsent,
33
33
  analytics_Storage: booleanConsent
34
34
  };
35
35
  if (null !== defaultConsent && 'object' == typeof defaultConsent) return {
36
- ad_Storage: getConsentValue(defaultConsent, [
36
+ ad_Storage: microsoft_clarity_getConsentValue(defaultConsent, [
37
37
  'ad_Storage',
38
38
  'ad_storage',
39
39
  'marketing'
40
40
  ]) ?? fallback.ad_Storage,
41
- analytics_Storage: getConsentValue(defaultConsent, [
41
+ analytics_Storage: microsoft_clarity_getConsentValue(defaultConsent, [
42
42
  'analytics_Storage',
43
43
  'analytics_storage',
44
44
  'measurement',
@@ -46,52 +46,55 @@ function getClarityConsentPayload(consents, defaultConsent) {
46
46
  ]) ?? fallback.analytics_Storage
47
47
  };
48
48
  return fallback;
49
- }
50
- function syncClarityConsent(info, defaultConsent) {
51
- window.clarity?.('consentv2', getClarityConsentPayload(info.consents, defaultConsent));
52
- }
49
+ };
50
+ const microsoft_clarity_syncClarityConsent = function(info, defaultConsent) {
51
+ window.clarity?.('consentv2', info.vendor?.granted === false ? {
52
+ ad_Storage: 'denied',
53
+ analytics_Storage: 'denied'
54
+ } : microsoft_clarity_getClarityConsentPayload(info.consents, defaultConsent));
55
+ };
53
56
  const clarityManifest = {
54
57
  ...vendorManifestContract,
55
- vendor: 'microsoft-clarity',
56
- category: 'measurement',
57
- persistAfterConsentRevoked: true,
58
58
  bootstrap: [
59
59
  {
60
- type: 'defineStubFunction',
60
+ ifUndefined: true,
61
61
  name: 'clarity',
62
62
  queue: {
63
63
  property: 'q'
64
64
  },
65
65
  queueFormat: 'array',
66
- ifUndefined: true
66
+ type: 'defineStubFunction'
67
67
  }
68
68
  ],
69
+ category: 'measurement',
69
70
  install: [
70
71
  {
71
- type: 'loadScript',
72
+ async: true,
72
73
  src: "{{scriptUrl}}",
73
- async: true
74
+ type: 'loadScript'
74
75
  }
75
- ]
76
+ ],
77
+ persistAfterConsentRevoked: true,
78
+ vendor: 'microsoft-clarity'
76
79
  };
77
- function clarity({ id, defaultConsent, scriptUrl }) {
80
+ const microsoft_clarity_clarity = function({ id, defaultConsent, scriptUrl }) {
78
81
  const normalizedId = id.trim();
79
82
  if (void 0 === scriptUrl && 0 === normalizedId.length) throw new Error(`Invalid Clarity id value "${id}". A non-empty id is required to construct the Clarity loader URL when scriptUrl is not provided.`);
80
83
  const resolved = resolveManifest(clarityManifest, {
81
84
  scriptUrl: scriptUrl ?? `https://www.clarity.ms/tag/${normalizedId}`
82
85
  });
83
- const onBeforeLoad = resolved.onBeforeLoad;
84
- const onConsentChange = resolved.onConsentChange;
86
+ const { onBeforeLoad } = resolved;
87
+ const { onConsentChange } = resolved;
85
88
  return {
86
89
  ...resolved,
87
90
  onBeforeLoad: (info)=>{
88
91
  onBeforeLoad?.(info);
89
- syncClarityConsent(info, defaultConsent);
92
+ microsoft_clarity_syncClarityConsent(info, defaultConsent);
90
93
  },
91
94
  onConsentChange: (info)=>{
92
95
  onConsentChange?.(info);
93
- syncClarityConsent(info);
96
+ microsoft_clarity_syncClarityConsent(info);
94
97
  }
95
98
  };
96
- }
97
- export { clarity, clarityManifest };
99
+ };
100
+ export { clarityManifest, microsoft_clarity_clarity as clarity };
@@ -2,30 +2,29 @@ import { resolveManifest } from "../../resolve.js";
2
2
  import { vendorManifestContract } from "../../types.js";
3
3
  const mixpanelAnalyticsManifest = {
4
4
  ...vendorManifestContract,
5
- vendor: 'mixpanel-analytics',
6
- category: 'measurement',
7
5
  alwaysLoad: true,
6
+ category: 'measurement',
8
7
  install: [
9
8
  {
10
- type: 'setGlobal',
9
+ ifUndefined: true,
11
10
  name: 'mixpanel',
12
- value: [],
13
- ifUndefined: true
11
+ type: 'setGlobal',
12
+ value: []
14
13
  },
15
14
  {
16
- type: 'setGlobalPath',
17
15
  path: [
18
16
  'mixpanel',
19
17
  '__SV'
20
18
  ],
19
+ type: 'setGlobalPath',
21
20
  value: 1.2
22
21
  },
23
22
  {
24
- type: 'setGlobalPath',
25
23
  path: [
26
24
  'mixpanel',
27
25
  '_i'
28
26
  ],
27
+ type: 'setGlobalPath',
29
28
  value: [
30
29
  [
31
30
  '{{token}}',
@@ -35,8 +34,6 @@ const mixpanelAnalyticsManifest = {
35
34
  ]
36
35
  },
37
36
  {
38
- type: 'defineQueueMethods',
39
- target: 'mixpanel',
40
37
  methods: [
41
38
  'track',
42
39
  'identify',
@@ -44,50 +41,53 @@ const mixpanelAnalyticsManifest = {
44
41
  'register',
45
42
  'opt_in_tracking',
46
43
  'opt_out_tracking'
47
- ]
44
+ ],
45
+ target: 'mixpanel',
46
+ type: 'defineQueueMethods'
48
47
  },
49
48
  {
50
- type: 'loadScript',
49
+ async: true,
51
50
  src: "{{scriptUrl}}",
52
- async: true
51
+ type: 'loadScript'
53
52
  }
54
53
  ],
55
- onLoadGranted: [
54
+ onConsentDenied: [
56
55
  {
57
- type: 'callGlobal',
58
56
  global: 'mixpanel',
59
- method: 'opt_in_tracking'
57
+ method: 'opt_out_tracking',
58
+ type: 'callGlobal'
60
59
  }
61
60
  ],
62
- onLoadDenied: [
61
+ onConsentGranted: [
63
62
  {
64
- type: 'callGlobal',
65
63
  global: 'mixpanel',
66
- method: 'opt_out_tracking'
64
+ method: 'opt_in_tracking',
65
+ type: 'callGlobal'
67
66
  }
68
67
  ],
69
- onConsentGranted: [
68
+ onLoadDenied: [
70
69
  {
71
- type: 'callGlobal',
72
70
  global: 'mixpanel',
73
- method: 'opt_in_tracking'
71
+ method: 'opt_out_tracking',
72
+ type: 'callGlobal'
74
73
  }
75
74
  ],
76
- onConsentDenied: [
75
+ onLoadGranted: [
77
76
  {
78
- type: 'callGlobal',
79
77
  global: 'mixpanel',
80
- method: 'opt_out_tracking'
78
+ method: 'opt_in_tracking',
79
+ type: 'callGlobal'
81
80
  }
82
- ]
81
+ ],
82
+ vendor: 'mixpanel-analytics'
83
83
  };
84
- function mixpanelAnalytics({ token, initOptions, scriptUrl }) {
84
+ const mixpanel_analytics_mixpanelAnalytics = function({ token, initOptions, scriptUrl }) {
85
85
  const normalizedToken = token.trim();
86
- if (!/^[a-f0-9]{32}$/i.test(normalizedToken)) throw new Error("mixpanelAnalytics: token must be a non-empty 32-character hexadecimal string");
86
+ if (!/^[a-f0-9]{32}$/iu.test(normalizedToken)) throw new Error("mixpanelAnalytics: token must be a non-empty 32-character hexadecimal string");
87
87
  return resolveManifest(mixpanelAnalyticsManifest, {
88
- token: normalizedToken,
89
88
  initOptions: initOptions ?? {},
90
- scriptUrl: scriptUrl ?? 'https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js'
89
+ scriptUrl: scriptUrl ?? 'https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js',
90
+ token: normalizedToken
91
91
  });
92
- }
93
- export { mixpanelAnalytics, mixpanelAnalyticsManifest };
92
+ };
93
+ export { mixpanelAnalyticsManifest, mixpanel_analytics_mixpanelAnalytics as mixpanelAnalytics };
@@ -5,26 +5,26 @@ const DEFAULT_PIRSCH_SCRIPT_URL = 'https://api.pirsch.io/pa.js';
5
5
  const DEFAULT_PIRSCH_EXTENDED_SCRIPT_URL = 'https://api.pirsch.io/pirsch-extended.js';
6
6
  const pirschManifest = {
7
7
  ...vendorManifestContract,
8
- vendor: 'pirsch',
9
8
  category: 'measurement',
10
9
  install: [
11
10
  {
12
- type: 'loadScript',
13
- src: "{{scriptUrl}}",
14
- defer: true,
15
11
  attributes: {
16
- id: "{{scriptElementId}}",
17
12
  'data-code': '{{identificationCode}}',
18
- 'data-domain': '{{domain}}',
19
13
  'data-dev': '{{dev}}',
20
- 'data-hit-endpoint': '{{hitEndpoint}}',
14
+ 'data-disable-page-views': '{{disablePageViews}}',
15
+ 'data-domain': '{{domain}}',
21
16
  'data-event-endpoint': '{{eventEndpoint}}',
22
- 'data-disable-page-views': '{{disablePageViews}}'
23
- }
17
+ 'data-hit-endpoint': '{{hitEndpoint}}',
18
+ id: "{{scriptElementId}}"
19
+ },
20
+ defer: true,
21
+ src: "{{scriptUrl}}",
22
+ type: 'loadScript'
24
23
  }
25
- ]
24
+ ],
25
+ vendor: 'pirsch'
26
26
  };
27
- function commaListDataAttribute(value) {
27
+ const pirsch_commaListDataAttribute = function(value) {
28
28
  if (void 0 === value) return;
29
29
  if (Array.isArray(value)) {
30
30
  const items = value.map((item)=>item.trim()).filter((item)=>item.length > 0);
@@ -32,30 +32,30 @@ function commaListDataAttribute(value) {
32
32
  return items.join(',');
33
33
  }
34
34
  return trimToUndefined(value);
35
- }
36
- function presenceDataAttribute(value) {
35
+ };
36
+ const pirsch_presenceDataAttribute = function(value) {
37
37
  if (true === value) return '';
38
- }
39
- function getPirschScriptElementId(options) {
38
+ };
39
+ const pirsch_getPirschScriptElementId = function(options) {
40
40
  if (true === options.extended) return 'pirschextendedjs';
41
41
  return 'pianjs';
42
- }
43
- function getPirschScriptUrl(options) {
42
+ };
43
+ const pirsch_getPirschScriptUrl = function(options) {
44
44
  const defaultScriptUrl = true === options.extended ? DEFAULT_PIRSCH_EXTENDED_SCRIPT_URL : DEFAULT_PIRSCH_SCRIPT_URL;
45
45
  return resolveScriptUrl(trimToUndefined(options.scriptUrl), defaultScriptUrl);
46
- }
47
- function pirsch(options) {
46
+ };
47
+ const pirsch_pirsch = function(options) {
48
48
  const identificationCode = options.identificationCode.trim();
49
49
  if (0 === identificationCode.length) throw new Error('pirsch: invalid identificationCode - must be a non-empty string');
50
50
  const resolved = resolveManifest(pirschManifest, {
51
- identificationCode,
52
- domain: commaListDataAttribute(options.domain),
53
51
  dev: trimToUndefined(options.dev),
54
- hitEndpoint: trimToUndefined(options.hitEndpoint),
52
+ disablePageViews: pirsch_presenceDataAttribute(options.disablePageViews),
53
+ domain: pirsch_commaListDataAttribute(options.domain),
55
54
  eventEndpoint: trimToUndefined(options.eventEndpoint),
56
- disablePageViews: presenceDataAttribute(options.disablePageViews),
57
- scriptElementId: getPirschScriptElementId(options),
58
- scriptUrl: getPirschScriptUrl(options)
55
+ hitEndpoint: trimToUndefined(options.hitEndpoint),
56
+ identificationCode,
57
+ scriptElementId: pirsch_getPirschScriptElementId(options),
58
+ scriptUrl: pirsch_getPirschScriptUrl(options)
59
59
  });
60
60
  const manifestOnLoad = resolved.onLoad;
61
61
  resolved.onLoad = (info)=>{
@@ -63,5 +63,5 @@ function pirsch(options) {
63
63
  if ('loading' !== document.readyState) window.pirschInit?.();
64
64
  };
65
65
  return resolved;
66
- }
67
- export { pirsch, pirschManifest };
66
+ };
67
+ export { pirschManifest, pirsch_pirsch as pirsch };