@xingwangzhe/stalux 1.22.2 → 1.22.4
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/package.json
CHANGED
|
@@ -6,20 +6,11 @@ const headConfig = getHeadData(configEntries);
|
|
|
6
6
|
const id = headConfig?.bingClarityId;
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
t.async = 1;
|
|
18
|
-
t.src = "https://www.clarity.ms/tag/" + i;
|
|
19
|
-
y = l.getElementsByTagName(r)[0];
|
|
20
|
-
y.parentNode.insertBefore(t, y);
|
|
21
|
-
})(window, document, "clarity", "script", id);
|
|
22
|
-
};
|
|
23
|
-
if ("requestIdleCallback" in window) requestIdleCallback(load, { timeout: 4000 });
|
|
24
|
-
else window.addEventListener("load", () => setTimeout(load, 0), { once: true });
|
|
25
|
-
</script>
|
|
9
|
+
{
|
|
10
|
+
id && (
|
|
11
|
+
<>
|
|
12
|
+
<script type="text/partytown" set:html={`window.clarity = window.clarity || function(){ (window.clarity.q = window.clarity.q || []).push(arguments); };`}></script>
|
|
13
|
+
<script type="text/partytown" src={`https://www.clarity.ms/tag/${id}`}></script>
|
|
14
|
+
</>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
@@ -4,31 +4,29 @@ import { getHeadData } from "@utils/config-utils";
|
|
|
4
4
|
const configEntries = await getCollection("config");
|
|
5
5
|
const headConfig = getHeadData(configEntries);
|
|
6
6
|
const gaID = headConfig?.googleAnalyticsId;
|
|
7
|
+
const gaBootstrap = gaID
|
|
8
|
+
? `window.dataLayer = window.dataLayer || [];
|
|
9
|
+
window.gtag = function gtag() { dataLayer.push(arguments); };
|
|
10
|
+
gtag("js", new Date());
|
|
11
|
+
gtag("config", ${JSON.stringify(gaID)});`
|
|
12
|
+
: "";
|
|
7
13
|
---
|
|
8
14
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
script
|
|
16
|
-
script
|
|
17
|
-
document.head.appendChild(script);
|
|
18
|
-
window.dataLayer = window.dataLayer || [];
|
|
19
|
-
window.gtag = window.gtag || function () {
|
|
20
|
-
window.dataLayer.push(arguments);
|
|
21
|
-
};
|
|
22
|
-
window.gtag("js", new Date());
|
|
23
|
-
window.gtag("config", gaID);
|
|
24
|
-
if (!window.__gtagListenerAdded) {
|
|
15
|
+
{
|
|
16
|
+
gaID && (
|
|
17
|
+
<>
|
|
18
|
+
<script
|
|
19
|
+
type="text/partytown"
|
|
20
|
+
src={`https://www.googletagmanager.com/gtag/js?id=${gaID}`}></script>
|
|
21
|
+
<script type="text/partytown" set:html={gaBootstrap}></script>
|
|
22
|
+
<script is:inline>
|
|
25
23
|
document.addEventListener("astro:page-load", () => {
|
|
26
|
-
window.
|
|
24
|
+
window.dataLayer?.push({
|
|
25
|
+
event: "page_view",
|
|
26
|
+
page_path: window.location.pathname,
|
|
27
|
+
});
|
|
27
28
|
});
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
else window.addEventListener("load", () => setTimeout(load, 0), { once: true });
|
|
33
|
-
})();
|
|
34
|
-
</script>
|
|
29
|
+
</script>
|
|
30
|
+
</>
|
|
31
|
+
)
|
|
32
|
+
}
|