fix(analytics): streamline posthog script loading and event capturing (#1974)
| | |
| | | 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); |
| | | `) |