diff --git a/apps/website/instrumentation-client.ts b/apps/website/instrumentation-client.ts index 2f08ee5ee..716f7823d 100644 --- a/apps/website/instrumentation-client.ts +++ b/apps/website/instrumentation-client.ts @@ -12,5 +12,6 @@ if (shouldCaptureAnalytics({ token, captureLocal, host: browserHost })) { posthog.init(token!, { api_host: normalizePostHogHost(process.env.NEXT_PUBLIC_POSTHOG_HOST), defaults: '2026-01-30', + capture_pageview: true, }); } diff --git a/apps/website/src/lib/analytics/client.ts b/apps/website/src/lib/analytics/client.ts index 0ccac187d..ad403bef1 100644 --- a/apps/website/src/lib/analytics/client.ts +++ b/apps/website/src/lib/analytics/client.ts @@ -11,12 +11,15 @@ function currentSourcePage(): string { export function track(event: AnalyticsEventName, properties: AnalyticsProperties = {}) { if (typeof window === 'undefined') return; - if (!posthog.__loaded) return; - posthog.capture(event, { - source_page: currentSourcePage(), - ...properties, - }); + try { + posthog.capture(event, { + source_page: currentSourcePage(), + ...properties, + }); + } catch (err) { + console.error('[posthog] client capture failed:', err); + } } export function trackCtaClick(properties: AnalyticsProperties) {