ublo-lib 1.8.0 → 1.8.2
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.
|
@@ -7,12 +7,13 @@ const {
|
|
|
7
7
|
publicRuntimeConfig
|
|
8
8
|
} = getConfig();
|
|
9
9
|
const {
|
|
10
|
+
plausibleDomain,
|
|
10
11
|
disableClientRouting
|
|
11
12
|
} = publicRuntimeConfig;
|
|
12
13
|
const DEFAULT_SOURCE = "https://plausible.io/js/script.file-downloads.outbound-links.js";
|
|
13
14
|
const PlausibleScript = ({
|
|
14
15
|
lang,
|
|
15
|
-
|
|
16
|
+
domain,
|
|
16
17
|
source = DEFAULT_SOURCE
|
|
17
18
|
}) => {
|
|
18
19
|
const [loaded, setLoaded] = React.useState(false);
|
|
@@ -21,7 +22,7 @@ const PlausibleScript = ({
|
|
|
21
22
|
if (hasI18n && !lang) {
|
|
22
23
|
console.warn("PlausibleScript: the lang props is mandatory if you want to use a specific domain for each lang");
|
|
23
24
|
}
|
|
24
|
-
const
|
|
25
|
+
const _domain = domain || hasI18n ? plausibleDomain[lang] : plausibleDomain;
|
|
25
26
|
const sendPageView = React.useCallback(() => {
|
|
26
27
|
window.plausible("pageview", {
|
|
27
28
|
url: window.location.href,
|
|
@@ -42,7 +43,7 @@ const PlausibleScript = ({
|
|
|
42
43
|
return null;
|
|
43
44
|
}
|
|
44
45
|
return _jsx(Script, {
|
|
45
|
-
"data-domain":
|
|
46
|
+
"data-domain": _domain,
|
|
46
47
|
src: source,
|
|
47
48
|
onLoad: () => setLoaded(true)
|
|
48
49
|
});
|