Files
hyggecraftery-web/components/PostHogProvider.tsx
Tim Leikauf 4274d680e1 Rework PostHog setup — use Next.js ingest proxy + posthog-js/react
Mirrors the proven pattern from gendersloty: rewrites /ingest/* to
the PostHog host so requests go through the same origin (no CORS,
no ad-blocker issues). Uses PostHogProvider and usePostHog from
posthog-js/react official React integration.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-01 21:50:43 +02:00

19 lines
547 B
TypeScript

'use client'
import posthog from 'posthog-js'
import { PostHogProvider as PHProvider } from 'posthog-js/react'
import { useEffect } from 'react'
export default function PostHogProvider({ children }: { children: React.ReactNode }) {
useEffect(() => {
posthog.init('phc_BHgg9S7CQqVShe7EMCdi86PxA49qcNaTsR9Nn5EGxRCT', {
api_host: '/ingest',
ui_host: 'https://analytics.hyggecraftery.com',
capture_pageview: false,
persistence: 'memory',
})
}, [])
return <PHProvider client={posthog}>{children}</PHProvider>
}