I shipped a no-op stub of PostHogProvider.tsx on April 20. I told myself I would come back to it that afternoon. Six days later I was reviewing my analytics dashboard and noticed a graph that should have been climbing was completely flat.
Every posthog.capture() in my Next.js 16 App Router app had been firing into a black hole. Including the one event I actually cared about: the waitlist signup.
This is the post-mortem. Three gotchas, real code, and how I verified the fix in a way that did not depend on trusting the PostHog dashboard.
How I broke it
The original component looked roughly like this:
" use client " ;
import posthog from " posthog-js " ;
export default function PostHogProvider ({ children }: { children : React . ReactNode }) { if ( typeof window !== " undefined " ) { posthog . init ( process . env . NEXT_PUBLIC_POSTHOG_KEY ! , { api_host : " https://us.i.posthog.com " , }); } return <> { children } </>; }
Enter fullscreen mode
Exit fullscreen mode
Looks fine, builds fine, ships fine.…