From 4274d680e189049f5d5865a7f720ec716b54b224 Mon Sep 17 00:00:00 2001 From: Tim Leikauf Date: Wed, 1 Jul 2026 21:50:43 +0200 Subject: [PATCH] =?UTF-8?q?Rework=20PostHog=20setup=20=E2=80=94=20use=20Ne?= =?UTF-8?q?xt.js=20ingest=20proxy=20+=20posthog-js/react?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- app/layout.tsx | 5 +++++ components/PostHogPageView.tsx | 22 ++++++++++++++++++++++ components/PostHogProvider.tsx | 16 +++++----------- lib/posthog.ts | 1 + next.config.mjs | 22 ++++++++++++++++++++-- 5 files changed, 53 insertions(+), 13 deletions(-) create mode 100644 components/PostHogPageView.tsx diff --git a/app/layout.tsx b/app/layout.tsx index c457b32..e46f0bb 100755 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -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({ }} /> + + +