@c15t/scripts 2.0.1 → 2.1.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/README.md +9 -9
- package/dist/engine/runtime.cjs +11 -0
- package/dist/engine/runtime.js +11 -0
- package/dist/registry.cjs +338 -0
- package/dist/registry.js +292 -0
- package/dist/types.cjs +18 -0
- package/dist/types.js +10 -1
- package/dist/vendors/_shared/attributes.cjs +51 -0
- package/dist/vendors/_shared/attributes.js +14 -0
- package/dist/vendors/_shared/google-consent.cjs +64 -0
- package/dist/vendors/_shared/google-consent.js +27 -0
- package/dist/vendors/_shared/install-builders.cjs +55 -0
- package/dist/vendors/_shared/install-builders.js +21 -0
- package/dist/vendors/_shared/script-url.cjs +74 -0
- package/dist/vendors/_shared/script-url.js +28 -0
- package/dist/{linkedin-insights.cjs → vendors/ads-and-pixels/linkedin-insights.cjs} +2 -2
- package/dist/{linkedin-insights.js → vendors/ads-and-pixels/linkedin-insights.js} +2 -2
- package/dist/vendors/ads-and-pixels/meta-pixel.cjs +202 -0
- package/dist/vendors/ads-and-pixels/meta-pixel.js +153 -0
- package/dist/{microsoft-uet.cjs → vendors/ads-and-pixels/microsoft-uet.cjs} +31 -14
- package/dist/{microsoft-uet.js → vendors/ads-and-pixels/microsoft-uet.js} +31 -14
- package/dist/vendors/ads-and-pixels/reddit-pixel.cjs +147 -0
- package/dist/vendors/ads-and-pixels/reddit-pixel.js +107 -0
- package/dist/vendors/ads-and-pixels/snapchat-pixel.cjs +127 -0
- package/dist/vendors/ads-and-pixels/snapchat-pixel.js +87 -0
- package/dist/{tiktok-pixel.cjs → vendors/ads-and-pixels/tiktok-pixel.cjs} +2 -2
- package/dist/{tiktok-pixel.js → vendors/ads-and-pixels/tiktok-pixel.js} +2 -2
- package/dist/{x-pixel.cjs → vendors/ads-and-pixels/x-pixel.cjs} +6 -3
- package/dist/{x-pixel.js → vendors/ads-and-pixels/x-pixel.js} +6 -3
- package/dist/vendors/analytics/ahrefs-analytics.cjs +64 -0
- package/dist/vendors/analytics/ahrefs-analytics.js +27 -0
- package/dist/vendors/analytics/cloudflare-web-analytics.cjs +69 -0
- package/dist/vendors/analytics/cloudflare-web-analytics.js +32 -0
- package/dist/{databuddy.cjs → vendors/analytics/databuddy.cjs} +3 -3
- package/dist/{databuddy.js → vendors/analytics/databuddy.js} +3 -3
- package/dist/vendors/analytics/fathom-analytics.cjs +72 -0
- package/dist/vendors/analytics/fathom-analytics.js +35 -0
- package/dist/{google-tag.cjs → vendors/analytics/google-tag.cjs} +7 -28
- package/dist/{google-tag.js → vendors/analytics/google-tag.js} +7 -28
- package/dist/vendors/analytics/hotjar.cjs +81 -0
- package/dist/vendors/analytics/hotjar.js +44 -0
- package/dist/vendors/analytics/matomo-analytics.cjs +228 -0
- package/dist/vendors/analytics/matomo-analytics.js +191 -0
- package/dist/vendors/analytics/microsoft-clarity.cjs +110 -0
- package/dist/vendors/analytics/microsoft-clarity.js +73 -0
- package/dist/vendors/analytics/mixpanel-analytics.cjs +119 -0
- package/dist/vendors/analytics/mixpanel-analytics.js +82 -0
- package/dist/vendors/analytics/plausible-analytics.cjs +118 -0
- package/dist/vendors/analytics/plausible-analytics.js +81 -0
- package/dist/{posthog.cjs → vendors/analytics/posthog.cjs} +69 -6
- package/dist/vendors/analytics/posthog.js +163 -0
- package/dist/vendors/analytics/promptwatch.cjs +66 -0
- package/dist/vendors/analytics/promptwatch.js +29 -0
- package/dist/vendors/analytics/rybbit-analytics.cjs +100 -0
- package/dist/vendors/analytics/rybbit-analytics.js +63 -0
- package/dist/vendors/analytics/segment.cjs +93 -0
- package/dist/vendors/analytics/segment.js +56 -0
- package/dist/vendors/analytics/umami-analytics.cjs +76 -0
- package/dist/vendors/analytics/umami-analytics.js +39 -0
- package/dist/vendors/analytics/vercel-analytics.cjs +90 -0
- package/dist/vendors/analytics/vercel-analytics.js +53 -0
- package/dist/vendors/functional/crisp.cjs +139 -0
- package/dist/vendors/functional/crisp.js +102 -0
- package/dist/vendors/functional/intercom.cjs +85 -0
- package/dist/vendors/functional/intercom.js +45 -0
- package/dist/{google-tag-manager.cjs → vendors/tag-managers/google-tag-manager.cjs} +6 -27
- package/dist/{google-tag-manager.js → vendors/tag-managers/google-tag-manager.js} +6 -27
- package/dist-types/__tests__/helpers.d.ts +141 -0
- package/dist-types/engine/runtime.d.ts +1 -1
- package/dist-types/registry.d.ts +368 -0
- package/dist-types/types.d.ts +13 -0
- package/dist-types/vendors/_shared/attributes.d.ts +35 -0
- package/dist-types/vendors/_shared/google-consent.d.ts +47 -0
- package/dist-types/vendors/_shared/install-builders.d.ts +30 -0
- package/dist-types/vendors/_shared/script-url.d.ts +75 -0
- package/dist-types/{linkedin-insights.d.ts → vendors/ads-and-pixels/linkedin-insights.d.ts} +22 -9
- package/dist-types/vendors/ads-and-pixels/meta-pixel.d.ts +289 -0
- package/dist-types/{microsoft-uet.d.ts → vendors/ads-and-pixels/microsoft-uet.d.ts} +21 -10
- package/dist-types/vendors/ads-and-pixels/reddit-pixel.d.ts +211 -0
- package/dist-types/vendors/ads-and-pixels/snapchat-pixel.d.ts +171 -0
- package/dist-types/{tiktok-pixel.d.ts → vendors/ads-and-pixels/tiktok-pixel.d.ts} +20 -5
- package/dist-types/{x-pixel.d.ts → vendors/ads-and-pixels/x-pixel.d.ts} +21 -4
- package/dist-types/vendors/analytics/ahrefs-analytics.d.ts +62 -0
- package/dist-types/vendors/analytics/cloudflare-web-analytics.d.ts +67 -0
- package/dist-types/vendors/analytics/fathom-analytics.d.ts +90 -0
- package/dist-types/{google-tag.d.ts → vendors/analytics/google-tag.d.ts} +5 -8
- package/dist-types/vendors/analytics/hotjar.d.ts +73 -0
- package/dist-types/vendors/analytics/matomo-analytics.d.ts +41 -0
- package/dist-types/vendors/analytics/microsoft-clarity.d.ts +86 -0
- package/dist-types/vendors/analytics/mixpanel-analytics.d.ts +101 -0
- package/dist-types/vendors/analytics/plausible-analytics.d.ts +122 -0
- package/dist-types/{posthog.d.ts → vendors/analytics/posthog.d.ts} +47 -5
- package/dist-types/vendors/analytics/promptwatch.d.ts +36 -0
- package/dist-types/vendors/analytics/rybbit-analytics.d.ts +82 -0
- package/dist-types/vendors/analytics/segment.d.ts +158 -0
- package/dist-types/vendors/analytics/umami-analytics.d.ts +93 -0
- package/dist-types/vendors/analytics/vercel-analytics.d.ts +66 -0
- package/dist-types/vendors/functional/crisp.d.ts +78 -0
- package/dist-types/vendors/functional/intercom.d.ts +135 -0
- package/dist-types/{google-tag-manager.d.ts → vendors/tag-managers/google-tag-manager.d.ts} +5 -8
- package/package.json +165 -4
- package/dist/meta-pixel.cjs +0 -129
- package/dist/meta-pixel.js +0 -89
- package/dist/posthog.js +0 -100
- package/dist-types/meta-pixel.d.ts +0 -185
- /package/dist-types/{databuddy.d.ts → vendors/analytics/databuddy.d.ts} +0 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
fathomAnalyticsManifest: ()=>fathomAnalyticsManifest,
|
|
28
|
+
fathomAnalytics: ()=>fathomAnalytics
|
|
29
|
+
});
|
|
30
|
+
const external_resolve_cjs_namespaceObject = require("../../resolve.cjs");
|
|
31
|
+
const external_types_cjs_namespaceObject = require("../../types.cjs");
|
|
32
|
+
const attributes_cjs_namespaceObject = require("../_shared/attributes.cjs");
|
|
33
|
+
const script_url_cjs_namespaceObject = require("../_shared/script-url.cjs");
|
|
34
|
+
const fathomAnalyticsManifest = {
|
|
35
|
+
...external_types_cjs_namespaceObject.vendorManifestContract,
|
|
36
|
+
vendor: 'fathom-analytics',
|
|
37
|
+
category: 'measurement',
|
|
38
|
+
install: [
|
|
39
|
+
{
|
|
40
|
+
type: 'loadScript',
|
|
41
|
+
src: "{{scriptUrl}}",
|
|
42
|
+
defer: true,
|
|
43
|
+
attributes: {
|
|
44
|
+
'data-site': '{{site}}',
|
|
45
|
+
'data-spa': '{{spa}}',
|
|
46
|
+
'data-auto': '{{autoAttribute}}',
|
|
47
|
+
'data-canonical': '{{canonicalAttribute}}',
|
|
48
|
+
'data-honor-dnt': '{{honorDntAttribute}}'
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
};
|
|
53
|
+
function fathomAnalytics(options) {
|
|
54
|
+
const resolved = (0, external_resolve_cjs_namespaceObject.resolveManifest)(fathomAnalyticsManifest, {
|
|
55
|
+
site: options.site,
|
|
56
|
+
spa: options.spa,
|
|
57
|
+
autoAttribute: (0, attributes_cjs_namespaceObject.booleanDataAttribute)(options.auto),
|
|
58
|
+
canonicalAttribute: (0, attributes_cjs_namespaceObject.booleanDataAttribute)(options.canonical),
|
|
59
|
+
honorDntAttribute: (0, attributes_cjs_namespaceObject.booleanDataAttribute)(options.honorDnt),
|
|
60
|
+
scriptUrl: (0, script_url_cjs_namespaceObject.resolveScriptUrl)(options.scriptUrl, "https://cdn.usefathom.com/script.js")
|
|
61
|
+
});
|
|
62
|
+
return resolved;
|
|
63
|
+
}
|
|
64
|
+
exports.fathomAnalytics = __webpack_exports__.fathomAnalytics;
|
|
65
|
+
exports.fathomAnalyticsManifest = __webpack_exports__.fathomAnalyticsManifest;
|
|
66
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
67
|
+
"fathomAnalytics",
|
|
68
|
+
"fathomAnalyticsManifest"
|
|
69
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
70
|
+
Object.defineProperty(exports, '__esModule', {
|
|
71
|
+
value: true
|
|
72
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { resolveManifest } from "../../resolve.js";
|
|
2
|
+
import { vendorManifestContract } from "../../types.js";
|
|
3
|
+
import { booleanDataAttribute } from "../_shared/attributes.js";
|
|
4
|
+
import { resolveScriptUrl } from "../_shared/script-url.js";
|
|
5
|
+
const fathomAnalyticsManifest = {
|
|
6
|
+
...vendorManifestContract,
|
|
7
|
+
vendor: 'fathom-analytics',
|
|
8
|
+
category: 'measurement',
|
|
9
|
+
install: [
|
|
10
|
+
{
|
|
11
|
+
type: 'loadScript',
|
|
12
|
+
src: "{{scriptUrl}}",
|
|
13
|
+
defer: true,
|
|
14
|
+
attributes: {
|
|
15
|
+
'data-site': '{{site}}',
|
|
16
|
+
'data-spa': '{{spa}}',
|
|
17
|
+
'data-auto': '{{autoAttribute}}',
|
|
18
|
+
'data-canonical': '{{canonicalAttribute}}',
|
|
19
|
+
'data-honor-dnt': '{{honorDntAttribute}}'
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
};
|
|
24
|
+
function fathomAnalytics(options) {
|
|
25
|
+
const resolved = resolveManifest(fathomAnalyticsManifest, {
|
|
26
|
+
site: options.site,
|
|
27
|
+
spa: options.spa,
|
|
28
|
+
autoAttribute: booleanDataAttribute(options.auto),
|
|
29
|
+
canonicalAttribute: booleanDataAttribute(options.canonical),
|
|
30
|
+
honorDntAttribute: booleanDataAttribute(options.honorDnt),
|
|
31
|
+
scriptUrl: resolveScriptUrl(options.scriptUrl, "https://cdn.usefathom.com/script.js")
|
|
32
|
+
});
|
|
33
|
+
return resolved;
|
|
34
|
+
}
|
|
35
|
+
export { fathomAnalytics, fathomAnalyticsManifest };
|
|
@@ -27,8 +27,9 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
27
27
|
gtagManifest: ()=>gtagManifest,
|
|
28
28
|
gtag: ()=>gtag
|
|
29
29
|
});
|
|
30
|
-
const external_resolve_cjs_namespaceObject = require("
|
|
31
|
-
const external_types_cjs_namespaceObject = require("
|
|
30
|
+
const external_resolve_cjs_namespaceObject = require("../../resolve.cjs");
|
|
31
|
+
const external_types_cjs_namespaceObject = require("../../types.cjs");
|
|
32
|
+
const google_consent_cjs_namespaceObject = require("../_shared/google-consent.cjs");
|
|
32
33
|
const gtagManifest = {
|
|
33
34
|
...external_types_cjs_namespaceObject.vendorManifestContract,
|
|
34
35
|
vendor: 'gtag',
|
|
@@ -55,7 +56,7 @@ const gtagManifest = {
|
|
|
55
56
|
global: 'gtag',
|
|
56
57
|
args: [
|
|
57
58
|
'js',
|
|
58
|
-
|
|
59
|
+
external_types_cjs_namespaceObject.runtimeDateValue
|
|
59
60
|
]
|
|
60
61
|
},
|
|
61
62
|
{
|
|
@@ -72,36 +73,14 @@ const gtagManifest = {
|
|
|
72
73
|
async: true
|
|
73
74
|
}
|
|
74
75
|
],
|
|
75
|
-
consentMapping:
|
|
76
|
-
necessary: [
|
|
77
|
-
'security_storage'
|
|
78
|
-
],
|
|
79
|
-
functionality: [
|
|
80
|
-
'functionality_storage'
|
|
81
|
-
],
|
|
82
|
-
measurement: [
|
|
83
|
-
'analytics_storage'
|
|
84
|
-
],
|
|
85
|
-
marketing: [
|
|
86
|
-
'ad_storage',
|
|
87
|
-
'ad_user_data',
|
|
88
|
-
'ad_personalization'
|
|
89
|
-
],
|
|
90
|
-
experience: [
|
|
91
|
-
'personalization_storage'
|
|
92
|
-
]
|
|
93
|
-
},
|
|
76
|
+
consentMapping: google_consent_cjs_namespaceObject.GOOGLE_CONSENT_MODE_V2_DEFAULT_MAPPING,
|
|
94
77
|
consentSignal: 'gtag'
|
|
95
78
|
};
|
|
96
79
|
function gtag({ id, category, consentMapping, script }) {
|
|
97
|
-
const manifest =
|
|
98
|
-
...gtagManifest,
|
|
99
|
-
consentMapping
|
|
100
|
-
} : gtagManifest;
|
|
80
|
+
const manifest = (0, google_consent_cjs_namespaceObject.withOptionalConsentMapping)(gtagManifest, consentMapping);
|
|
101
81
|
const resolved = (0, external_resolve_cjs_namespaceObject.resolveManifest)(manifest, {
|
|
102
82
|
id,
|
|
103
|
-
category
|
|
104
|
-
loadTime: new Date()
|
|
83
|
+
category
|
|
105
84
|
});
|
|
106
85
|
if (!script) return resolved;
|
|
107
86
|
return {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { resolveManifest } from "
|
|
2
|
-
import { vendorManifestContract } from "
|
|
1
|
+
import { resolveManifest } from "../../resolve.js";
|
|
2
|
+
import { runtimeDateValue, vendorManifestContract } from "../../types.js";
|
|
3
|
+
import { GOOGLE_CONSENT_MODE_V2_DEFAULT_MAPPING, withOptionalConsentMapping } from "../_shared/google-consent.js";
|
|
3
4
|
const gtagManifest = {
|
|
4
5
|
...vendorManifestContract,
|
|
5
6
|
vendor: 'gtag',
|
|
@@ -26,7 +27,7 @@ const gtagManifest = {
|
|
|
26
27
|
global: 'gtag',
|
|
27
28
|
args: [
|
|
28
29
|
'js',
|
|
29
|
-
|
|
30
|
+
runtimeDateValue
|
|
30
31
|
]
|
|
31
32
|
},
|
|
32
33
|
{
|
|
@@ -43,36 +44,14 @@ const gtagManifest = {
|
|
|
43
44
|
async: true
|
|
44
45
|
}
|
|
45
46
|
],
|
|
46
|
-
consentMapping:
|
|
47
|
-
necessary: [
|
|
48
|
-
'security_storage'
|
|
49
|
-
],
|
|
50
|
-
functionality: [
|
|
51
|
-
'functionality_storage'
|
|
52
|
-
],
|
|
53
|
-
measurement: [
|
|
54
|
-
'analytics_storage'
|
|
55
|
-
],
|
|
56
|
-
marketing: [
|
|
57
|
-
'ad_storage',
|
|
58
|
-
'ad_user_data',
|
|
59
|
-
'ad_personalization'
|
|
60
|
-
],
|
|
61
|
-
experience: [
|
|
62
|
-
'personalization_storage'
|
|
63
|
-
]
|
|
64
|
-
},
|
|
47
|
+
consentMapping: GOOGLE_CONSENT_MODE_V2_DEFAULT_MAPPING,
|
|
65
48
|
consentSignal: 'gtag'
|
|
66
49
|
};
|
|
67
50
|
function gtag({ id, category, consentMapping, script }) {
|
|
68
|
-
const manifest = consentMapping
|
|
69
|
-
...gtagManifest,
|
|
70
|
-
consentMapping
|
|
71
|
-
} : gtagManifest;
|
|
51
|
+
const manifest = withOptionalConsentMapping(gtagManifest, consentMapping);
|
|
72
52
|
const resolved = resolveManifest(manifest, {
|
|
73
53
|
id,
|
|
74
|
-
category
|
|
75
|
-
loadTime: new Date()
|
|
54
|
+
category
|
|
76
55
|
});
|
|
77
56
|
if (!script) return resolved;
|
|
78
57
|
return {
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
hotjarManifest: ()=>hotjarManifest,
|
|
28
|
+
hotjar: ()=>hotjar
|
|
29
|
+
});
|
|
30
|
+
const external_resolve_cjs_namespaceObject = require("../../resolve.cjs");
|
|
31
|
+
const external_types_cjs_namespaceObject = require("../../types.cjs");
|
|
32
|
+
const script_url_cjs_namespaceObject = require("../_shared/script-url.cjs");
|
|
33
|
+
const hotjarManifest = {
|
|
34
|
+
...external_types_cjs_namespaceObject.vendorManifestContract,
|
|
35
|
+
vendor: 'hotjar',
|
|
36
|
+
category: 'measurement',
|
|
37
|
+
install: [
|
|
38
|
+
{
|
|
39
|
+
type: 'setGlobal',
|
|
40
|
+
name: '_hjSettings',
|
|
41
|
+
value: {
|
|
42
|
+
hjid: '{{siteId}}',
|
|
43
|
+
hjsv: '{{version}}'
|
|
44
|
+
},
|
|
45
|
+
ifUndefined: true
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
type: 'defineStubFunction',
|
|
49
|
+
name: 'hj',
|
|
50
|
+
queue: {
|
|
51
|
+
property: 'q'
|
|
52
|
+
},
|
|
53
|
+
queueFormat: 'array',
|
|
54
|
+
ifUndefined: true
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
type: 'loadScript',
|
|
58
|
+
src: "{{scriptUrl}}",
|
|
59
|
+
async: true
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
};
|
|
63
|
+
function hotjar({ siteId, version = 6, scriptUrl }) {
|
|
64
|
+
if (null == siteId) throw new Error('hotjar: missing or invalid siteId');
|
|
65
|
+
const normalizedSiteId = String(siteId).trim();
|
|
66
|
+
if (0 === normalizedSiteId.length || '0' === normalizedSiteId) throw new Error('hotjar: missing or invalid siteId');
|
|
67
|
+
return (0, external_resolve_cjs_namespaceObject.resolveManifest)(hotjarManifest, {
|
|
68
|
+
siteId: normalizedSiteId,
|
|
69
|
+
version,
|
|
70
|
+
scriptUrl: (0, script_url_cjs_namespaceObject.resolveScriptUrl)(scriptUrl, `https://static.hotjar.com/c/hotjar-${normalizedSiteId}.js?sv=${version}`)
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
exports.hotjar = __webpack_exports__.hotjar;
|
|
74
|
+
exports.hotjarManifest = __webpack_exports__.hotjarManifest;
|
|
75
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
76
|
+
"hotjar",
|
|
77
|
+
"hotjarManifest"
|
|
78
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
79
|
+
Object.defineProperty(exports, '__esModule', {
|
|
80
|
+
value: true
|
|
81
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { resolveManifest } from "../../resolve.js";
|
|
2
|
+
import { vendorManifestContract } from "../../types.js";
|
|
3
|
+
import { resolveScriptUrl } from "../_shared/script-url.js";
|
|
4
|
+
const hotjarManifest = {
|
|
5
|
+
...vendorManifestContract,
|
|
6
|
+
vendor: 'hotjar',
|
|
7
|
+
category: 'measurement',
|
|
8
|
+
install: [
|
|
9
|
+
{
|
|
10
|
+
type: 'setGlobal',
|
|
11
|
+
name: '_hjSettings',
|
|
12
|
+
value: {
|
|
13
|
+
hjid: '{{siteId}}',
|
|
14
|
+
hjsv: '{{version}}'
|
|
15
|
+
},
|
|
16
|
+
ifUndefined: true
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
type: 'defineStubFunction',
|
|
20
|
+
name: 'hj',
|
|
21
|
+
queue: {
|
|
22
|
+
property: 'q'
|
|
23
|
+
},
|
|
24
|
+
queueFormat: 'array',
|
|
25
|
+
ifUndefined: true
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
type: 'loadScript',
|
|
29
|
+
src: "{{scriptUrl}}",
|
|
30
|
+
async: true
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
};
|
|
34
|
+
function hotjar({ 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
|
+
siteId: normalizedSiteId,
|
|
40
|
+
version,
|
|
41
|
+
scriptUrl: resolveScriptUrl(scriptUrl, `https://static.hotjar.com/c/hotjar-${normalizedSiteId}.js?sv=${version}`)
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
export { hotjar, hotjarManifest };
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
matomoAnalytics: ()=>matomoAnalytics,
|
|
28
|
+
matomoAnalyticsManifest: ()=>matomoAnalyticsManifest
|
|
29
|
+
});
|
|
30
|
+
const external_resolve_cjs_namespaceObject = require("../../resolve.cjs");
|
|
31
|
+
const external_types_cjs_namespaceObject = require("../../types.cjs");
|
|
32
|
+
const script_url_cjs_namespaceObject = require("../_shared/script-url.cjs");
|
|
33
|
+
function stripProtocol(value) {
|
|
34
|
+
if (value.startsWith('https://')) return value.slice(8);
|
|
35
|
+
if (value.startsWith('http://')) return value.slice(7);
|
|
36
|
+
return value;
|
|
37
|
+
}
|
|
38
|
+
function resolveMatomoOrigin(options) {
|
|
39
|
+
if (options.matomoUrl) return (0, script_url_cjs_namespaceObject.stripTrailingSlashes)(options.matomoUrl);
|
|
40
|
+
if (options.cloudId) {
|
|
41
|
+
const cleanedCloudId = (0, script_url_cjs_namespaceObject.stripTrailingSlashes)(stripProtocol(options.cloudId));
|
|
42
|
+
if (cleanedCloudId.endsWith('.matomo.cloud')) return `https://${cleanedCloudId}`;
|
|
43
|
+
return `https://cdn.matomo.cloud/${cleanedCloudId}`;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function buildInstallSteps(options) {
|
|
47
|
+
const install = [
|
|
48
|
+
{
|
|
49
|
+
type: 'setGlobal',
|
|
50
|
+
name: '_paq',
|
|
51
|
+
value: [],
|
|
52
|
+
ifUndefined: true
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
type: 'pushToQueue',
|
|
56
|
+
queue: '_paq',
|
|
57
|
+
value: [
|
|
58
|
+
'setTrackerUrl',
|
|
59
|
+
'{{trackerUrl}}'
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
type: 'pushToQueue',
|
|
64
|
+
queue: '_paq',
|
|
65
|
+
value: [
|
|
66
|
+
'setSiteId',
|
|
67
|
+
'{{siteId}}'
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
];
|
|
71
|
+
if (options.enableLinkTracking) install.push({
|
|
72
|
+
type: 'pushToQueue',
|
|
73
|
+
queue: '_paq',
|
|
74
|
+
value: [
|
|
75
|
+
'enableLinkTracking'
|
|
76
|
+
]
|
|
77
|
+
});
|
|
78
|
+
if (options.disableCookies) install.push({
|
|
79
|
+
type: 'pushToQueue',
|
|
80
|
+
queue: '_paq',
|
|
81
|
+
value: [
|
|
82
|
+
'disableCookies'
|
|
83
|
+
]
|
|
84
|
+
});
|
|
85
|
+
if (options.enableConsentMode && !options.consentInitiallyGiven) install.push({
|
|
86
|
+
type: 'pushToQueue',
|
|
87
|
+
queue: '_paq',
|
|
88
|
+
value: [
|
|
89
|
+
'requireConsent'
|
|
90
|
+
]
|
|
91
|
+
});
|
|
92
|
+
if (options.enableConsentMode && options.consentInitiallyGiven) {
|
|
93
|
+
install.push({
|
|
94
|
+
type: 'pushToQueue',
|
|
95
|
+
queue: '_paq',
|
|
96
|
+
value: [
|
|
97
|
+
'setConsentGiven'
|
|
98
|
+
]
|
|
99
|
+
});
|
|
100
|
+
if (options.trackPageView) install.push({
|
|
101
|
+
type: 'pushToQueue',
|
|
102
|
+
queue: '_paq',
|
|
103
|
+
value: [
|
|
104
|
+
'trackPageView'
|
|
105
|
+
]
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
if (options.trackPageView && !options.enableConsentMode) install.push({
|
|
109
|
+
type: 'pushToQueue',
|
|
110
|
+
queue: '_paq',
|
|
111
|
+
value: [
|
|
112
|
+
'trackPageView'
|
|
113
|
+
]
|
|
114
|
+
});
|
|
115
|
+
install.push({
|
|
116
|
+
type: 'loadScript',
|
|
117
|
+
src: "{{scriptUrl}}",
|
|
118
|
+
async: true
|
|
119
|
+
});
|
|
120
|
+
return install;
|
|
121
|
+
}
|
|
122
|
+
function buildGrantedHooks(options) {
|
|
123
|
+
const onBeforeLoadGranted = [];
|
|
124
|
+
if (options.enableConsentMode && !options.consentInitiallyGiven) onBeforeLoadGranted.push({
|
|
125
|
+
type: 'pushToQueue',
|
|
126
|
+
queue: '_paq',
|
|
127
|
+
value: [
|
|
128
|
+
'setConsentGiven'
|
|
129
|
+
]
|
|
130
|
+
});
|
|
131
|
+
if (options.trackPageView && options.enableConsentMode && !options.consentInitiallyGiven) onBeforeLoadGranted.push({
|
|
132
|
+
type: 'pushToQueue',
|
|
133
|
+
queue: '_paq',
|
|
134
|
+
value: [
|
|
135
|
+
'trackPageView'
|
|
136
|
+
]
|
|
137
|
+
});
|
|
138
|
+
const onConsentGranted = [];
|
|
139
|
+
if (options.enableConsentMode) {
|
|
140
|
+
onConsentGranted.push({
|
|
141
|
+
type: 'pushToQueue',
|
|
142
|
+
queue: '_paq',
|
|
143
|
+
value: [
|
|
144
|
+
'setConsentGiven'
|
|
145
|
+
]
|
|
146
|
+
});
|
|
147
|
+
if (options.trackPageView) onConsentGranted.push({
|
|
148
|
+
type: 'pushToQueue',
|
|
149
|
+
queue: '_paq',
|
|
150
|
+
value: [
|
|
151
|
+
'trackPageView'
|
|
152
|
+
]
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
return {
|
|
156
|
+
onBeforeLoadGranted,
|
|
157
|
+
onConsentGranted
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
function buildDeniedHooks(options) {
|
|
161
|
+
const onConsentDenied = [];
|
|
162
|
+
if (options.enableConsentMode) onConsentDenied.push({
|
|
163
|
+
type: 'pushToQueue',
|
|
164
|
+
queue: '_paq',
|
|
165
|
+
value: [
|
|
166
|
+
'forgetConsentGiven'
|
|
167
|
+
]
|
|
168
|
+
});
|
|
169
|
+
return onConsentDenied;
|
|
170
|
+
}
|
|
171
|
+
function createMatomoAnalyticsManifest(options) {
|
|
172
|
+
const { onBeforeLoadGranted, onConsentGranted } = buildGrantedHooks(options);
|
|
173
|
+
let alwaysLoad;
|
|
174
|
+
let persistAfterConsentRevoked;
|
|
175
|
+
if (options.enableConsentMode) {
|
|
176
|
+
alwaysLoad = true;
|
|
177
|
+
persistAfterConsentRevoked = true;
|
|
178
|
+
}
|
|
179
|
+
return {
|
|
180
|
+
...external_types_cjs_namespaceObject.vendorManifestContract,
|
|
181
|
+
vendor: 'matomo-analytics',
|
|
182
|
+
category: 'measurement',
|
|
183
|
+
alwaysLoad,
|
|
184
|
+
persistAfterConsentRevoked,
|
|
185
|
+
install: buildInstallSteps(options),
|
|
186
|
+
onBeforeLoadGranted,
|
|
187
|
+
onConsentGranted,
|
|
188
|
+
onConsentDenied: buildDeniedHooks(options)
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
const matomoAnalyticsManifest = createMatomoAnalyticsManifest({
|
|
192
|
+
enableConsentMode: false,
|
|
193
|
+
consentInitiallyGiven: false,
|
|
194
|
+
enableLinkTracking: false,
|
|
195
|
+
disableCookies: false,
|
|
196
|
+
trackPageView: true
|
|
197
|
+
});
|
|
198
|
+
function matomoAnalytics(options = {}) {
|
|
199
|
+
const origin = resolveMatomoOrigin(options);
|
|
200
|
+
let trackerUrl = options.trackerUrl;
|
|
201
|
+
if (!trackerUrl && origin) trackerUrl = (0, script_url_cjs_namespaceObject.joinUrlPath)(origin, 'matomo.php');
|
|
202
|
+
let scriptUrl = options.scriptUrl;
|
|
203
|
+
if (!scriptUrl && origin) scriptUrl = (0, script_url_cjs_namespaceObject.joinUrlPath)(origin, 'matomo.js');
|
|
204
|
+
if (!trackerUrl || !scriptUrl) throw new Error("matomoAnalytics requires `matomoUrl`, `cloudId`, or explicit `trackerUrl` and `scriptUrl` values.");
|
|
205
|
+
const enableConsentMode = 'required' === options.defaultConsent || 'given' === options.defaultConsent;
|
|
206
|
+
const consentInitiallyGiven = 'given' === options.defaultConsent;
|
|
207
|
+
const manifest = createMatomoAnalyticsManifest({
|
|
208
|
+
enableConsentMode,
|
|
209
|
+
consentInitiallyGiven,
|
|
210
|
+
enableLinkTracking: options.enableLinkTracking ?? false,
|
|
211
|
+
disableCookies: options.disableCookies ?? false,
|
|
212
|
+
trackPageView: options.trackPageView ?? true
|
|
213
|
+
});
|
|
214
|
+
return (0, external_resolve_cjs_namespaceObject.resolveManifest)(manifest, {
|
|
215
|
+
siteId: String(options.siteId ?? 1),
|
|
216
|
+
trackerUrl,
|
|
217
|
+
scriptUrl
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
exports.matomoAnalytics = __webpack_exports__.matomoAnalytics;
|
|
221
|
+
exports.matomoAnalyticsManifest = __webpack_exports__.matomoAnalyticsManifest;
|
|
222
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
223
|
+
"matomoAnalytics",
|
|
224
|
+
"matomoAnalyticsManifest"
|
|
225
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
226
|
+
Object.defineProperty(exports, '__esModule', {
|
|
227
|
+
value: true
|
|
228
|
+
});
|