@c15t/scripts 3.0.0-alpha.2 → 3.0.0-alpha.3
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.
- package/AGENTS.md +129 -63
- package/README.md +8 -29
- package/SKILL.md +33 -0
- package/dist/adobe-analytics.js +2 -0
- package/dist/ahrefs-analytics.js +2 -0
- package/dist/amplitude.js +2 -0
- package/dist/clearbit.js +2 -0
- package/dist/cloudflare-web-analytics.js +2 -0
- package/dist/cloudflare-zaraz.js +2 -0
- package/dist/crisp.js +2 -0
- package/dist/databuddy.js +2 -0
- package/dist/e2e-test-utils.js +2 -139
- package/dist/engine/compile.js +2 -89
- package/dist/engine/runtime.js +2 -448
- package/dist/events.js +2 -218
- package/dist/fathom-analytics.js +2 -0
- package/dist/front-chat.js +2 -0
- package/dist/google-tag-manager.js +2 -0
- package/dist/google-tag.js +2 -0
- package/dist/heap.js +2 -0
- package/dist/hightouch.js +2 -0
- package/dist/hotjar.js +2 -0
- package/dist/intercom.js +2 -0
- package/dist/klaviyo.js +2 -0
- package/dist/linkedin-insights.js +2 -0
- package/dist/logrocket.js +2 -0
- package/dist/matomo-analytics.js +2 -0
- package/dist/meta-pixel.js +2 -0
- package/dist/microsoft-clarity.js +2 -0
- package/dist/microsoft-uet.js +2 -0
- package/dist/mixpanel-analytics.js +2 -0
- package/dist/one-dollar-stats.js +2 -0
- package/dist/openai-pixel.js +2 -0
- package/dist/pinterest-tag.js +2 -0
- package/dist/pirsch.js +2 -0
- package/dist/plausible-analytics.js +2 -0
- package/dist/posthog.js +2 -0
- package/dist/promptwatch.js +2 -0
- package/dist/reddit-pixel.js +2 -0
- package/dist/registry.js +2 -422
- package/dist/resolve.js +2 -33
- package/dist/rudderstack.js +2 -0
- package/dist/rybbit-analytics.js +2 -0
- package/dist/segment.js +2 -0
- package/dist/snapchat-pixel.js +2 -0
- package/dist/tiktok-pixel.js +2 -0
- package/dist/types.js +2 -16
- package/dist/umami-analytics.js +2 -0
- package/dist/vendors/_shared/attributes.js +2 -14
- package/dist/vendors/_shared/google-consent.js +2 -27
- package/dist/vendors/_shared/install-builders.js +2 -21
- package/dist/vendors/_shared/required-id.js +2 -0
- package/dist/vendors/_shared/script-url.js +2 -28
- package/dist/vendors/ads-and-pixels/linkedin-insights.js +2 -48
- package/dist/vendors/ads-and-pixels/meta-pixel.js +2 -153
- package/dist/vendors/ads-and-pixels/microsoft-uet.js +2 -110
- package/dist/vendors/ads-and-pixels/openai-pixel.js +2 -88
- package/dist/vendors/ads-and-pixels/pinterest-tag.js +2 -123
- package/dist/vendors/ads-and-pixels/reddit-pixel.js +2 -107
- package/dist/vendors/ads-and-pixels/snapchat-pixel.js +2 -87
- package/dist/vendors/ads-and-pixels/tiktok-pixel.js +2 -89
- package/dist/vendors/ads-and-pixels/x-pixel.js +2 -48
- package/dist/vendors/analytics/adobe-analytics.js +2 -49
- package/dist/vendors/analytics/ahrefs-analytics.js +2 -27
- package/dist/vendors/analytics/amplitude.js +2 -134
- package/dist/vendors/analytics/clearbit.js +2 -28
- package/dist/vendors/analytics/cloudflare-web-analytics.js +2 -32
- package/dist/vendors/analytics/databuddy.js +2 -103
- package/dist/vendors/analytics/fathom-analytics.js +2 -35
- package/dist/vendors/analytics/google-tag.js +2 -78
- package/dist/vendors/analytics/heap.js +2 -134
- package/dist/vendors/analytics/hightouch.js +2 -109
- package/dist/vendors/analytics/hotjar.js +2 -44
- package/dist/vendors/analytics/logrocket.js +2 -58
- package/dist/vendors/analytics/matomo-analytics.js +2 -191
- package/dist/vendors/analytics/microsoft-clarity.js +2 -100
- package/dist/vendors/analytics/mixpanel-analytics.js +2 -93
- package/dist/vendors/analytics/one-dollar-stats.js +2 -30
- package/dist/vendors/analytics/pirsch.js +2 -67
- package/dist/vendors/analytics/plausible-analytics.js +2 -81
- package/dist/vendors/analytics/posthog.js +2 -200
- package/dist/vendors/analytics/promptwatch.js +2 -29
- package/dist/vendors/analytics/rudderstack.js +2 -183
- package/dist/vendors/analytics/rybbit-analytics.js +2 -63
- package/dist/vendors/analytics/segment.js +2 -65
- package/dist/vendors/analytics/umami-analytics.js +2 -39
- package/dist/vendors/analytics/vercel-analytics.js +2 -53
- package/dist/vendors/email-and-sms/klaviyo.js +2 -0
- package/dist/vendors/functional/crisp.js +2 -100
- package/dist/vendors/functional/front-chat.js +2 -64
- package/dist/vendors/functional/intercom.js +2 -45
- package/dist/vendors/tag-managers/cloudflare-zaraz.js +2 -98
- package/dist/vendors/tag-managers/google-tag-manager.js +2 -73
- package/dist/vercel-analytics.js +2 -0
- package/dist/x-pixel.js +2 -0
- package/dist-types/adobe-analytics.d.ts +2 -0
- package/dist-types/ahrefs-analytics.d.ts +2 -0
- package/dist-types/amplitude.d.ts +2 -0
- package/dist-types/clearbit.d.ts +2 -0
- package/dist-types/cloudflare-web-analytics.d.ts +2 -0
- package/dist-types/cloudflare-zaraz.d.ts +2 -0
- package/dist-types/crisp.d.ts +2 -0
- package/dist-types/databuddy.d.ts +2 -0
- package/dist-types/e2e-test-utils.d.ts +2 -0
- package/dist-types/engine/compile.d.ts +2 -3
- package/dist-types/engine/runtime.d.ts +2 -3
- package/dist-types/events.d.ts +2 -46
- package/dist-types/fathom-analytics.d.ts +2 -0
- package/dist-types/front-chat.d.ts +2 -0
- package/dist-types/google-tag-manager.d.ts +2 -0
- package/dist-types/google-tag.d.ts +2 -0
- package/dist-types/heap.d.ts +2 -0
- package/dist-types/hightouch.d.ts +2 -0
- package/dist-types/hotjar.d.ts +2 -0
- package/dist-types/intercom.d.ts +2 -0
- package/dist-types/klaviyo.d.ts +2 -0
- package/dist-types/linkedin-insights.d.ts +2 -0
- package/dist-types/logrocket.d.ts +2 -0
- package/dist-types/matomo-analytics.d.ts +2 -0
- package/dist-types/meta-pixel.d.ts +2 -0
- package/dist-types/microsoft-clarity.d.ts +2 -0
- package/dist-types/microsoft-uet.d.ts +2 -0
- package/dist-types/mixpanel-analytics.d.ts +2 -0
- package/dist-types/one-dollar-stats.d.ts +2 -0
- package/dist-types/openai-pixel.d.ts +2 -0
- package/dist-types/pinterest-tag.d.ts +2 -0
- package/dist-types/pirsch.d.ts +2 -0
- package/dist-types/plausible-analytics.d.ts +2 -0
- package/dist-types/posthog.d.ts +2 -0
- package/dist-types/promptwatch.d.ts +2 -0
- package/dist-types/reddit-pixel.d.ts +2 -0
- package/dist-types/registry.d.ts +2 -485
- package/dist-types/resolve.d.ts +2 -9
- package/dist-types/rudderstack.d.ts +2 -0
- package/dist-types/rybbit-analytics.d.ts +2 -0
- package/dist-types/segment.d.ts +2 -0
- package/dist-types/snapchat-pixel.d.ts +2 -0
- package/dist-types/tiktok-pixel.d.ts +2 -0
- package/dist-types/types.d.ts +2 -314
- package/dist-types/umami-analytics.d.ts +2 -0
- package/dist-types/vendors/_shared/attributes.d.ts +2 -35
- package/dist-types/vendors/_shared/google-consent.d.ts +2 -47
- package/dist-types/vendors/_shared/install-builders.d.ts +2 -30
- package/dist-types/vendors/_shared/required-id.d.ts +2 -0
- package/dist-types/vendors/_shared/script-url.d.ts +2 -75
- package/dist-types/vendors/ads-and-pixels/linkedin-insights.d.ts +2 -92
- package/dist-types/vendors/ads-and-pixels/meta-pixel.d.ts +2 -289
- package/dist-types/vendors/ads-and-pixels/microsoft-uet.d.ts +2 -105
- package/dist-types/vendors/ads-and-pixels/openai-pixel.d.ts +2 -211
- package/dist-types/vendors/ads-and-pixels/pinterest-tag.d.ts +2 -295
- package/dist-types/vendors/ads-and-pixels/reddit-pixel.d.ts +2 -210
- package/dist-types/vendors/ads-and-pixels/snapchat-pixel.d.ts +2 -171
- package/dist-types/vendors/ads-and-pixels/tiktok-pixel.d.ts +2 -106
- package/dist-types/vendors/ads-and-pixels/x-pixel.d.ts +2 -183
- package/dist-types/vendors/analytics/adobe-analytics.d.ts +2 -75
- package/dist-types/vendors/analytics/ahrefs-analytics.d.ts +2 -62
- package/dist-types/vendors/analytics/amplitude.d.ts +2 -234
- package/dist-types/vendors/analytics/clearbit.d.ts +2 -60
- package/dist-types/vendors/analytics/cloudflare-web-analytics.d.ts +2 -67
- package/dist-types/vendors/analytics/databuddy.d.ts +2 -147
- package/dist-types/vendors/analytics/fathom-analytics.d.ts +2 -90
- package/dist-types/vendors/analytics/google-tag.d.ts +2 -95
- package/dist-types/vendors/analytics/heap.d.ts +2 -316
- package/dist-types/vendors/analytics/hightouch.d.ts +2 -285
- package/dist-types/vendors/analytics/hotjar.d.ts +2 -73
- package/dist-types/vendors/analytics/logrocket.d.ts +2 -101
- package/dist-types/vendors/analytics/matomo-analytics.d.ts +2 -41
- package/dist-types/vendors/analytics/microsoft-clarity.d.ts +2 -97
- package/dist-types/vendors/analytics/mixpanel-analytics.d.ts +2 -113
- package/dist-types/vendors/analytics/one-dollar-stats.d.ts +2 -39
- package/dist-types/vendors/analytics/pirsch.d.ts +2 -96
- package/dist-types/vendors/analytics/plausible-analytics.d.ts +2 -122
- package/dist-types/vendors/analytics/posthog.d.ts +2 -175
- package/dist-types/vendors/analytics/promptwatch.d.ts +2 -36
- package/dist-types/vendors/analytics/rudderstack.d.ts +2 -330
- package/dist-types/vendors/analytics/rybbit-analytics.d.ts +2 -82
- package/dist-types/vendors/analytics/segment.d.ts +2 -164
- package/dist-types/vendors/analytics/umami-analytics.d.ts +2 -93
- package/dist-types/vendors/analytics/vercel-analytics.d.ts +2 -66
- package/dist-types/vendors/email-and-sms/klaviyo.d.ts +2 -0
- package/dist-types/vendors/functional/crisp.d.ts +2 -78
- package/dist-types/vendors/functional/front-chat.d.ts +2 -62
- package/dist-types/vendors/functional/intercom.d.ts +2 -135
- package/dist-types/vendors/tag-managers/cloudflare-zaraz.d.ts +2 -39
- package/dist-types/vendors/tag-managers/google-tag-manager.d.ts +2 -96
- package/dist-types/vercel-analytics.d.ts +2 -0
- package/dist-types/x-pixel.d.ts +2 -0
- package/docs/README.md +129 -63
- package/docs/assets/v3/bottom-bar.png +0 -0
- package/docs/assets/v3/brand-card.png +0 -0
- package/docs/assets/v3/brand-preferences.png +0 -0
- package/docs/assets/v3/choice-wall.png +0 -0
- package/docs/assets/v3/headless-bar-html.png +0 -0
- package/docs/assets/v3/headless-bar-mobile.png +0 -0
- package/docs/assets/v3/headless-bar.png +0 -0
- package/docs/assets/v3/slim-bar.png +0 -0
- package/docs/concepts/choose-your-setup.md +87 -0
- package/docs/concepts/consent-categories.md +84 -0
- package/docs/{guides → concepts}/consent-state.md +71 -101
- package/docs/{guides → concepts}/data-fetching.md +31 -27
- package/docs/concepts/how-consent-works.md +123 -0
- package/docs/concepts/policies.md +71 -0
- package/docs/customization/class-names.md +202 -0
- package/docs/customization/dark-mode.md +157 -0
- package/docs/customization/motion.md +119 -0
- package/docs/customization/overview.md +67 -34
- package/docs/customization/recipes.md +839 -49
- package/docs/customization/slots.md +216 -35
- package/docs/customization/stylesheets.md +147 -0
- package/docs/customization/tailwind.md +842 -0
- package/docs/customization/tokens.md +163 -96
- package/docs/customization/translations.md +61 -3
- package/docs/frameworks/astro/embeds.md +160 -0
- package/docs/frameworks/astro/network-blocker.md +86 -0
- package/docs/frameworks/astro/scripts.md +146 -0
- package/docs/frameworks/html/embeds.md +142 -0
- package/docs/frameworks/html/network-blocker.md +105 -0
- package/docs/frameworks/html/scripts.md +164 -0
- package/docs/frameworks/javascript/scripts.md +119 -0
- package/docs/frameworks/next/embeds.md +90 -0
- package/docs/frameworks/next/network-blocker.md +153 -0
- package/docs/frameworks/next/scripts.md +196 -0
- package/docs/frameworks/nuxt/embeds.md +81 -0
- package/docs/frameworks/nuxt/network-blocker.md +97 -0
- package/docs/frameworks/nuxt/scripts.md +89 -0
- package/docs/frameworks/react/embeds.md +89 -0
- package/docs/frameworks/react/network-blocker.md +140 -0
- package/docs/frameworks/react/scripts.md +115 -0
- package/docs/frameworks/svelte/embeds.md +96 -0
- package/docs/frameworks/svelte/network-blocker.md +141 -0
- package/docs/frameworks/svelte/scripts.md +137 -0
- package/docs/frameworks/sveltekit/embeds.md +103 -0
- package/docs/frameworks/sveltekit/network-blocker.md +149 -0
- package/docs/frameworks/sveltekit/scripts.md +141 -0
- package/docs/frameworks/tanstack-start/embeds.md +96 -0
- package/docs/frameworks/tanstack-start/network-blocker.md +145 -0
- package/docs/frameworks/tanstack-start/scripts.md +103 -0
- package/docs/frameworks/vue/embeds.md +84 -0
- package/docs/frameworks/vue/network-blocker.md +99 -0
- package/docs/frameworks/vue/scripts.md +93 -0
- package/docs/guides/banner-experiments.md +654 -0
- package/docs/guides/troubleshooting.md +120 -47
- package/docs/guides/verify-consent.md +81 -49
- package/docs/integrations/adobe-analytics.md +167 -159
- package/docs/integrations/ahrefs-analytics.md +152 -154
- package/docs/integrations/amplitude.md +162 -156
- package/docs/integrations/building-integrations.md +136 -37
- package/docs/integrations/clearbit.md +154 -154
- package/docs/integrations/cloudflare-web-analytics.md +156 -156
- package/docs/integrations/cloudflare-zaraz.md +209 -261
- package/docs/integrations/crisp.md +164 -158
- package/docs/integrations/databuddy.md +157 -173
- package/docs/integrations/fathom-analytics.md +158 -156
- package/docs/integrations/front-chat.md +167 -167
- package/docs/integrations/google-maps.md +118 -83
- package/docs/integrations/google-tag-manager.md +178 -163
- package/docs/integrations/google-tag.md +163 -160
- package/docs/integrations/heap.md +163 -155
- package/docs/integrations/hightouch.md +161 -157
- package/docs/integrations/hotjar.md +159 -155
- package/docs/integrations/intercom.md +183 -153
- package/docs/integrations/klaviyo.md +486 -0
- package/docs/integrations/linkedin-insights.md +174 -150
- package/docs/integrations/logrocket.md +160 -156
- package/docs/integrations/matomo-analytics.md +188 -178
- package/docs/integrations/meta-pixel.md +188 -150
- package/docs/integrations/microsoft-clarity.md +163 -155
- package/docs/integrations/microsoft-uet.md +148 -154
- package/docs/integrations/mixpanel-analytics.md +155 -160
- package/docs/integrations/one-dollar-stats.md +166 -165
- package/docs/integrations/openai-pixel.md +204 -301
- package/docs/integrations/overview.md +137 -80
- package/docs/integrations/pinterest-tag.md +191 -183
- package/docs/integrations/pirsch.md +169 -159
- package/docs/integrations/plausible-analytics.md +172 -158
- package/docs/integrations/posthog.md +226 -241
- package/docs/integrations/promptwatch.md +154 -154
- package/docs/integrations/reddit-pixel.md +185 -157
- package/docs/integrations/rudderstack.md +201 -186
- package/docs/integrations/rybbit-analytics.md +171 -160
- package/docs/integrations/segment.md +182 -154
- package/docs/integrations/snapchat-pixel.md +186 -156
- package/docs/integrations/tiktok-pixel.md +171 -150
- package/docs/integrations/umami-analytics.md +163 -158
- package/docs/integrations/vercel-analytics.md +166 -157
- package/docs/integrations/x-pixel.md +176 -150
- package/docs/integrations/youtube.md +121 -86
- package/docs/upgrade-v3.md +475 -467
- package/package.json +10 -257
- package/dist-types/__tests__/helpers.d.ts +0 -141
- package/docs/assets/v3/brand-bar.png +0 -0
- package/docs/assets/v3/mobile-card.png +0 -0
- package/docs/assets/v3/preferences.png +0 -0
- package/docs/frameworks/javascript/script-loader.md +0 -100
- package/docs/frameworks/next/script-loader.md +0 -216
- package/docs/frameworks/react/script-loader.md +0 -69
- package/docs/guides/deployment-modes.md +0 -75
- package/docs/guides/shared-consent-controls.md +0 -158
- package/docs/integrations/clear-on-revocation.md +0 -167
- package/docs/integrations/granular-consent.md +0 -210
|
@@ -1,134 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { joinUrlPath, resolveScriptUrl, trimToUndefined } from "../_shared/script-url.js";
|
|
4
|
-
const DEFAULT_HEAP_CONFIG_BASE_URL = 'https://cdn.us.heap-api.com/config';
|
|
5
|
-
const HEAP_QUEUE_METHODS = [
|
|
6
|
-
'init',
|
|
7
|
-
'startTracking',
|
|
8
|
-
'stopTracking',
|
|
9
|
-
'track',
|
|
10
|
-
'resetIdentity',
|
|
11
|
-
'identify',
|
|
12
|
-
'identifyHashed',
|
|
13
|
-
'getSessionId',
|
|
14
|
-
'getUserId',
|
|
15
|
-
'getIdentity',
|
|
16
|
-
'addUserProperties',
|
|
17
|
-
'addEventProperties',
|
|
18
|
-
'removeEventProperty',
|
|
19
|
-
'clearEventProperties',
|
|
20
|
-
'addAccountProperties',
|
|
21
|
-
'addAdapter',
|
|
22
|
-
'addTransformer',
|
|
23
|
-
'addTransformerFn',
|
|
24
|
-
'onReady',
|
|
25
|
-
'addPageviewProperties',
|
|
26
|
-
'removePageviewProperty',
|
|
27
|
-
'clearPageviewProperties',
|
|
28
|
-
'trackPageview'
|
|
29
|
-
];
|
|
30
|
-
const heapManifest = {
|
|
31
|
-
...vendorManifestContract,
|
|
32
|
-
category: 'measurement',
|
|
33
|
-
install: [
|
|
34
|
-
{
|
|
35
|
-
ifUndefined: true,
|
|
36
|
-
name: 'heapReadyCb',
|
|
37
|
-
type: 'setGlobal',
|
|
38
|
-
value: []
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
ifUndefined: true,
|
|
42
|
-
name: 'heap',
|
|
43
|
-
type: 'setGlobal',
|
|
44
|
-
value: []
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
path: [
|
|
48
|
-
'heap',
|
|
49
|
-
'envId'
|
|
50
|
-
],
|
|
51
|
-
type: 'setGlobalPath',
|
|
52
|
-
value: '{{envId}}'
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
path: [
|
|
56
|
-
'heap',
|
|
57
|
-
'appid'
|
|
58
|
-
],
|
|
59
|
-
type: 'setGlobalPath',
|
|
60
|
-
value: '{{envId}}'
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
path: [
|
|
64
|
-
'heap',
|
|
65
|
-
'clientConfig'
|
|
66
|
-
],
|
|
67
|
-
type: 'setGlobalPath',
|
|
68
|
-
value: '{{clientConfig}}'
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
methods: [
|
|
72
|
-
...HEAP_QUEUE_METHODS
|
|
73
|
-
],
|
|
74
|
-
queue: {
|
|
75
|
-
global: 'heapReadyCb'
|
|
76
|
-
},
|
|
77
|
-
queueFormat: 'callback',
|
|
78
|
-
target: 'heap',
|
|
79
|
-
type: 'defineQueueMethods'
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
async: true,
|
|
83
|
-
src: "{{scriptUrl}}",
|
|
84
|
-
type: 'loadScript'
|
|
85
|
-
}
|
|
86
|
-
],
|
|
87
|
-
vendor: 'heap'
|
|
88
|
-
};
|
|
89
|
-
const heap_validateEnvId = function(envId) {
|
|
90
|
-
const normalized = 'string' == typeof envId ? envId.trim() : '';
|
|
91
|
-
if (0 === normalized.length) throw new Error('heap: missing or invalid envId');
|
|
92
|
-
return normalized;
|
|
93
|
-
};
|
|
94
|
-
const heap_isPlainRecord = function(value) {
|
|
95
|
-
if (null === value || 'object' != typeof value || Array.isArray(value)) return false;
|
|
96
|
-
const prototype = Object.getPrototypeOf(value);
|
|
97
|
-
return prototype === Object.prototype || null === prototype;
|
|
98
|
-
};
|
|
99
|
-
const heap_toJsonValue = function toJsonValue(value, path) {
|
|
100
|
-
if (null === value) return null;
|
|
101
|
-
if ('string' == typeof value || 'boolean' == typeof value) return value;
|
|
102
|
-
if ('number' == typeof value) {
|
|
103
|
-
if (Number.isFinite(value)) return value;
|
|
104
|
-
throw new TypeError(`heap: clientConfig${path ? `.${path}` : ''} must be a finite number`);
|
|
105
|
-
}
|
|
106
|
-
if (Array.isArray(value)) return value.map((item, index)=>toJsonValue(item, `${path}[${index}]`));
|
|
107
|
-
if (heap_isPlainRecord(value)) {
|
|
108
|
-
const result = {};
|
|
109
|
-
for (const [key, nestedValue] of Object.entries(value))result[key] = toJsonValue(nestedValue, path ? `${path}.${key}` : key);
|
|
110
|
-
return result;
|
|
111
|
-
}
|
|
112
|
-
throw new TypeError(`heap: clientConfig${path ? `.${path}` : ''} must be JSON-serializable`);
|
|
113
|
-
};
|
|
114
|
-
const heap_normalizeClientConfig = function(clientConfig) {
|
|
115
|
-
const config = clientConfig ?? {};
|
|
116
|
-
const normalized = heap_toJsonValue(config, '');
|
|
117
|
-
if (!heap_isPlainRecord(normalized)) throw new TypeError('heap: clientConfig must be a plain object');
|
|
118
|
-
return {
|
|
119
|
-
...normalized,
|
|
120
|
-
shouldFetchServerConfig: false
|
|
121
|
-
};
|
|
122
|
-
};
|
|
123
|
-
const heap_resolveHeapScriptUrl = function(envId, scriptUrl) {
|
|
124
|
-
return resolveScriptUrl(trimToUndefined(scriptUrl), joinUrlPath(DEFAULT_HEAP_CONFIG_BASE_URL, `${envId}/heap_config.js`));
|
|
125
|
-
};
|
|
126
|
-
const heap_heap = function({ envId, clientConfig, scriptUrl }) {
|
|
127
|
-
const normalizedEnvId = heap_validateEnvId(envId);
|
|
128
|
-
return resolveManifest(heapManifest, {
|
|
129
|
-
clientConfig: heap_normalizeClientConfig(clientConfig),
|
|
130
|
-
envId: normalizedEnvId,
|
|
131
|
-
scriptUrl: heap_resolveHeapScriptUrl(normalizedEnvId, scriptUrl)
|
|
132
|
-
});
|
|
133
|
-
};
|
|
134
|
-
export { DEFAULT_HEAP_CONFIG_BASE_URL, HEAP_QUEUE_METHODS, heapManifest, heap_heap as heap };
|
|
1
|
+
/** @deprecated Use @c15t/integrations/vendors/analytics/heap. Compatibility ends in v4. */
|
|
2
|
+
export * from '@c15t/integrations/vendors/analytics/heap';
|
|
@@ -1,109 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { resolveScriptUrl, trimToUndefined } from "../_shared/script-url.js";
|
|
4
|
-
const DEFAULT_HIGHTOUCH_SCRIPT_URL = 'https://cdn.hightouch-events.com/browser/release/v1-latest/events.min.js';
|
|
5
|
-
const HIGHTOUCH_QUEUE_METHODS = [
|
|
6
|
-
'trackSubmit',
|
|
7
|
-
'trackClick',
|
|
8
|
-
'trackLink',
|
|
9
|
-
'trackForm',
|
|
10
|
-
'pageview',
|
|
11
|
-
'identify',
|
|
12
|
-
'reset',
|
|
13
|
-
'group',
|
|
14
|
-
'track',
|
|
15
|
-
'ready',
|
|
16
|
-
'alias',
|
|
17
|
-
'debug',
|
|
18
|
-
'page',
|
|
19
|
-
'once',
|
|
20
|
-
'off',
|
|
21
|
-
'on',
|
|
22
|
-
'addSourceMiddleware',
|
|
23
|
-
'addIntegrationMiddleware',
|
|
24
|
-
'setAnonymousId',
|
|
25
|
-
'addDestinationMiddleware',
|
|
26
|
-
'load'
|
|
27
|
-
];
|
|
28
|
-
const hightouchManifest = {
|
|
29
|
-
...vendorManifestContract,
|
|
30
|
-
bootstrap: [
|
|
31
|
-
{
|
|
32
|
-
ifUndefined: true,
|
|
33
|
-
name: 'htevents',
|
|
34
|
-
type: 'setGlobal',
|
|
35
|
-
value: []
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
methods: [
|
|
39
|
-
...HIGHTOUCH_QUEUE_METHODS
|
|
40
|
-
],
|
|
41
|
-
target: 'htevents',
|
|
42
|
-
type: 'defineQueueMethods'
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
path: [
|
|
46
|
-
'htevents',
|
|
47
|
-
'_writeKey'
|
|
48
|
-
],
|
|
49
|
-
type: 'setGlobalPath',
|
|
50
|
-
value: '{{writeKey}}'
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
path: [
|
|
54
|
-
'htevents',
|
|
55
|
-
'_loadOptions'
|
|
56
|
-
],
|
|
57
|
-
type: 'setGlobalPath',
|
|
58
|
-
value: '{{loadOptions}}'
|
|
59
|
-
}
|
|
60
|
-
],
|
|
61
|
-
category: 'measurement',
|
|
62
|
-
install: [
|
|
63
|
-
{
|
|
64
|
-
args: [
|
|
65
|
-
'{{writeKey}}',
|
|
66
|
-
'{{loadOptions}}'
|
|
67
|
-
],
|
|
68
|
-
global: 'htevents',
|
|
69
|
-
method: 'load',
|
|
70
|
-
type: 'callGlobal'
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
global: 'htevents',
|
|
74
|
-
method: 'page',
|
|
75
|
-
type: 'callGlobal'
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
async: true,
|
|
79
|
-
src: "{{scriptUrl}}",
|
|
80
|
-
type: 'loadScript'
|
|
81
|
-
}
|
|
82
|
-
],
|
|
83
|
-
vendor: 'hightouch'
|
|
84
|
-
};
|
|
85
|
-
const hightouch_validateWriteKey = function(writeKey) {
|
|
86
|
-
const normalized = 'string' == typeof writeKey ? writeKey.trim() : '';
|
|
87
|
-
if (0 === normalized.length) throw new Error('hightouch: missing or invalid writeKey');
|
|
88
|
-
return normalized;
|
|
89
|
-
};
|
|
90
|
-
const hightouch_normalizeApiHost = function(apiHost) {
|
|
91
|
-
return trimToUndefined(apiHost);
|
|
92
|
-
};
|
|
93
|
-
const hightouch_hightouch = function({ writeKey, apiHost, trackPageView = true, scriptUrl }) {
|
|
94
|
-
const normalizedWriteKey = hightouch_validateWriteKey(writeKey);
|
|
95
|
-
const loadOptions = {
|
|
96
|
-
apiHost: hightouch_normalizeApiHost(apiHost)
|
|
97
|
-
};
|
|
98
|
-
let manifest = hightouchManifest;
|
|
99
|
-
if (!trackPageView) manifest = {
|
|
100
|
-
...hightouchManifest,
|
|
101
|
-
install: hightouchManifest.install.filter((step)=>!('callGlobal' === step.type && 'htevents' === step.global && 'page' === step.method))
|
|
102
|
-
};
|
|
103
|
-
return resolveManifest(manifest, {
|
|
104
|
-
loadOptions,
|
|
105
|
-
scriptUrl: resolveScriptUrl(trimToUndefined(scriptUrl), DEFAULT_HIGHTOUCH_SCRIPT_URL),
|
|
106
|
-
writeKey: normalizedWriteKey
|
|
107
|
-
});
|
|
108
|
-
};
|
|
109
|
-
export { HIGHTOUCH_QUEUE_METHODS, hightouchManifest, hightouch_hightouch as hightouch };
|
|
1
|
+
/** @deprecated Use @c15t/integrations/vendors/analytics/hightouch. Compatibility ends in v4. */
|
|
2
|
+
export * from '@c15t/integrations/vendors/analytics/hightouch';
|
|
@@ -1,44 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { resolveScriptUrl } from "../_shared/script-url.js";
|
|
4
|
-
const hotjarManifest = {
|
|
5
|
-
...vendorManifestContract,
|
|
6
|
-
category: 'measurement',
|
|
7
|
-
install: [
|
|
8
|
-
{
|
|
9
|
-
ifUndefined: true,
|
|
10
|
-
name: '_hjSettings',
|
|
11
|
-
type: 'setGlobal',
|
|
12
|
-
value: {
|
|
13
|
-
hjid: '{{siteId}}',
|
|
14
|
-
hjsv: '{{version}}'
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
ifUndefined: true,
|
|
19
|
-
name: 'hj',
|
|
20
|
-
queue: {
|
|
21
|
-
property: 'q'
|
|
22
|
-
},
|
|
23
|
-
queueFormat: 'array',
|
|
24
|
-
type: 'defineStubFunction'
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
async: true,
|
|
28
|
-
src: "{{scriptUrl}}",
|
|
29
|
-
type: 'loadScript'
|
|
30
|
-
}
|
|
31
|
-
],
|
|
32
|
-
vendor: 'hotjar'
|
|
33
|
-
};
|
|
34
|
-
const hotjar_hotjar = function({ siteId, version = 6, scriptUrl }) {
|
|
35
|
-
if (null == siteId) throw new Error('hotjar: missing or invalid siteId');
|
|
36
|
-
const normalizedSiteId = String(siteId).trim();
|
|
37
|
-
if (0 === normalizedSiteId.length || '0' === normalizedSiteId) throw new Error('hotjar: missing or invalid siteId');
|
|
38
|
-
return resolveManifest(hotjarManifest, {
|
|
39
|
-
scriptUrl: resolveScriptUrl(scriptUrl, `https://static.hotjar.com/c/hotjar-${normalizedSiteId}.js?sv=${version}`),
|
|
40
|
-
siteId: normalizedSiteId,
|
|
41
|
-
version
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
export { hotjarManifest, hotjar_hotjar as hotjar };
|
|
1
|
+
/** @deprecated Use @c15t/integrations/vendors/analytics/hotjar. Compatibility ends in v4. */
|
|
2
|
+
export * from '@c15t/integrations/vendors/analytics/hotjar';
|
|
@@ -1,58 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { resolveScriptUrl, trimToUndefined } from "../_shared/script-url.js";
|
|
4
|
-
const DEFAULT_LOGROCKET_SCRIPT_URL = 'https://cdn.logrocket.io/LogRocket.min.js';
|
|
5
|
-
const logrocket_validateLogRocketAppId = function(appId) {
|
|
6
|
-
const normalized = 'string' == typeof appId ? appId.trim() : '';
|
|
7
|
-
const segments = normalized.split('/');
|
|
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
|
-
return normalized;
|
|
10
|
-
};
|
|
11
|
-
const logRocketManifest = {
|
|
12
|
-
...vendorManifestContract,
|
|
13
|
-
afterLoad: [
|
|
14
|
-
{
|
|
15
|
-
args: [
|
|
16
|
-
'{{appId}}',
|
|
17
|
-
'{{initOptions}}'
|
|
18
|
-
],
|
|
19
|
-
global: 'LogRocket',
|
|
20
|
-
method: 'init',
|
|
21
|
-
type: 'callGlobal'
|
|
22
|
-
}
|
|
23
|
-
],
|
|
24
|
-
category: 'measurement',
|
|
25
|
-
install: [
|
|
26
|
-
{
|
|
27
|
-
attributes: {
|
|
28
|
-
crossorigin: 'anonymous'
|
|
29
|
-
},
|
|
30
|
-
src: "{{scriptUrl}}",
|
|
31
|
-
type: 'loadScript'
|
|
32
|
-
}
|
|
33
|
-
],
|
|
34
|
-
vendor: 'logrocket'
|
|
35
|
-
};
|
|
36
|
-
const logrocket_logRocket = function(options) {
|
|
37
|
-
const appId = logrocket_validateLogRocketAppId(options?.appId);
|
|
38
|
-
const asyncScriptUrl = trimToUndefined(options.asyncScriptUrl);
|
|
39
|
-
let manifest = logRocketManifest;
|
|
40
|
-
if (asyncScriptUrl) manifest = {
|
|
41
|
-
...logRocketManifest,
|
|
42
|
-
bootstrap: [
|
|
43
|
-
{
|
|
44
|
-
ifUndefined: false,
|
|
45
|
-
name: '_lrAsyncScript',
|
|
46
|
-
type: 'setGlobal',
|
|
47
|
-
value: '{{asyncScriptUrl}}'
|
|
48
|
-
}
|
|
49
|
-
]
|
|
50
|
-
};
|
|
51
|
-
return resolveManifest(manifest, {
|
|
52
|
-
appId,
|
|
53
|
-
asyncScriptUrl,
|
|
54
|
-
initOptions: options.initOptions ?? {},
|
|
55
|
-
scriptUrl: resolveScriptUrl(trimToUndefined(options.scriptUrl), DEFAULT_LOGROCKET_SCRIPT_URL)
|
|
56
|
-
});
|
|
57
|
-
};
|
|
58
|
-
export { logRocketManifest, logrocket_logRocket as logRocket };
|
|
1
|
+
/** @deprecated Use @c15t/integrations/vendors/analytics/logrocket. Compatibility ends in v4. */
|
|
2
|
+
export * from '@c15t/integrations/vendors/analytics/logrocket';
|
|
@@ -1,191 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { joinUrlPath, stripTrailingSlashes } from "../_shared/script-url.js";
|
|
4
|
-
const matomo_analytics_stripProtocol = function(value) {
|
|
5
|
-
if (value.startsWith('https://')) return value.slice(8);
|
|
6
|
-
if (value.startsWith('http://')) return value.slice(7);
|
|
7
|
-
return value;
|
|
8
|
-
};
|
|
9
|
-
const matomo_analytics_resolveMatomoOrigin = function(options) {
|
|
10
|
-
if (options.matomoUrl) return stripTrailingSlashes(options.matomoUrl);
|
|
11
|
-
if (options.cloudId) {
|
|
12
|
-
const cleanedCloudId = stripTrailingSlashes(matomo_analytics_stripProtocol(options.cloudId));
|
|
13
|
-
if (cleanedCloudId.endsWith('.matomo.cloud')) return `https://${cleanedCloudId}`;
|
|
14
|
-
return `https://cdn.matomo.cloud/${cleanedCloudId}`;
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
const matomo_analytics_buildInstallSteps = function(options) {
|
|
18
|
-
const install = [
|
|
19
|
-
{
|
|
20
|
-
ifUndefined: true,
|
|
21
|
-
name: '_paq',
|
|
22
|
-
type: 'setGlobal',
|
|
23
|
-
value: []
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
queue: '_paq',
|
|
27
|
-
type: 'pushToQueue',
|
|
28
|
-
value: [
|
|
29
|
-
'setTrackerUrl',
|
|
30
|
-
'{{trackerUrl}}'
|
|
31
|
-
]
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
queue: '_paq',
|
|
35
|
-
type: 'pushToQueue',
|
|
36
|
-
value: [
|
|
37
|
-
'setSiteId',
|
|
38
|
-
'{{siteId}}'
|
|
39
|
-
]
|
|
40
|
-
}
|
|
41
|
-
];
|
|
42
|
-
if (options.enableLinkTracking) install.push({
|
|
43
|
-
queue: '_paq',
|
|
44
|
-
type: 'pushToQueue',
|
|
45
|
-
value: [
|
|
46
|
-
'enableLinkTracking'
|
|
47
|
-
]
|
|
48
|
-
});
|
|
49
|
-
if (options.disableCookies) install.push({
|
|
50
|
-
queue: '_paq',
|
|
51
|
-
type: 'pushToQueue',
|
|
52
|
-
value: [
|
|
53
|
-
'disableCookies'
|
|
54
|
-
]
|
|
55
|
-
});
|
|
56
|
-
if (options.enableConsentMode && !options.consentInitiallyGiven) install.push({
|
|
57
|
-
queue: '_paq',
|
|
58
|
-
type: 'pushToQueue',
|
|
59
|
-
value: [
|
|
60
|
-
'requireConsent'
|
|
61
|
-
]
|
|
62
|
-
});
|
|
63
|
-
if (options.enableConsentMode && options.consentInitiallyGiven) {
|
|
64
|
-
install.push({
|
|
65
|
-
queue: '_paq',
|
|
66
|
-
type: 'pushToQueue',
|
|
67
|
-
value: [
|
|
68
|
-
'setConsentGiven'
|
|
69
|
-
]
|
|
70
|
-
});
|
|
71
|
-
if (options.trackPageView) install.push({
|
|
72
|
-
queue: '_paq',
|
|
73
|
-
type: 'pushToQueue',
|
|
74
|
-
value: [
|
|
75
|
-
'trackPageView'
|
|
76
|
-
]
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
if (options.trackPageView && !options.enableConsentMode) install.push({
|
|
80
|
-
queue: '_paq',
|
|
81
|
-
type: 'pushToQueue',
|
|
82
|
-
value: [
|
|
83
|
-
'trackPageView'
|
|
84
|
-
]
|
|
85
|
-
});
|
|
86
|
-
install.push({
|
|
87
|
-
async: true,
|
|
88
|
-
src: "{{scriptUrl}}",
|
|
89
|
-
type: 'loadScript'
|
|
90
|
-
});
|
|
91
|
-
return install;
|
|
92
|
-
};
|
|
93
|
-
const matomo_analytics_buildGrantedHooks = function(options) {
|
|
94
|
-
const onBeforeLoadGranted = [];
|
|
95
|
-
if (options.enableConsentMode && !options.consentInitiallyGiven) onBeforeLoadGranted.push({
|
|
96
|
-
queue: '_paq',
|
|
97
|
-
type: 'pushToQueue',
|
|
98
|
-
value: [
|
|
99
|
-
'setConsentGiven'
|
|
100
|
-
]
|
|
101
|
-
});
|
|
102
|
-
if (options.trackPageView && options.enableConsentMode && !options.consentInitiallyGiven) onBeforeLoadGranted.push({
|
|
103
|
-
queue: '_paq',
|
|
104
|
-
type: 'pushToQueue',
|
|
105
|
-
value: [
|
|
106
|
-
'trackPageView'
|
|
107
|
-
]
|
|
108
|
-
});
|
|
109
|
-
const onConsentGranted = [];
|
|
110
|
-
if (options.enableConsentMode) {
|
|
111
|
-
onConsentGranted.push({
|
|
112
|
-
queue: '_paq',
|
|
113
|
-
type: 'pushToQueue',
|
|
114
|
-
value: [
|
|
115
|
-
'setConsentGiven'
|
|
116
|
-
]
|
|
117
|
-
});
|
|
118
|
-
if (options.trackPageView) onConsentGranted.push({
|
|
119
|
-
queue: '_paq',
|
|
120
|
-
type: 'pushToQueue',
|
|
121
|
-
value: [
|
|
122
|
-
'trackPageView'
|
|
123
|
-
]
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
return {
|
|
127
|
-
onBeforeLoadGranted,
|
|
128
|
-
onConsentGranted
|
|
129
|
-
};
|
|
130
|
-
};
|
|
131
|
-
const matomo_analytics_buildDeniedHooks = function(options) {
|
|
132
|
-
const onConsentDenied = [];
|
|
133
|
-
if (options.enableConsentMode) onConsentDenied.push({
|
|
134
|
-
queue: '_paq',
|
|
135
|
-
type: 'pushToQueue',
|
|
136
|
-
value: [
|
|
137
|
-
'forgetConsentGiven'
|
|
138
|
-
]
|
|
139
|
-
});
|
|
140
|
-
return onConsentDenied;
|
|
141
|
-
};
|
|
142
|
-
const matomo_analytics_createMatomoAnalyticsManifest = function(options) {
|
|
143
|
-
const { onBeforeLoadGranted, onConsentGranted } = matomo_analytics_buildGrantedHooks(options);
|
|
144
|
-
let alwaysLoad;
|
|
145
|
-
let persistAfterConsentRevoked;
|
|
146
|
-
if (options.enableConsentMode) {
|
|
147
|
-
alwaysLoad = true;
|
|
148
|
-
persistAfterConsentRevoked = true;
|
|
149
|
-
}
|
|
150
|
-
return {
|
|
151
|
-
...vendorManifestContract,
|
|
152
|
-
alwaysLoad,
|
|
153
|
-
category: 'measurement',
|
|
154
|
-
install: matomo_analytics_buildInstallSteps(options),
|
|
155
|
-
onBeforeLoadGranted,
|
|
156
|
-
onConsentDenied: matomo_analytics_buildDeniedHooks(options),
|
|
157
|
-
onConsentGranted,
|
|
158
|
-
persistAfterConsentRevoked,
|
|
159
|
-
vendor: 'matomo-analytics'
|
|
160
|
-
};
|
|
161
|
-
};
|
|
162
|
-
const matomoAnalyticsManifest = matomo_analytics_createMatomoAnalyticsManifest({
|
|
163
|
-
consentInitiallyGiven: false,
|
|
164
|
-
disableCookies: false,
|
|
165
|
-
enableConsentMode: false,
|
|
166
|
-
enableLinkTracking: false,
|
|
167
|
-
trackPageView: true
|
|
168
|
-
});
|
|
169
|
-
const matomo_analytics_matomoAnalytics = function(options = {}) {
|
|
170
|
-
const origin = matomo_analytics_resolveMatomoOrigin(options);
|
|
171
|
-
let { trackerUrl } = options;
|
|
172
|
-
if (!trackerUrl && origin) trackerUrl = joinUrlPath(origin, 'matomo.php');
|
|
173
|
-
let { scriptUrl } = options;
|
|
174
|
-
if (!scriptUrl && origin) scriptUrl = joinUrlPath(origin, 'matomo.js');
|
|
175
|
-
if (!trackerUrl || !scriptUrl) throw new Error("matomoAnalytics requires `matomoUrl`, `cloudId`, or explicit `trackerUrl` and `scriptUrl` values.");
|
|
176
|
-
const enableConsentMode = 'required' === options.defaultConsent || 'given' === options.defaultConsent;
|
|
177
|
-
const consentInitiallyGiven = 'given' === options.defaultConsent;
|
|
178
|
-
const manifest = matomo_analytics_createMatomoAnalyticsManifest({
|
|
179
|
-
consentInitiallyGiven,
|
|
180
|
-
disableCookies: options.disableCookies ?? false,
|
|
181
|
-
enableConsentMode,
|
|
182
|
-
enableLinkTracking: options.enableLinkTracking ?? false,
|
|
183
|
-
trackPageView: options.trackPageView ?? true
|
|
184
|
-
});
|
|
185
|
-
return resolveManifest(manifest, {
|
|
186
|
-
scriptUrl,
|
|
187
|
-
siteId: String(options.siteId ?? 1),
|
|
188
|
-
trackerUrl
|
|
189
|
-
});
|
|
190
|
-
};
|
|
191
|
-
export { matomoAnalyticsManifest, matomo_analytics_matomoAnalytics as matomoAnalytics };
|
|
1
|
+
/** @deprecated Use @c15t/integrations/vendors/analytics/matomo-analytics. Compatibility ends in v4. */
|
|
2
|
+
export * from '@c15t/integrations/vendors/analytics/matomo-analytics';
|
|
@@ -1,100 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const microsoft_clarity_toClarityConsentState = function(value) {
|
|
4
|
-
if (true === value) return 'granted';
|
|
5
|
-
if (false === value) return 'denied';
|
|
6
|
-
if ('string' != typeof value) return;
|
|
7
|
-
const normalized = value.toLowerCase();
|
|
8
|
-
if ('granted' === normalized || 'true' === normalized) return 'granted';
|
|
9
|
-
if ('denied' === normalized || 'false' === normalized) return 'denied';
|
|
10
|
-
};
|
|
11
|
-
const microsoft_clarity_getConsentValue = function(value, keys) {
|
|
12
|
-
for (const key of keys){
|
|
13
|
-
const consent = microsoft_clarity_toClarityConsentState(value[key]);
|
|
14
|
-
if (consent) return consent;
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
const microsoft_clarity_getConsentPayloadFromState = function(consents) {
|
|
18
|
-
let adStorage;
|
|
19
|
-
adStorage = consents.marketing ? 'granted' : 'denied';
|
|
20
|
-
let analyticsStorage;
|
|
21
|
-
analyticsStorage = consents.measurement ? 'granted' : 'denied';
|
|
22
|
-
return {
|
|
23
|
-
ad_Storage: adStorage,
|
|
24
|
-
analytics_Storage: analyticsStorage
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
const microsoft_clarity_getClarityConsentPayload = function(consents, defaultConsent) {
|
|
28
|
-
const fallback = microsoft_clarity_getConsentPayloadFromState(consents);
|
|
29
|
-
if (void 0 === defaultConsent) return fallback;
|
|
30
|
-
const booleanConsent = microsoft_clarity_toClarityConsentState(defaultConsent);
|
|
31
|
-
if (booleanConsent) return {
|
|
32
|
-
ad_Storage: booleanConsent,
|
|
33
|
-
analytics_Storage: booleanConsent
|
|
34
|
-
};
|
|
35
|
-
if (null !== defaultConsent && 'object' == typeof defaultConsent) return {
|
|
36
|
-
ad_Storage: microsoft_clarity_getConsentValue(defaultConsent, [
|
|
37
|
-
'ad_Storage',
|
|
38
|
-
'ad_storage',
|
|
39
|
-
'marketing'
|
|
40
|
-
]) ?? fallback.ad_Storage,
|
|
41
|
-
analytics_Storage: microsoft_clarity_getConsentValue(defaultConsent, [
|
|
42
|
-
'analytics_Storage',
|
|
43
|
-
'analytics_storage',
|
|
44
|
-
'measurement',
|
|
45
|
-
'analytics'
|
|
46
|
-
]) ?? fallback.analytics_Storage
|
|
47
|
-
};
|
|
48
|
-
return fallback;
|
|
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
|
-
};
|
|
56
|
-
const clarityManifest = {
|
|
57
|
-
...vendorManifestContract,
|
|
58
|
-
bootstrap: [
|
|
59
|
-
{
|
|
60
|
-
ifUndefined: true,
|
|
61
|
-
name: 'clarity',
|
|
62
|
-
queue: {
|
|
63
|
-
property: 'q'
|
|
64
|
-
},
|
|
65
|
-
queueFormat: 'array',
|
|
66
|
-
type: 'defineStubFunction'
|
|
67
|
-
}
|
|
68
|
-
],
|
|
69
|
-
category: 'measurement',
|
|
70
|
-
install: [
|
|
71
|
-
{
|
|
72
|
-
async: true,
|
|
73
|
-
src: "{{scriptUrl}}",
|
|
74
|
-
type: 'loadScript'
|
|
75
|
-
}
|
|
76
|
-
],
|
|
77
|
-
persistAfterConsentRevoked: true,
|
|
78
|
-
vendor: 'microsoft-clarity'
|
|
79
|
-
};
|
|
80
|
-
const microsoft_clarity_clarity = function({ id, defaultConsent, scriptUrl }) {
|
|
81
|
-
const normalizedId = id.trim();
|
|
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.`);
|
|
83
|
-
const resolved = resolveManifest(clarityManifest, {
|
|
84
|
-
scriptUrl: scriptUrl ?? `https://www.clarity.ms/tag/${normalizedId}`
|
|
85
|
-
});
|
|
86
|
-
const { onBeforeLoad } = resolved;
|
|
87
|
-
const { onConsentChange } = resolved;
|
|
88
|
-
return {
|
|
89
|
-
...resolved,
|
|
90
|
-
onBeforeLoad: (info)=>{
|
|
91
|
-
onBeforeLoad?.(info);
|
|
92
|
-
microsoft_clarity_syncClarityConsent(info, defaultConsent);
|
|
93
|
-
},
|
|
94
|
-
onConsentChange: (info)=>{
|
|
95
|
-
onConsentChange?.(info);
|
|
96
|
-
microsoft_clarity_syncClarityConsent(info);
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
};
|
|
100
|
-
export { clarityManifest, microsoft_clarity_clarity as clarity };
|
|
1
|
+
/** @deprecated Use @c15t/integrations/vendors/analytics/microsoft-clarity. Compatibility ends in v4. */
|
|
2
|
+
export * from '@c15t/integrations/vendors/analytics/microsoft-clarity';
|