@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.
- package/AGENTS.md +74 -48
- package/README.md +3 -3
- package/dist/e2e-test-utils.js +60 -24
- package/dist/engine/compile.js +45 -45
- package/dist/engine/runtime.js +119 -119
- package/dist/registry.js +186 -176
- package/dist/resolve.js +12 -12
- package/dist/vendors/_shared/attributes.js +5 -5
- package/dist/vendors/_shared/google-consent.js +10 -10
- package/dist/vendors/_shared/install-builders.js +9 -9
- package/dist/vendors/_shared/script-url.js +12 -12
- package/dist/vendors/ads-and-pixels/linkedin-insights.js +16 -16
- package/dist/vendors/ads-and-pixels/meta-pixel.js +82 -82
- package/dist/vendors/ads-and-pixels/microsoft-uet.js +57 -57
- package/dist/vendors/ads-and-pixels/openai-pixel.js +88 -0
- package/dist/vendors/ads-and-pixels/reddit-pixel.js +39 -39
- package/dist/vendors/ads-and-pixels/snapchat-pixel.js +25 -25
- package/dist/vendors/ads-and-pixels/tiktok-pixel.js +31 -31
- package/dist/vendors/ads-and-pixels/x-pixel.js +17 -17
- package/dist/vendors/analytics/adobe-analytics.js +17 -17
- package/dist/vendors/analytics/ahrefs-analytics.js +8 -8
- package/dist/vendors/analytics/amplitude.js +39 -39
- package/dist/vendors/analytics/clearbit.js +11 -11
- package/dist/vendors/analytics/cloudflare-web-analytics.js +13 -13
- package/dist/vendors/analytics/databuddy.js +45 -45
- package/dist/vendors/analytics/fathom-analytics.js +15 -15
- package/dist/vendors/analytics/google-tag.js +23 -23
- package/dist/vendors/analytics/heap.js +37 -37
- package/dist/vendors/analytics/hightouch.js +30 -30
- package/dist/vendors/analytics/hotjar.js +14 -14
- package/dist/vendors/analytics/logrocket.js +24 -24
- package/dist/vendors/analytics/matomo-analytics.js +51 -51
- package/dist/vendors/analytics/microsoft-clarity.js +31 -31
- package/dist/vendors/analytics/mixpanel-analytics.js +31 -31
- package/dist/vendors/analytics/pirsch.js +27 -27
- package/dist/vendors/analytics/plausible-analytics.js +24 -24
- package/dist/vendors/analytics/posthog.js +84 -79
- package/dist/vendors/analytics/promptwatch.js +8 -8
- package/dist/vendors/analytics/rudderstack.js +50 -50
- package/dist/vendors/analytics/rybbit-analytics.js +30 -30
- package/dist/vendors/analytics/segment.js +16 -16
- package/dist/vendors/analytics/umami-analytics.js +16 -16
- package/dist/vendors/analytics/vercel-analytics.js +22 -22
- package/dist/vendors/functional/crisp.js +49 -51
- package/dist/vendors/functional/intercom.js +18 -18
- package/dist/vendors/tag-managers/google-tag-manager.js +20 -20
- package/dist-types/__tests__/helpers.d.ts +10 -10
- package/dist-types/engine/compile.d.ts +2 -2
- package/dist-types/engine/runtime.d.ts +3 -3
- package/dist-types/registry.d.ts +182 -173
- package/dist-types/resolve.d.ts +2 -2
- package/dist-types/types.d.ts +2 -2
- package/dist-types/vendors/_shared/attributes.d.ts +2 -2
- package/dist-types/vendors/_shared/google-consent.d.ts +2 -2
- package/dist-types/vendors/_shared/install-builders.d.ts +1 -1
- package/dist-types/vendors/_shared/script-url.d.ts +6 -6
- package/dist-types/vendors/ads-and-pixels/linkedin-insights.d.ts +14 -14
- package/dist-types/vendors/ads-and-pixels/meta-pixel.d.ts +27 -27
- package/dist-types/vendors/ads-and-pixels/microsoft-uet.d.ts +40 -40
- package/dist-types/vendors/ads-and-pixels/openai-pixel.d.ts +211 -0
- package/dist-types/vendors/ads-and-pixels/reddit-pixel.d.ts +28 -29
- package/dist-types/vendors/ads-and-pixels/snapchat-pixel.d.ts +23 -23
- package/dist-types/vendors/ads-and-pixels/tiktok-pixel.d.ts +22 -22
- package/dist-types/vendors/ads-and-pixels/x-pixel.d.ts +15 -15
- package/dist-types/vendors/analytics/adobe-analytics.d.ts +3 -3
- package/dist-types/vendors/analytics/ahrefs-analytics.d.ts +5 -5
- package/dist-types/vendors/analytics/amplitude.d.ts +24 -24
- package/dist-types/vendors/analytics/clearbit.d.ts +5 -5
- package/dist-types/vendors/analytics/cloudflare-web-analytics.d.ts +6 -6
- package/dist-types/vendors/analytics/databuddy.d.ts +34 -31
- package/dist-types/vendors/analytics/fathom-analytics.d.ts +8 -8
- package/dist-types/vendors/analytics/google-tag.d.ts +17 -17
- package/dist-types/vendors/analytics/heap.d.ts +17 -17
- package/dist-types/vendors/analytics/hightouch.d.ts +15 -15
- package/dist-types/vendors/analytics/hotjar.d.ts +9 -9
- package/dist-types/vendors/analytics/logrocket.d.ts +11 -11
- package/dist-types/vendors/analytics/matomo-analytics.d.ts +3 -3
- package/dist-types/vendors/analytics/microsoft-clarity.d.ts +12 -13
- package/dist-types/vendors/analytics/mixpanel-analytics.d.ts +20 -20
- package/dist-types/vendors/analytics/pirsch.d.ts +10 -10
- package/dist-types/vendors/analytics/plausible-analytics.d.ts +13 -13
- package/dist-types/vendors/analytics/posthog.d.ts +35 -32
- package/dist-types/vendors/analytics/promptwatch.d.ts +5 -5
- package/dist-types/vendors/analytics/rudderstack.d.ts +16 -16
- package/dist-types/vendors/analytics/rybbit-analytics.d.ts +15 -15
- package/dist-types/vendors/analytics/segment.d.ts +11 -11
- package/dist-types/vendors/analytics/umami-analytics.d.ts +9 -9
- package/dist-types/vendors/analytics/vercel-analytics.d.ts +13 -13
- package/dist-types/vendors/functional/crisp.d.ts +9 -9
- package/dist-types/vendors/functional/intercom.d.ts +12 -12
- package/dist-types/vendors/tag-managers/google-tag-manager.d.ts +16 -16
- package/docs/README.md +74 -48
- package/docs/assets/v3/brand-bar.png +0 -0
- package/docs/assets/v3/brand-card.png +0 -0
- package/docs/assets/v3/choice-wall.png +0 -0
- package/docs/assets/v3/mobile-card.png +0 -0
- package/docs/assets/v3/preferences.png +0 -0
- package/docs/customization/overview.md +45 -0
- package/docs/customization/recipes.md +79 -0
- package/docs/customization/slots.md +55 -0
- package/docs/customization/tokens.md +76 -0
- package/docs/customization/translations.md +49 -0
- package/docs/frameworks/javascript/script-loader.md +30 -339
- package/docs/frameworks/next/script-loader.md +134 -467
- package/docs/frameworks/react/script-loader.md +35 -535
- package/docs/guides/consent-state.md +60 -0
- package/docs/guides/data-fetching.md +163 -0
- package/docs/guides/deployment-modes.md +63 -0
- package/docs/guides/troubleshooting.md +68 -0
- package/docs/guides/verify-consent.md +62 -0
- package/docs/integrations/adobe-analytics.md +239 -105
- package/docs/integrations/ahrefs-analytics.md +238 -104
- package/docs/integrations/amplitude.md +219 -157
- package/docs/integrations/building-integrations.md +32 -224
- package/docs/integrations/clearbit.md +247 -86
- package/docs/integrations/cloudflare-web-analytics.md +250 -84
- package/docs/integrations/crisp.md +251 -97
- package/docs/integrations/databuddy.md +259 -153
- package/docs/integrations/fathom-analytics.md +239 -96
- package/docs/integrations/google-maps.md +328 -207
- package/docs/integrations/google-tag-manager.md +248 -96
- package/docs/integrations/google-tag.md +261 -90
- package/docs/integrations/heap.md +222 -149
- package/docs/integrations/hightouch.md +225 -131
- package/docs/integrations/hotjar.md +239 -90
- package/docs/integrations/intercom.md +239 -98
- package/docs/integrations/linkedin-insights.md +243 -113
- package/docs/integrations/logrocket.md +241 -123
- package/docs/integrations/matomo-analytics.md +256 -111
- package/docs/integrations/meta-pixel.md +197 -324
- package/docs/integrations/microsoft-clarity.md +233 -114
- package/docs/integrations/microsoft-uet.md +245 -110
- package/docs/integrations/mixpanel-analytics.md +252 -87
- package/docs/integrations/openai-pixel.md +441 -0
- package/docs/integrations/overview.md +95 -133
- package/docs/integrations/pirsch.md +249 -96
- package/docs/integrations/plausible-analytics.md +241 -100
- package/docs/integrations/posthog.md +353 -214
- package/docs/integrations/promptwatch.md +251 -81
- package/docs/integrations/reddit-pixel.md +226 -173
- package/docs/integrations/rudderstack.md +244 -187
- package/docs/integrations/rybbit-analytics.md +244 -91
- package/docs/integrations/segment.md +238 -92
- package/docs/integrations/snapchat-pixel.md +240 -110
- package/docs/integrations/tiktok-pixel.md +249 -81
- package/docs/integrations/umami-analytics.md +242 -95
- package/docs/integrations/vercel-analytics.md +242 -90
- package/docs/integrations/x-pixel.md +238 -104
- package/docs/integrations/youtube.md +354 -142
- package/docs/upgrade-v3.md +334 -0
- package/package.json +85 -78
- package/readme.json +2 -2
- package/dist/e2e-test-utils.cjs +0 -166
- package/dist/engine/compile.cjs +0 -130
- package/dist/engine/runtime.cjs +0 -475
- package/dist/registry.cjs +0 -423
- package/dist/resolve.cjs +0 -71
- package/dist/types.cjs +0 -69
- package/dist/vendors/_shared/attributes.cjs +0 -55
- package/dist/vendors/_shared/google-consent.cjs +0 -69
- package/dist/vendors/_shared/install-builders.cjs +0 -59
- package/dist/vendors/_shared/script-url.cjs +0 -78
- package/dist/vendors/ads-and-pixels/linkedin-insights.cjs +0 -89
- package/dist/vendors/ads-and-pixels/meta-pixel.cjs +0 -206
- package/dist/vendors/ads-and-pixels/microsoft-uet.cjs +0 -151
- package/dist/vendors/ads-and-pixels/reddit-pixel.cjs +0 -151
- package/dist/vendors/ads-and-pixels/snapchat-pixel.cjs +0 -131
- package/dist/vendors/ads-and-pixels/tiktok-pixel.cjs +0 -130
- package/dist/vendors/ads-and-pixels/x-pixel.cjs +0 -92
- package/dist/vendors/analytics/adobe-analytics.cjs +0 -90
- package/dist/vendors/analytics/ahrefs-analytics.cjs +0 -68
- package/dist/vendors/analytics/amplitude.cjs +0 -193
- package/dist/vendors/analytics/clearbit.cjs +0 -69
- package/dist/vendors/analytics/cloudflare-web-analytics.cjs +0 -73
- package/dist/vendors/analytics/databuddy.cjs +0 -144
- package/dist/vendors/analytics/fathom-analytics.cjs +0 -76
- package/dist/vendors/analytics/google-tag.cjs +0 -107
- package/dist/vendors/analytics/heap.cjs +0 -181
- package/dist/vendors/analytics/hightouch.cjs +0 -153
- package/dist/vendors/analytics/hotjar.cjs +0 -85
- package/dist/vendors/analytics/logrocket.cjs +0 -99
- package/dist/vendors/analytics/matomo-analytics.cjs +0 -232
- package/dist/vendors/analytics/microsoft-clarity.cjs +0 -138
- package/dist/vendors/analytics/mixpanel-analytics.cjs +0 -134
- package/dist/vendors/analytics/pirsch.cjs +0 -108
- package/dist/vendors/analytics/plausible-analytics.cjs +0 -122
- package/dist/vendors/analytics/posthog.cjs +0 -236
- package/dist/vendors/analytics/promptwatch.cjs +0 -70
- package/dist/vendors/analytics/rudderstack.cjs +0 -227
- package/dist/vendors/analytics/rybbit-analytics.cjs +0 -104
- package/dist/vendors/analytics/segment.cjs +0 -97
- package/dist/vendors/analytics/umami-analytics.cjs +0 -80
- package/dist/vendors/analytics/vercel-analytics.cjs +0 -94
- package/dist/vendors/functional/crisp.cjs +0 -143
- package/dist/vendors/functional/intercom.cjs +0 -89
- package/dist/vendors/tag-managers/google-tag-manager.cjs +0 -100
- 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
|
|
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
|
-
|
|
27
|
-
|
|
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 {
|
|
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-
|
|
16
|
-
'data-
|
|
17
|
-
}
|
|
12
|
+
'data-api-url': '{{apiUrl}}',
|
|
13
|
+
'data-client-id': '{{clientId}}'
|
|
14
|
+
},
|
|
15
|
+
src: "{{scriptUrl}}",
|
|
16
|
+
type: 'loadScript'
|
|
18
17
|
}
|
|
19
18
|
],
|
|
20
|
-
|
|
19
|
+
onBeforeLoadDenied: [
|
|
21
20
|
{
|
|
22
|
-
|
|
21
|
+
ifUndefined: true,
|
|
23
22
|
name: 'databuddyConfig',
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
type: 'setGlobal',
|
|
24
|
+
value: '{{configWhenDenied}}'
|
|
26
25
|
}
|
|
27
26
|
],
|
|
28
|
-
|
|
27
|
+
onBeforeLoadGranted: [
|
|
29
28
|
{
|
|
30
|
-
|
|
29
|
+
ifUndefined: true,
|
|
31
30
|
name: 'databuddyConfig',
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
type: 'setGlobal',
|
|
32
|
+
value: '{{configWhenGranted}}'
|
|
34
33
|
}
|
|
35
34
|
],
|
|
36
|
-
|
|
35
|
+
onConsentDenied: [
|
|
37
36
|
{
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
|
|
54
|
+
ifUndefined: false,
|
|
61
55
|
name: 'databuddyConfig',
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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 {
|
|
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
|
|
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 {
|
|
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
|
-
|
|
9
|
+
ifUndefined: true,
|
|
13
10
|
name: 'dataLayer',
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
type: 'setGlobal',
|
|
12
|
+
value: []
|
|
16
13
|
},
|
|
17
14
|
{
|
|
18
|
-
|
|
15
|
+
ifUndefined: true,
|
|
19
16
|
name: 'gtag',
|
|
20
17
|
queue: 'dataLayer',
|
|
21
|
-
|
|
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
|
-
|
|
42
|
+
async: true,
|
|
43
43
|
src: 'https://www.googletagmanager.com/gtag/js?id={{id}}',
|
|
44
|
-
|
|
44
|
+
type: 'loadScript'
|
|
45
45
|
}
|
|
46
46
|
],
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
persistAfterConsentRevoked: true,
|
|
48
|
+
vendor: 'gtag'
|
|
49
49
|
};
|
|
50
|
-
function
|
|
50
|
+
const google_tag_gtag = function({ id, category, consentMapping, script }) {
|
|
51
51
|
const manifest = withOptionalConsentMapping(gtagManifest, consentMapping);
|
|
52
52
|
const resolved = resolveManifest(manifest, {
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
|
|
35
|
+
ifUndefined: true,
|
|
37
36
|
name: 'heapReadyCb',
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
type: 'setGlobal',
|
|
38
|
+
value: []
|
|
40
39
|
},
|
|
41
40
|
{
|
|
42
|
-
|
|
41
|
+
ifUndefined: true,
|
|
43
42
|
name: 'heap',
|
|
44
|
-
|
|
45
|
-
|
|
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
|
-
|
|
73
|
-
|
|
71
|
+
methods: [
|
|
72
|
+
...HEAP_QUEUE_METHODS
|
|
73
|
+
],
|
|
74
74
|
queue: {
|
|
75
75
|
global: 'heapReadyCb'
|
|
76
76
|
},
|
|
77
77
|
queueFormat: 'callback',
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
]
|
|
78
|
+
target: 'heap',
|
|
79
|
+
type: 'defineQueueMethods'
|
|
81
80
|
},
|
|
82
81
|
{
|
|
83
|
-
|
|
82
|
+
async: true,
|
|
84
83
|
src: "{{scriptUrl}}",
|
|
85
|
-
|
|
84
|
+
type: 'loadScript'
|
|
86
85
|
}
|
|
87
|
-
]
|
|
86
|
+
],
|
|
87
|
+
vendor: 'heap'
|
|
88
88
|
};
|
|
89
|
-
function
|
|
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
|
|
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 (
|
|
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
|
|
113
|
+
};
|
|
114
|
+
const heap_normalizeClientConfig = function(clientConfig) {
|
|
115
115
|
const config = clientConfig ?? {};
|
|
116
|
-
const normalized =
|
|
117
|
-
if (!
|
|
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
|
|
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
|
|
127
|
-
const normalizedEnvId =
|
|
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
|
-
|
|
131
|
-
scriptUrl: resolveHeapScriptUrl(normalizedEnvId, scriptUrl)
|
|
131
|
+
scriptUrl: heap_resolveHeapScriptUrl(normalizedEnvId, scriptUrl)
|
|
132
132
|
});
|
|
133
|
-
}
|
|
134
|
-
export { DEFAULT_HEAP_CONFIG_BASE_URL, HEAP_QUEUE_METHODS,
|
|
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
|
-
|
|
32
|
+
ifUndefined: true,
|
|
35
33
|
name: 'htevents',
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
78
|
+
async: true,
|
|
80
79
|
src: "{{scriptUrl}}",
|
|
81
|
-
|
|
80
|
+
type: 'loadScript'
|
|
82
81
|
}
|
|
83
|
-
]
|
|
82
|
+
],
|
|
83
|
+
vendor: 'hightouch'
|
|
84
84
|
};
|
|
85
|
-
function
|
|
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
|
|
89
|
+
};
|
|
90
|
+
const hightouch_normalizeApiHost = function(apiHost) {
|
|
91
91
|
return trimToUndefined(apiHost);
|
|
92
|
-
}
|
|
93
|
-
function
|
|
94
|
-
const normalizedWriteKey =
|
|
92
|
+
};
|
|
93
|
+
const hightouch_hightouch = function({ writeKey, apiHost, trackPageView = true, scriptUrl }) {
|
|
94
|
+
const normalizedWriteKey = hightouch_validateWriteKey(writeKey);
|
|
95
95
|
const loadOptions = {
|
|
96
|
-
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
|
-
|
|
106
|
-
|
|
105
|
+
scriptUrl: resolveScriptUrl(trimToUndefined(scriptUrl), DEFAULT_HIGHTOUCH_SCRIPT_URL),
|
|
106
|
+
writeKey: normalizedWriteKey
|
|
107
107
|
});
|
|
108
|
-
}
|
|
109
|
-
export { HIGHTOUCH_QUEUE_METHODS,
|
|
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
|
-
|
|
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
|
-
|
|
18
|
+
ifUndefined: true,
|
|
20
19
|
name: 'hj',
|
|
21
20
|
queue: {
|
|
22
21
|
property: 'q'
|
|
23
22
|
},
|
|
24
23
|
queueFormat: 'array',
|
|
25
|
-
|
|
24
|
+
type: 'defineStubFunction'
|
|
26
25
|
},
|
|
27
26
|
{
|
|
28
|
-
|
|
27
|
+
async: true,
|
|
29
28
|
src: "{{scriptUrl}}",
|
|
30
|
-
|
|
29
|
+
type: 'loadScript'
|
|
31
30
|
}
|
|
32
|
-
]
|
|
31
|
+
],
|
|
32
|
+
vendor: 'hotjar'
|
|
33
33
|
};
|
|
34
|
-
function
|
|
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 {
|
|
43
|
+
};
|
|
44
|
+
export { hotjarManifest, hotjar_hotjar as hotjar };
|