1
0
mirror of https://gitlab.com/MisterBiggs/brain-quartz.git synced 2025-06-16 09:46:39 +00:00

fix(analytics): streamline posthog script loading and event capturing (#1974)

This commit is contained in:
Aswanth 2025-05-24 10:25:07 +05:30 committed by GitHub
parent c9741d00f3
commit 6d49d97559
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -159,14 +159,10 @@ function addGlobalPageResources(ctx: BuildCtx, componentResources: ComponentReso
posthog.init('${cfg.analytics.apiKey}', {
api_host: '${cfg.analytics.host ?? "https://app.posthog.com"}',
capture_pageview: false,
})\`
posthogScript.onload = () => {
});
document.addEventListener('nav', () => {
posthog.capture('$pageview', { path: location.pathname });
document.addEventListener('nav', () => {
posthog.capture('$pageview', { path: location.pathname });
});
};
})\`
document.head.appendChild(posthogScript);
`)