PostHog analytics in TanStack Start

How I set up PostHog in a statically prerendered TanStack Start site, covering SSR-safe initialisation, SPA pageview tracking, and proxying through Vercel.