1
0
mirror of https://gitlab.com/MisterBiggs/brain-quartz.git synced 2025-09-19 04:02:49 +00:00

feat(analytics): add support for Vercel Web Analytics provider (#2119)

* feat(analytics): add support for Vercel Web Analytics provider

* fix: correct indentation for Vercel analytics provider condition
This commit is contained in:
siaikin
2025-09-09 11:06:28 +08:00
committed by GitHub
parent ecb3d92941
commit e77a051144
3 changed files with 17 additions and 0 deletions

View File

@@ -228,6 +228,19 @@ function addGlobalPageResources(ctx: BuildCtx, componentResources: ComponentReso
\`
document.head.appendChild(matomoScript);
`)
} else if (cfg.analytics?.provider === "vercel") {
/**
* script from {@link https://vercel.com/docs/analytics/quickstart?framework=html#add-the-script-tag-to-your-site|Vercel Docs}
*/
componentResources.beforeDOMLoaded.push(`
window.va = window.va || function () { (window.vaq = window.vaq || []).push(arguments); };
`)
componentResources.afterDOMLoaded.push(`
const vercelInsightsScript = document.createElement("script")
vercelInsightsScript.src = "/_vercel/insights/script.js"
vercelInsightsScript.defer = true
document.head.appendChild(vercelInsightsScript)
`)
}
if (cfg.enableSPA) {