@xingwangzhe/stalux 1.21.11 → 1.22.1
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xingwangzhe/stalux",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.22.1",
|
|
4
4
|
"description": "A powerful, modern Astro blog theme — use as template or install as plugin",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astro",
|
|
@@ -75,6 +75,7 @@
|
|
|
75
75
|
"prepare": "git config core.hooksPath scripts/git-hooks"
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
|
+
"@astrojs/partytown": "^2.1.7",
|
|
78
79
|
"@astrojs/rss": "^4.0.19",
|
|
79
80
|
"@astrojs/sitemap": "^3.7.3",
|
|
80
81
|
"@expressive-code/plugin-line-numbers": "^0.44.1",
|
|
@@ -4,31 +4,31 @@ 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() {
|
|
10
|
+
dataLayer.push(arguments);
|
|
11
|
+
};
|
|
12
|
+
gtag("js", new Date());
|
|
13
|
+
gtag("config", ${JSON.stringify(gaID)});`
|
|
14
|
+
: "";
|
|
7
15
|
---
|
|
8
16
|
|
|
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) {
|
|
17
|
+
{
|
|
18
|
+
gaID && (
|
|
19
|
+
<>
|
|
20
|
+
<script
|
|
21
|
+
type="text/partytown"
|
|
22
|
+
src={`https://www.googletagmanager.com/gtag/js?id=${gaID}`}></script>
|
|
23
|
+
<script type="text/partytown" set:html={gaBootstrap}></script>
|
|
24
|
+
<script is:inline>
|
|
25
25
|
document.addEventListener("astro:page-load", () => {
|
|
26
|
-
window.
|
|
26
|
+
window.dataLayer?.push({
|
|
27
|
+
event: "page_view",
|
|
28
|
+
page_path: window.location.pathname,
|
|
29
|
+
});
|
|
27
30
|
});
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
else window.addEventListener("load", () => setTimeout(load, 0), { once: true });
|
|
33
|
-
})();
|
|
34
|
-
</script>
|
|
31
|
+
</script>
|
|
32
|
+
</>
|
|
33
|
+
)
|
|
34
|
+
}
|