Skip to content

Commit 59d4b4e

Browse files
authored
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
1 parent adf4420 commit 59d4b4e

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

quartz/plugins/emitters/componentResources.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,8 @@ function addGlobalPageResources(ctx: BuildCtx, componentResources: ComponentReso
128128
const umamiScript = document.createElement("script");
129129
umamiScript.src = "${cfg.analytics.host ?? "https://analytics.umami.is"}/script.js";
130130
umamiScript.setAttribute("data-website-id", "${cfg.analytics.websiteId}");
131-
umamiScript.setAttribute("data-auto-track", "false");
131+
umamiScript.setAttribute("data-auto-track", "true");
132132
umamiScript.defer = true;
133-
umamiScript.onload = () => {
134-
umami.track();
135-
document.addEventListener("nav", () => {
136-
umami.track();
137-
});
138-
};
139133
140134
document.head.appendChild(umamiScript);
141135
`)

0 commit comments

Comments
 (0)