mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-05-19 06:54:18 +02:00
fix(goatcounter): asign spaPreserve to analytics script
Signed-off-by: Aaron Pham <contact@aarnphm.xyz>
This commit is contained in:
parent
cdc5728c52
commit
cd863a88e3
@ -122,14 +122,13 @@ function addGlobalPageResources(ctx: BuildCtx, componentResources: ComponentReso
|
|||||||
`)
|
`)
|
||||||
} else if (cfg.analytics?.provider === "goatcounter") {
|
} else if (cfg.analytics?.provider === "goatcounter") {
|
||||||
componentResources.afterDOMLoaded.push(`
|
componentResources.afterDOMLoaded.push(`
|
||||||
document.addEventListener("nav", () => {
|
const goatcounterScript = document.createElement("script")
|
||||||
const goatcounterScript = document.createElement("script")
|
goatcounterScript.src = "${cfg.analytics.scriptSrc ?? "https://gc.zgo.at/count.js"}"
|
||||||
goatcounterScript.src = "${cfg.analytics.scriptSrc ?? "https://gc.zgo.at/count.js"}"
|
goatcounterScript.async = true
|
||||||
goatcounterScript.async = true
|
goatcounterScript.setAttribute("spa-preserve", "true")
|
||||||
goatcounterScript.setAttribute("data-goatcounter",
|
goatcounterScript.setAttribute("data-goatcounter",
|
||||||
"https://${cfg.analytics.websiteId}.${cfg.analytics.host ?? "goatcounter.com"}/count")
|
"https://${cfg.analytics.websiteId}.${cfg.analytics.host ?? "goatcounter.com"}/count")
|
||||||
document.head.appendChild(goatcounterScript)
|
document.head.appendChild(goatcounterScript)
|
||||||
})
|
|
||||||
`)
|
`)
|
||||||
} else if (cfg.analytics?.provider === "posthog") {
|
} else if (cfg.analytics?.provider === "posthog") {
|
||||||
componentResources.afterDOMLoaded.push(`
|
componentResources.afterDOMLoaded.push(`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user