mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-07-02 05:40:59 +02:00
fix(analytics): streamline posthog script loading and event capturing (#1974)
Some checks failed
Build and Test / build-and-test (ubuntu-latest) (push) Has been skipped
Build and Test / publish-tag (push) Has been skipped
Build and Test / build-and-test (macos-latest) (push) Has been cancelled
Build and Test / build-and-test (windows-latest) (push) Has been cancelled
Some checks failed
Build and Test / build-and-test (ubuntu-latest) (push) Has been skipped
Build and Test / publish-tag (push) Has been skipped
Build and Test / build-and-test (macos-latest) (push) Has been cancelled
Build and Test / build-and-test (windows-latest) (push) Has been cancelled
This commit is contained in:
parent
c9741d00f3
commit
6d49d97559
@ -159,14 +159,10 @@ function addGlobalPageResources(ctx: BuildCtx, componentResources: ComponentReso
|
|||||||
posthog.init('${cfg.analytics.apiKey}', {
|
posthog.init('${cfg.analytics.apiKey}', {
|
||||||
api_host: '${cfg.analytics.host ?? "https://app.posthog.com"}',
|
api_host: '${cfg.analytics.host ?? "https://app.posthog.com"}',
|
||||||
capture_pageview: false,
|
capture_pageview: false,
|
||||||
})\`
|
});
|
||||||
posthogScript.onload = () => {
|
document.addEventListener('nav', () => {
|
||||||
posthog.capture('$pageview', { path: location.pathname });
|
posthog.capture('$pageview', { path: location.pathname });
|
||||||
|
})\`
|
||||||
document.addEventListener('nav', () => {
|
|
||||||
posthog.capture('$pageview', { path: location.pathname });
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
document.head.appendChild(posthogScript);
|
document.head.appendChild(posthogScript);
|
||||||
`)
|
`)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user