# ADR-0005: Visitor analytics — PostHog + Umami side-by-side trial

**Status:** Accepted — 2026-07-15

## Context

The owner leans toward richer data (PostHog: autocapture, funnels, session replay) but the site is
a low-traffic B2B advisory brochure with a Digital-ESG / low-energy positioning, and self-hosting
PostHog is resource-heavy. Rather than decide in the abstract, the owner chose to **trial both**
and compare. This is product/visitor analytics — distinct from the monylog ops telemetry (ADR-0004).

## Decision

Run **PostHog and Umami side-by-side initially** to evaluate which fits. Recommended trial setup:

- **PostHog — Cloud free tier** (1M events/mo) rather than self-host, to avoid loading the homelab
  during evaluation; reverse-proxy ingest through our domain to reduce ad-blocker loss.
- **Umami — self-hosted** in k3s (lightweight, cookieless, no consent banner).

Both are wired through a single config-driven `Analytics.astro` component in `BaseLayout`, gated by
env vars, so either can be toggled and a winner kept without code churn. Track the same event set
in both (consultation-CTA clicks, per-service/focus CTA source, insights reads, contact submits).

## Consequences

- Temporary dual instrumentation (slightly more script weight during the trial).
- **Privacy/consent must cover the superset:** PostHog (esp. session replay) likely triggers
  cookie-consent + privacy-policy obligations; add these before enabling PostHog in production.
- Decision criteria: insight value vs. weight/consent/ESG fit. Revisit with a follow-up ADR naming
  the winner and the retirement of the other.
- Detail in `docs/seo-aeo-optimization.md` §6b.
