feat(analytics): Cabin analytics support (#1221)

* add cabin analytics

* fix formatting
This commit is contained in:
John Bowdre
2024-06-18 15:38:45 -05:00
committed by GitHub
parent 1d94e9c303
commit 3faf2ff6f5
3 changed files with 13 additions and 0 deletions

View File

@ -144,6 +144,14 @@ function addGlobalPageResources(ctx: BuildCtx, componentResources: ComponentReso
tinylyticsScript.defer = true
document.head.appendChild(tinylyticsScript)
`)
} else if (cfg.analytics?.provider === "cabin") {
componentResources.afterDOMLoaded.push(`
const cabinScript = document.createElement("script")
cabinScript.src = "${cfg.analytics.host ?? "https://scripts.cabin.dev"}/cabin.js"
cabinScript.defer = true
cabinScript.async = true
document.head.appendChild(cabinScript)
`)
}
if (cfg.enableSPA) {