fix: PostHog cross-subdomain tracking and cookie consent

Merged
SA
1y ago
+587-105

Summary

  • Configure PostHog for cross-subdomain user tracking with persistence: "cookie" and persistence_name
  • Add cookie domain config to all apps (web, marketing, admin, docs, desktop)
  • Create PostHogUserIdentifier component to identify users to PostHog after auth
  • Add Trigger.dev-style cookie consent banner to marketing site with opt-out model
  • Add Next.js 16 proxy.ts documentation note to AGENTS.md

Changes

  • All apps now use consistent PostHog initialization with cross-subdomain tracking
  • PostHogUserIdentifier uses Clerk (web apps) or tRPC (desktop) internally to get user data
  • Marketing site shows small bottom-left cookie banner with Accept/Opt-out options
  • Default NEXT_PUBLIC_COOKIE_DOMAIN to localhost for development

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Integrated analytics across apps with automatic user identification (syncs account info to analytics when signed in).
    • Added a dismissible cookie consent banner in Marketing to accept or opt out of analytics.
  • Chores
    • Configured analytics routing/endpoints and app-level providers; added public analytics keys and cookie name for consistent behavior across deployments.

✏️ Tip: You can customize this high-level summary in your review settings.