fix(analytics): Umami tracking pageviews properly
Update componentResources.ts to fix umami SPA tracking (#1967) Update componentResources.ts to fix umami analytics when SPA is enabled in Quartz
This commit is contained in:
		
							parent
							
								
									adf442036b
								
							
						
					
					
						commit
						59d4b4eddd
					
				| @ -128,14 +128,8 @@ function addGlobalPageResources(ctx: BuildCtx, componentResources: ComponentReso | ||||
|       const umamiScript = document.createElement("script"); | ||||
|       umamiScript.src = "${cfg.analytics.host ?? "https://analytics.umami.is"}/script.js";
 | ||||
|       umamiScript.setAttribute("data-website-id", "${cfg.analytics.websiteId}"); | ||||
|       umamiScript.setAttribute("data-auto-track", "false"); | ||||
|       umamiScript.setAttribute("data-auto-track", "true"); | ||||
|       umamiScript.defer = true; | ||||
|       umamiScript.onload = () => { | ||||
|         umami.track(); | ||||
|         document.addEventListener("nav", () => { | ||||
|           umami.track(); | ||||
|         }); | ||||
|       }; | ||||
| 
 | ||||
|       document.head.appendChild(umamiScript); | ||||
|     `)
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user