Skip to content

Integrate PostHog analytics and monitoring across Next apps #919

@anth-volk

Description

@anth-volk

Goal

Integrate PostHog across the new Next.js website and calculator-app surfaces so we have:

  • product analytics for the calculator
  • website funnel/content analytics
  • stronger client and server error tracking
  • production-ready ingestion through app-local proxying
  • release-aware configuration for source maps and monitoring

Scope

  • Bootstrap posthog-js in both Next apps.
  • Add shared calculator analytics helpers and typed event schemas in app/src.
  • Instrument core calculator flows:
    • report builder opened/started/created
    • report-builder configuration choices
    • household builder interactions
    • calculation lifecycle
    • report output views and output actions
  • Instrument key website flows:
    • enter-calculator CTA
    • newsletter signup
    • research filter/article interactions
    • country switching
  • Add robust error capture:
    • shared React boundary capture
    • Next error.tsx and global-error.tsx
    • server-side request error capture
  • Proxy PostHog traffic through Next rewrites.
  • Add release/source-map related configuration and env documentation.

Acceptance Criteria

  • website and calculator-app both initialize PostHog from official Next.js integration points.
  • Calculator events are queryable for builder selection, report creation, calculations, and output usage.
  • Website events are queryable for CTA/content/signup interactions.
  • Client, route, and server exceptions are visible in PostHog with useful metadata.
  • PostHog traffic is routed through app-local proxy paths instead of direct third-party ingestion URLs.
  • The apps build successfully with the project’s supported Node version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions