feat(analytics): Support for Umami (#449)
This commit is contained in:
		| @@ -12,6 +12,10 @@ export type Analytics = | ||||
|       provider: "google" | ||||
|       tagId: string | ||||
|     } | ||||
|   | { | ||||
|       provider: "umami" | ||||
|       websiteId: string | ||||
|     } | ||||
|  | ||||
| export interface GlobalConfiguration { | ||||
|   pageTitle: string | ||||
|   | ||||
| @@ -96,6 +96,15 @@ function addGlobalPageResources( | ||||
|       });`) | ||||
|   } else if (cfg.analytics?.provider === "plausible") { | ||||
|     componentResources.afterDOMLoaded.push(plausibleScript) | ||||
|   } else if (cfg.analytics?.provider === "umami") { | ||||
|     componentResources.afterDOMLoaded.push(` | ||||
|       const umamiScript = document.createElement("script") | ||||
|       umamiScript.src = "https://analytics.umami.is/script.js" | ||||
|       umamiScript["data-website-id"] = "${cfg.analytics.websiteId}" | ||||
|       umamiScript.async = true | ||||
|    | ||||
|       document.head.appendChild(umamiScript) | ||||
|     `) | ||||
|   } | ||||
|  | ||||
|   if (cfg.enableSPA) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user