@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
|
@@ -4,37 +4,37 @@ import { booleanDataAttribute } from "../_shared/attributes.js";
|
|
|
4
4
|
import { joinUrlPath } from "../_shared/script-url.js";
|
|
5
5
|
const rybbitAnalyticsManifest = {
|
|
6
6
|
...vendorManifestContract,
|
|
7
|
-
vendor: 'rybbit-analytics',
|
|
8
7
|
category: 'measurement',
|
|
9
8
|
install: [
|
|
10
9
|
{
|
|
11
|
-
type: 'loadScript',
|
|
12
|
-
src: "{{scriptUrl}}",
|
|
13
|
-
defer: true,
|
|
14
10
|
attributes: {
|
|
15
|
-
'data-
|
|
11
|
+
'data-api-key': '{{apiKey}}',
|
|
16
12
|
'data-auto-track-pageview': '{{autoTrackPageview}}',
|
|
17
|
-
'data-
|
|
18
|
-
'data-
|
|
19
|
-
'data-track-outbound': '{{trackOutbound}}',
|
|
20
|
-
'data-track-errors': '{{trackErrors}}',
|
|
13
|
+
'data-debounce': '{{debounce}}',
|
|
14
|
+
'data-mask-patterns': '{{maskPatterns}}',
|
|
21
15
|
'data-session-replay': '{{sessionReplay}}',
|
|
22
|
-
'data-
|
|
16
|
+
'data-site-id': '{{siteId}}',
|
|
23
17
|
'data-skip-patterns': '{{skipPatterns}}',
|
|
24
|
-
'data-
|
|
25
|
-
'data-
|
|
26
|
-
'data-
|
|
27
|
-
|
|
18
|
+
'data-track-errors': '{{trackErrors}}',
|
|
19
|
+
'data-track-outbound': '{{trackOutbound}}',
|
|
20
|
+
'data-track-query': '{{trackQuery}}',
|
|
21
|
+
'data-track-spa': '{{trackSpa}}',
|
|
22
|
+
'data-web-vitals': '{{webVitals}}'
|
|
23
|
+
},
|
|
24
|
+
defer: true,
|
|
25
|
+
src: "{{scriptUrl}}",
|
|
26
|
+
type: 'loadScript'
|
|
28
27
|
}
|
|
29
|
-
]
|
|
28
|
+
],
|
|
29
|
+
vendor: 'rybbit-analytics'
|
|
30
30
|
};
|
|
31
|
-
function
|
|
31
|
+
const rybbit_analytics_getRybbitScriptUrl = function(options) {
|
|
32
32
|
const url = options.scriptUrl?.trim();
|
|
33
33
|
if (url && url.length > 0) return url;
|
|
34
34
|
if (options.analyticsHost) return joinUrlPath(options.analyticsHost, "script.js");
|
|
35
35
|
return "https://app.rybbit.io/api/script.js";
|
|
36
|
-
}
|
|
37
|
-
function
|
|
36
|
+
};
|
|
37
|
+
const rybbit_analytics_rybbitAnalytics = function(options) {
|
|
38
38
|
let siteId;
|
|
39
39
|
siteId = void 0 === options.siteId || null === options.siteId ? '' : String(options.siteId).trim();
|
|
40
40
|
if (0 === siteId.length) throw new Error('rybbitAnalytics: missing siteId');
|
|
@@ -45,19 +45,19 @@ function rybbitAnalytics(options) {
|
|
|
45
45
|
let maskPatterns;
|
|
46
46
|
if (options.maskPatterns) maskPatterns = JSON.stringify(options.maskPatterns);
|
|
47
47
|
return resolveManifest(rybbitAnalyticsManifest, {
|
|
48
|
-
|
|
49
|
-
siteId,
|
|
48
|
+
apiKey: options.apiKey,
|
|
50
49
|
autoTrackPageview: booleanDataAttribute(options.autoTrackPageview),
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
trackErrors: booleanDataAttribute(options.trackErrors),
|
|
50
|
+
debounce,
|
|
51
|
+
maskPatterns,
|
|
52
|
+
scriptUrl: rybbit_analytics_getRybbitScriptUrl(options),
|
|
55
53
|
sessionReplay: booleanDataAttribute(options.sessionReplay),
|
|
56
|
-
|
|
54
|
+
siteId,
|
|
57
55
|
skipPatterns,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
trackErrors: booleanDataAttribute(options.trackErrors),
|
|
57
|
+
trackOutbound: booleanDataAttribute(options.trackOutbound),
|
|
58
|
+
trackQuery: booleanDataAttribute(options.trackQuery),
|
|
59
|
+
trackSpa: booleanDataAttribute(options.trackSpa),
|
|
60
|
+
webVitals: booleanDataAttribute(options.webVitals)
|
|
61
61
|
});
|
|
62
|
-
}
|
|
63
|
-
export {
|
|
62
|
+
};
|
|
63
|
+
export { rybbitAnalyticsManifest, rybbit_analytics_rybbitAnalytics as rybbitAnalytics };
|
|
@@ -3,18 +3,14 @@ import { vendorManifestContract } from "../../types.js";
|
|
|
3
3
|
import { resolveScriptUrl } from "../_shared/script-url.js";
|
|
4
4
|
const segmentManifest = {
|
|
5
5
|
...vendorManifestContract,
|
|
6
|
-
vendor: 'segment',
|
|
7
|
-
category: 'measurement',
|
|
8
6
|
bootstrap: [
|
|
9
7
|
{
|
|
10
|
-
|
|
8
|
+
ifUndefined: true,
|
|
11
9
|
name: 'analytics',
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
type: 'setGlobal',
|
|
11
|
+
value: []
|
|
14
12
|
},
|
|
15
13
|
{
|
|
16
|
-
type: 'defineQueueMethods',
|
|
17
|
-
target: 'analytics',
|
|
18
14
|
methods: [
|
|
19
15
|
'track',
|
|
20
16
|
'page',
|
|
@@ -22,23 +18,27 @@ const segmentManifest = {
|
|
|
22
18
|
'group',
|
|
23
19
|
'alias',
|
|
24
20
|
'reset'
|
|
25
|
-
]
|
|
21
|
+
],
|
|
22
|
+
target: 'analytics',
|
|
23
|
+
type: 'defineQueueMethods'
|
|
26
24
|
}
|
|
27
25
|
],
|
|
26
|
+
category: 'measurement',
|
|
28
27
|
install: [
|
|
29
28
|
{
|
|
30
|
-
type: 'callGlobal',
|
|
31
29
|
global: 'analytics',
|
|
32
|
-
method: 'page'
|
|
30
|
+
method: 'page',
|
|
31
|
+
type: 'callGlobal'
|
|
33
32
|
},
|
|
34
33
|
{
|
|
35
|
-
|
|
34
|
+
async: true,
|
|
36
35
|
src: "{{scriptUrl}}",
|
|
37
|
-
|
|
36
|
+
type: 'loadScript'
|
|
38
37
|
}
|
|
39
|
-
]
|
|
38
|
+
],
|
|
39
|
+
vendor: 'segment'
|
|
40
40
|
};
|
|
41
|
-
function
|
|
41
|
+
const segment_segment = function({ writeKey, trackPageView = true, scriptUrl }) {
|
|
42
42
|
let normalizedWriteKey = '';
|
|
43
43
|
if ('string' == typeof writeKey) normalizedWriteKey = writeKey.trim();
|
|
44
44
|
if (0 === normalizedWriteKey.length) throw new Error('segment: missing or invalid writeKey');
|
|
@@ -52,5 +52,5 @@ function segment({ writeKey, trackPageView = true, scriptUrl }) {
|
|
|
52
52
|
return resolveManifest(manifest, {
|
|
53
53
|
scriptUrl: resolveScriptUrl(scriptUrl, defaultScriptUrl)
|
|
54
54
|
});
|
|
55
|
-
}
|
|
56
|
-
export {
|
|
55
|
+
};
|
|
56
|
+
export { segmentManifest, segment_segment as segment };
|
|
@@ -4,36 +4,36 @@ import { booleanDataAttribute, listDataAttribute } from "../_shared/attributes.j
|
|
|
4
4
|
import { resolveScriptUrl } from "../_shared/script-url.js";
|
|
5
5
|
const umamiAnalyticsManifest = {
|
|
6
6
|
...vendorManifestContract,
|
|
7
|
-
vendor: 'umami-analytics',
|
|
8
7
|
category: 'measurement',
|
|
9
8
|
install: [
|
|
10
9
|
{
|
|
11
|
-
type: 'loadScript',
|
|
12
|
-
src: "{{scriptUrl}}",
|
|
13
|
-
defer: true,
|
|
14
10
|
attributes: {
|
|
15
|
-
'data-website-id': '{{websiteId}}',
|
|
16
|
-
'data-host-url': '{{hostUrl}}',
|
|
17
11
|
'data-auto-track': '{{autoTrackAttribute}}',
|
|
12
|
+
'data-before-send': '{{beforeSend}}',
|
|
18
13
|
'data-domains': '{{domains}}',
|
|
14
|
+
'data-host-url': '{{hostUrl}}',
|
|
19
15
|
'data-tag': '{{tag}}',
|
|
20
|
-
'data-
|
|
21
|
-
}
|
|
16
|
+
'data-website-id': '{{websiteId}}'
|
|
17
|
+
},
|
|
18
|
+
defer: true,
|
|
19
|
+
src: "{{scriptUrl}}",
|
|
20
|
+
type: 'loadScript'
|
|
22
21
|
}
|
|
23
|
-
]
|
|
22
|
+
],
|
|
23
|
+
vendor: 'umami-analytics'
|
|
24
24
|
};
|
|
25
|
-
function
|
|
25
|
+
const umami_analytics_umamiAnalytics = function(options) {
|
|
26
26
|
const websiteId = options.websiteId.trim();
|
|
27
27
|
if (0 === websiteId.length) throw new Error('umamiAnalytics: invalid websiteId - must be a non-empty string');
|
|
28
28
|
const resolved = resolveManifest(umamiAnalyticsManifest, {
|
|
29
|
-
websiteId,
|
|
30
|
-
hostUrl: options.hostUrl,
|
|
31
29
|
autoTrackAttribute: booleanDataAttribute(options.autoTrack),
|
|
30
|
+
beforeSend: options.beforeSend,
|
|
32
31
|
domains: listDataAttribute(options.domains),
|
|
32
|
+
hostUrl: options.hostUrl,
|
|
33
|
+
scriptUrl: resolveScriptUrl(options.scriptUrl, "https://cloud.umami.is/script.js"),
|
|
33
34
|
tag: options.tag,
|
|
34
|
-
|
|
35
|
-
scriptUrl: resolveScriptUrl(options.scriptUrl, "https://cloud.umami.is/script.js")
|
|
35
|
+
websiteId
|
|
36
36
|
});
|
|
37
37
|
return resolved;
|
|
38
|
-
}
|
|
39
|
-
export {
|
|
38
|
+
};
|
|
39
|
+
export { umamiAnalyticsManifest, umami_analytics_umamiAnalytics as umamiAnalytics };
|
|
@@ -2,52 +2,52 @@ import { resolveManifest } from "../../resolve.js";
|
|
|
2
2
|
import { vendorManifestContract } from "../../types.js";
|
|
3
3
|
const vercelAnalyticsManifest = {
|
|
4
4
|
...vendorManifestContract,
|
|
5
|
-
vendor: 'vercel-analytics',
|
|
6
|
-
category: 'measurement',
|
|
7
5
|
bootstrap: [
|
|
8
6
|
{
|
|
9
|
-
|
|
7
|
+
ifUndefined: true,
|
|
10
8
|
name: 'vaq',
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
type: 'setGlobal',
|
|
10
|
+
value: []
|
|
13
11
|
},
|
|
14
12
|
{
|
|
15
|
-
|
|
13
|
+
ifUndefined: true,
|
|
16
14
|
name: 'va',
|
|
17
15
|
queue: {
|
|
18
16
|
global: 'vaq'
|
|
19
17
|
},
|
|
20
18
|
queueFormat: 'array',
|
|
21
|
-
|
|
19
|
+
type: 'defineStubFunction'
|
|
22
20
|
}
|
|
23
21
|
],
|
|
22
|
+
category: 'measurement',
|
|
24
23
|
install: [
|
|
25
24
|
{
|
|
26
|
-
type: 'loadScript',
|
|
27
|
-
src: "{{scriptUrl}}",
|
|
28
|
-
defer: true,
|
|
29
25
|
attributes: {
|
|
30
|
-
'data-sdkn': 'c15t',
|
|
31
|
-
'data-dsn': '{{dsn}}',
|
|
32
26
|
'data-disable-auto-track': '{{disableAutoTrackAttribute}}',
|
|
33
|
-
'data-
|
|
34
|
-
|
|
27
|
+
'data-dsn': '{{dsn}}',
|
|
28
|
+
'data-endpoint': '{{endpoint}}',
|
|
29
|
+
'data-sdkn': 'c15t'
|
|
30
|
+
},
|
|
31
|
+
defer: true,
|
|
32
|
+
src: "{{scriptUrl}}",
|
|
33
|
+
type: 'loadScript'
|
|
35
34
|
}
|
|
36
|
-
]
|
|
35
|
+
],
|
|
36
|
+
vendor: 'vercel-analytics'
|
|
37
37
|
};
|
|
38
|
-
function
|
|
38
|
+
const vercel_analytics_getVercelScriptUrl = function(options) {
|
|
39
39
|
if (options.scriptUrl) return options.scriptUrl;
|
|
40
40
|
if ('development' === options.mode || options.debug) return "https://va.vercel-scripts.com/v1/script.debug.js";
|
|
41
41
|
return "https://va.vercel-scripts.com/v1/script.js";
|
|
42
|
-
}
|
|
43
|
-
function
|
|
42
|
+
};
|
|
43
|
+
const vercel_analytics_vercelAnalytics = function(options = {}) {
|
|
44
44
|
let disableAutoTrackAttribute;
|
|
45
45
|
if (options.disableAutoTrack) disableAutoTrackAttribute = '1';
|
|
46
46
|
return resolveManifest(vercelAnalyticsManifest, {
|
|
47
|
-
|
|
47
|
+
disableAutoTrackAttribute,
|
|
48
48
|
dsn: options.dsn,
|
|
49
49
|
endpoint: options.endpoint,
|
|
50
|
-
|
|
50
|
+
scriptUrl: vercel_analytics_getVercelScriptUrl(options)
|
|
51
51
|
});
|
|
52
|
-
}
|
|
53
|
-
export {
|
|
52
|
+
};
|
|
53
|
+
export { vercelAnalyticsManifest, vercel_analytics_vercelAnalytics as vercelAnalytics };
|
|
@@ -2,101 +2,99 @@ import { resolveManifest } from "../../resolve.js";
|
|
|
2
2
|
import { vendorManifestContract } from "../../types.js";
|
|
3
3
|
const crispManifest = {
|
|
4
4
|
...vendorManifestContract,
|
|
5
|
-
vendor: 'crisp',
|
|
6
5
|
category: 'functionality',
|
|
7
6
|
install: [
|
|
8
7
|
{
|
|
9
|
-
|
|
8
|
+
ifUndefined: false,
|
|
10
9
|
name: '$crisp',
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
type: 'setGlobal',
|
|
11
|
+
value: []
|
|
13
12
|
},
|
|
14
13
|
{
|
|
15
|
-
|
|
14
|
+
ifUndefined: false,
|
|
16
15
|
name: 'CRISP_WEBSITE_ID',
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
type: 'setGlobal',
|
|
17
|
+
value: '{{websiteId}}'
|
|
19
18
|
},
|
|
20
19
|
{
|
|
21
|
-
|
|
20
|
+
async: true,
|
|
22
21
|
src: "{{scriptSrc}}",
|
|
23
|
-
|
|
22
|
+
type: 'loadScript'
|
|
24
23
|
}
|
|
25
|
-
]
|
|
24
|
+
],
|
|
25
|
+
vendor: 'crisp'
|
|
26
26
|
};
|
|
27
|
-
function
|
|
27
|
+
const crisp_createCrispManifest = function(options) {
|
|
28
28
|
const install = [
|
|
29
29
|
{
|
|
30
|
-
|
|
30
|
+
ifUndefined: false,
|
|
31
31
|
name: '$crisp',
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
type: 'setGlobal',
|
|
33
|
+
value: []
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
|
-
|
|
36
|
+
ifUndefined: false,
|
|
37
37
|
name: 'CRISP_WEBSITE_ID',
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
type: 'setGlobal',
|
|
39
|
+
value: '{{websiteId}}'
|
|
40
40
|
}
|
|
41
41
|
];
|
|
42
|
-
if (void 0 !== options.locale || void 0 !== options.sessionMerge)
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
value
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
ifUndefined: false
|
|
54
|
-
});
|
|
42
|
+
if (void 0 !== options.locale || void 0 !== options.sessionMerge) {
|
|
43
|
+
const value = {};
|
|
44
|
+
if (void 0 !== options.locale) value.locale = '{{locale}}';
|
|
45
|
+
if (void 0 !== options.sessionMerge) value.session_merge = '{{sessionMerge}}';
|
|
46
|
+
install.push({
|
|
47
|
+
ifUndefined: false,
|
|
48
|
+
name: 'CRISP_RUNTIME_CONFIG',
|
|
49
|
+
type: 'setGlobal',
|
|
50
|
+
value
|
|
51
|
+
});
|
|
52
|
+
}
|
|
55
53
|
if (options.cookieDomain) install.push({
|
|
56
|
-
|
|
54
|
+
ifUndefined: false,
|
|
57
55
|
name: 'CRISP_COOKIE_DOMAIN',
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
type: 'setGlobal',
|
|
57
|
+
value: '{{cookieDomain}}'
|
|
60
58
|
});
|
|
61
59
|
if (void 0 !== options.cookieExpiry) install.push({
|
|
62
|
-
|
|
60
|
+
ifUndefined: false,
|
|
63
61
|
name: 'CRISP_COOKIE_EXPIRE',
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
type: 'setGlobal',
|
|
63
|
+
value: '{{cookieExpiry}}'
|
|
66
64
|
});
|
|
67
65
|
if (options.tokenId) install.push({
|
|
68
|
-
|
|
66
|
+
ifUndefined: false,
|
|
69
67
|
name: 'CRISP_TOKEN_ID',
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
type: 'setGlobal',
|
|
69
|
+
value: '{{tokenId}}'
|
|
72
70
|
});
|
|
73
71
|
if (options.safeMode) install.push({
|
|
74
|
-
type: 'pushToQueue',
|
|
75
72
|
queue: '$crisp',
|
|
73
|
+
type: 'pushToQueue',
|
|
76
74
|
value: [
|
|
77
75
|
'safe',
|
|
78
76
|
true
|
|
79
77
|
]
|
|
80
78
|
});
|
|
81
79
|
install.push({
|
|
82
|
-
|
|
80
|
+
async: true,
|
|
83
81
|
src: "{{scriptSrc}}",
|
|
84
|
-
|
|
82
|
+
type: 'loadScript'
|
|
85
83
|
});
|
|
86
84
|
return {
|
|
87
85
|
...crispManifest,
|
|
88
86
|
install
|
|
89
87
|
};
|
|
90
|
-
}
|
|
91
|
-
function
|
|
92
|
-
return resolveManifest(
|
|
93
|
-
websiteId: options.websiteId,
|
|
94
|
-
locale: options.locale,
|
|
88
|
+
};
|
|
89
|
+
const crisp_crisp = function(options) {
|
|
90
|
+
return resolveManifest(crisp_createCrispManifest(options), {
|
|
95
91
|
cookieDomain: options.cookieDomain,
|
|
96
92
|
cookieExpiry: options.cookieExpiry,
|
|
97
|
-
|
|
93
|
+
locale: options.locale,
|
|
94
|
+
scriptSrc: options.scriptSrc ?? 'https://client.crisp.chat/l.js',
|
|
98
95
|
sessionMerge: options.sessionMerge,
|
|
99
|
-
|
|
96
|
+
tokenId: options.tokenId,
|
|
97
|
+
websiteId: options.websiteId
|
|
100
98
|
});
|
|
101
|
-
}
|
|
102
|
-
export {
|
|
99
|
+
};
|
|
100
|
+
export { crispManifest, crisp_crisp as crisp };
|
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
import { resolveManifest } from "../../resolve.js";
|
|
2
2
|
import { vendorManifestContract } from "../../types.js";
|
|
3
3
|
const INTERCOM_API_BASES = {
|
|
4
|
-
|
|
4
|
+
au: 'https://api-iam.au.intercom.io',
|
|
5
5
|
eu: 'https://api-iam.eu.intercom.io',
|
|
6
|
-
|
|
6
|
+
us: 'https://api-iam.intercom.io'
|
|
7
7
|
};
|
|
8
8
|
const intercomManifest = {
|
|
9
9
|
...vendorManifestContract,
|
|
10
|
-
vendor: 'intercom',
|
|
11
10
|
category: 'functionality',
|
|
12
11
|
install: [
|
|
13
12
|
{
|
|
14
|
-
|
|
13
|
+
ifUndefined: true,
|
|
15
14
|
name: 'Intercom',
|
|
16
15
|
queue: {
|
|
17
16
|
property: 'q'
|
|
18
17
|
},
|
|
19
18
|
queueFormat: 'array',
|
|
20
|
-
|
|
19
|
+
type: 'defineStubFunction'
|
|
21
20
|
},
|
|
22
21
|
{
|
|
23
|
-
|
|
22
|
+
ifUndefined: false,
|
|
24
23
|
name: 'intercomSettings',
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
type: 'setGlobal',
|
|
25
|
+
value: '{{settings}}'
|
|
27
26
|
},
|
|
28
27
|
{
|
|
29
|
-
|
|
28
|
+
async: true,
|
|
30
29
|
src: "{{scriptSrc}}",
|
|
31
|
-
|
|
30
|
+
type: 'loadScript'
|
|
32
31
|
}
|
|
33
|
-
]
|
|
32
|
+
],
|
|
33
|
+
vendor: 'intercom'
|
|
34
34
|
};
|
|
35
|
-
function
|
|
35
|
+
const intercom_intercom = function({ appId, apiBase = INTERCOM_API_BASES.us, settings, scriptSrc }) {
|
|
36
36
|
return resolveManifest(intercomManifest, {
|
|
37
|
+
scriptSrc: scriptSrc ?? `https://widget.intercom.io/widget/${appId}`,
|
|
37
38
|
settings: {
|
|
38
39
|
...settings ?? {},
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
scriptSrc: scriptSrc ?? `https://widget.intercom.io/widget/${appId}`
|
|
40
|
+
api_base: apiBase,
|
|
41
|
+
app_id: appId
|
|
42
|
+
}
|
|
43
43
|
});
|
|
44
|
-
}
|
|
45
|
-
export { INTERCOM_API_BASES,
|
|
44
|
+
};
|
|
45
|
+
export { INTERCOM_API_BASES, intercomManifest, intercom_intercom as intercom };
|
|
@@ -3,57 +3,57 @@ import { runtimeTimestampValue, vendorManifestContract } from "../../types.js";
|
|
|
3
3
|
import { GOOGLE_CONSENT_MODE_V2_DEFAULT_MAPPING, withOptionalConsentMapping } from "../_shared/google-consent.js";
|
|
4
4
|
const googleTagManagerManifest = {
|
|
5
5
|
...vendorManifestContract,
|
|
6
|
-
vendor: 'google-tag-manager',
|
|
7
|
-
category: 'necessary',
|
|
8
6
|
alwaysLoad: true,
|
|
9
7
|
bootstrap: [
|
|
10
8
|
{
|
|
11
|
-
|
|
9
|
+
ifUndefined: true,
|
|
12
10
|
name: 'dataLayer',
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
type: 'setGlobal',
|
|
12
|
+
value: []
|
|
15
13
|
},
|
|
16
14
|
{
|
|
17
|
-
|
|
15
|
+
ifUndefined: true,
|
|
18
16
|
name: 'gtag',
|
|
19
17
|
queue: 'dataLayer',
|
|
20
|
-
|
|
18
|
+
type: 'defineQueueFunction'
|
|
21
19
|
}
|
|
22
20
|
],
|
|
21
|
+
category: 'necessary',
|
|
22
|
+
consentMapping: GOOGLE_CONSENT_MODE_V2_DEFAULT_MAPPING,
|
|
23
|
+
consentSignal: 'gtag',
|
|
23
24
|
install: [
|
|
24
25
|
{
|
|
25
|
-
type: 'pushToQueue',
|
|
26
26
|
queue: 'dataLayer',
|
|
27
|
+
type: 'pushToQueue',
|
|
27
28
|
value: {
|
|
28
|
-
'gtm.
|
|
29
|
-
|
|
29
|
+
event: 'gtm.js',
|
|
30
|
+
'gtm.start': runtimeTimestampValue
|
|
30
31
|
}
|
|
31
32
|
},
|
|
32
33
|
{
|
|
33
|
-
|
|
34
|
+
async: true,
|
|
34
35
|
src: 'https://www.googletagmanager.com/gtm.js?id={{id}}',
|
|
35
|
-
|
|
36
|
+
type: 'loadScript'
|
|
36
37
|
}
|
|
37
38
|
],
|
|
38
39
|
onConsentChange: [
|
|
39
40
|
{
|
|
40
|
-
type: 'callGlobal',
|
|
41
|
-
global: 'gtag',
|
|
42
41
|
args: [
|
|
43
42
|
'event',
|
|
44
43
|
'{{updateEventName}}'
|
|
45
|
-
]
|
|
44
|
+
],
|
|
45
|
+
global: 'gtag',
|
|
46
|
+
type: 'callGlobal'
|
|
46
47
|
}
|
|
47
48
|
],
|
|
48
|
-
|
|
49
|
-
consentSignal: 'gtag'
|
|
49
|
+
vendor: 'google-tag-manager'
|
|
50
50
|
};
|
|
51
|
-
function
|
|
51
|
+
const google_tag_manager_googleTagManager = function({ id, updateEventName, consentMapping }) {
|
|
52
52
|
const manifest = withOptionalConsentMapping(googleTagManagerManifest, consentMapping);
|
|
53
53
|
const resolved = resolveManifest(manifest, {
|
|
54
54
|
id,
|
|
55
55
|
updateEventName: updateEventName ?? 'consent-update'
|
|
56
56
|
});
|
|
57
57
|
return resolved;
|
|
58
|
-
}
|
|
59
|
-
export {
|
|
58
|
+
};
|
|
59
|
+
export { googleTagManagerManifest, google_tag_manager_googleTagManager as googleTagManager };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ConsentState, Script, ScriptCallbackInfo } from 'c15t';
|
|
2
|
-
import {
|
|
1
|
+
import type { ConsentState, Script, ScriptCallbackInfo } from '@c15t/core';
|
|
2
|
+
import type { BuiltInScriptIntegrationKey } from '../registry';
|
|
3
3
|
/**
|
|
4
4
|
* Typed view of `globalThis` used by script helper tests.
|
|
5
5
|
*
|
|
@@ -59,9 +59,9 @@ export type CallbackInfoOverrides = Partial<ScriptCallbackInfo> & Pick<ScriptCal
|
|
|
59
59
|
* Defaults model a denied-consent callback for the same DOM element ID as the
|
|
60
60
|
* script ID, while allowing individual tests to override the relevant fields.
|
|
61
61
|
*/
|
|
62
|
-
export declare
|
|
62
|
+
export declare const createCallbackInfo: (overrides: CallbackInfoOverrides) => ScriptCallbackInfo;
|
|
63
63
|
export type LifecycleCallbackOverrides = Partial<Omit<ScriptCallbackInfo, 'id'>>;
|
|
64
|
-
export declare
|
|
64
|
+
export declare const runOnBeforeLoad: (script: Pick<Script, 'id' | 'onBeforeLoad'>, overrides?: LifecycleCallbackOverrides) => void;
|
|
65
65
|
/**
|
|
66
66
|
* Returns a mutable test-friendly reference to the global object.
|
|
67
67
|
*
|
|
@@ -73,7 +73,7 @@ export declare function runOnBeforeLoad(script: Pick<Script, 'id' | 'onBeforeLoa
|
|
|
73
73
|
* globalRef.dataLayer = [];
|
|
74
74
|
* ```
|
|
75
75
|
*/
|
|
76
|
-
export declare
|
|
76
|
+
export declare const getTestGlobal: () => TestGlobal;
|
|
77
77
|
/**
|
|
78
78
|
* Registers browser-like setup and teardown hooks for script helper tests.
|
|
79
79
|
*
|
|
@@ -90,7 +90,7 @@ export declare function getTestGlobal(): TestGlobal;
|
|
|
90
90
|
* });
|
|
91
91
|
* ```
|
|
92
92
|
*/
|
|
93
|
-
export declare
|
|
93
|
+
export declare const setupScriptHelperTest: () => void;
|
|
94
94
|
/**
|
|
95
95
|
* Asserts that a helper-generated script matches registry metadata and
|
|
96
96
|
* expected script fields.
|
|
@@ -117,7 +117,7 @@ export declare function setupScriptHelperTest(): void;
|
|
|
117
117
|
* );
|
|
118
118
|
* ```
|
|
119
119
|
*/
|
|
120
|
-
export declare
|
|
120
|
+
export declare const expectScriptMatchesIntegration: (key: BuiltInScriptIntegrationKey, script: HelperScriptSnapshot, expected: ExpectedScriptSnapshot) => void;
|
|
121
121
|
/**
|
|
122
122
|
* Converts an array-like value into a plain array.
|
|
123
123
|
*
|
|
@@ -136,6 +136,6 @@ export declare function expectScriptMatchesIntegration(key: BuiltInScriptIntegra
|
|
|
136
136
|
* }
|
|
137
137
|
* ```
|
|
138
138
|
*/
|
|
139
|
-
export declare
|
|
140
|
-
export declare
|
|
141
|
-
export declare
|
|
139
|
+
export declare const toArgumentsArray: (value: unknown) => unknown[];
|
|
140
|
+
export declare const expectGoogleConsentDefault: (entry: unknown) => void;
|
|
141
|
+
export declare const expectStubCommandQueue: (stub: unknown, queueKey: string, commands: unknown[][]) => void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ResolvedManifest, VendorManifest } from '../types';
|
|
2
|
-
export declare
|
|
3
|
-
export declare
|
|
2
|
+
export declare const interpolateValue: (value: unknown, config: Record<string, unknown>) => unknown;
|
|
3
|
+
export declare const compileManifest: (manifest: VendorManifest, config?: Record<string, unknown>) => ResolvedManifest;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export declare
|
|
1
|
+
import type { Script } from '@c15t/core';
|
|
2
|
+
import type { ResolvedManifest } from '../types';
|
|
3
|
+
export declare const resolvedManifestToScript: (resolvedManifest: ResolvedManifest) => Script;
|