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>
This commit is contained in:
@@ -4,6 +4,8 @@ import './globals.css'
|
||||
import Nav from '@/components/ui/Nav'
|
||||
import Footer from '@/components/ui/Footer'
|
||||
import PostHogProvider from '@/components/PostHogProvider'
|
||||
import { PostHogPageView } from '@/components/PostHogPageView'
|
||||
import { Suspense } from 'react'
|
||||
|
||||
const cormorant = Cormorant_Garamond({
|
||||
subsets: ['latin'],
|
||||
@@ -47,6 +49,9 @@ export default function RootLayout({
|
||||
}}
|
||||
/>
|
||||
<PostHogProvider>
|
||||
<Suspense fallback={null}>
|
||||
<PostHogPageView />
|
||||
</Suspense>
|
||||
<Nav />
|
||||
<main>{children}</main>
|
||||
<Footer />
|
||||
|
||||
Reference in New Issue
Block a user