feat(analytics): Goatcounter support (#956)
* Add options to support goatcounter analytics * goatcounter: support self-hosted * Add to configuration docs for goatcounter settings * use https instead of protocol-relative link for goatcounter js
This commit is contained in:
@ -126,6 +126,15 @@ function addGlobalPageResources(
|
||||
|
||||
document.head.appendChild(umamiScript)
|
||||
`)
|
||||
} else if (cfg.analytics?.provider === "goatcounter") {
|
||||
componentResources.afterDOMLoaded.push(`
|
||||
const goatcounterScript = document.createElement("script")
|
||||
goatcounterScript.src = "${cfg.analytics.scriptSrc ?? "https://gc.zgo.at/count.js"}"
|
||||
goatcounterScript.async = true
|
||||
goatcounterScript.setAttribute("data-goatcounter",
|
||||
"https://${cfg.analytics.websiteId}.${cfg.analytics.host ?? "goatcounter.com"}/count")
|
||||
document.head.appendChild(goatcounterScript)
|
||||
`)
|
||||
}
|
||||
|
||||
if (cfg.enableSPA) {
|
||||
|
Reference in New Issue
Block a user