Personal project / Analytics engineering

Portfolio analytics

A privacy-aware analytics implementation for a static portfolio, with separate pageview and Home-only context paths.

Next.jsReactTypeScriptCloudflarePostHog

The problem

Measure pageviews and provide limited visit context for a static portfolio without treating approximate signals as identity or mixing the two data paths.

Architecture & flow

Separate context from pageviews

Two independent paths with different purposes and privacy boundaries.

  1. Privacy checks

    Honor DNT, GPC, saved opt-outs and unreadable privacy choices before capture.

  2. Home-only context

    One same-origin request asks the Cloudflare Worker for trusted, approximate location and request-time context.

  3. Cookieless pageviews

    The native PostHog SDK captures only sanitized pageview events with in-memory persistence.

  4. Independent evidence

    A context response or SDK readiness is not proof that PostHog received or stored a pageview.

Keep the claims bounded

The design documents uncertainty instead of presenting estimates as identity.

  1. Approximate signals

    Browser and device estimates stay local; edge location depends on trusted Cloudflare metadata.

  2. No behavioral profile

    No clicks, funnels, replay, identity record or private analytics query API.

Decisions & trade-offs

Separate the data paths
Approximate visit context is requested only on Home and is never forwarded to PostHog. Pageviews use the SDK’s own privacy-gated path.
Fail closed on privacy uncertainty
DNT/GPC, saved opt-outs and unreadable privacy choices prevent the relevant capture; requests are bounded and not cached.
Document limits, not guarantees
Cookieless capture does not eliminate server-side IP/user-agent processing or guarantee legal compliance.

The result

A static portfolio with separate, privacy-gated pageview and Home-only context paths, presented as a project case rather than a live visitor dashboard.

Location is approximate and depends on trusted edge metadata. Native daily hashing processes IP and raw user-agent. No unique-person, universal retention or legal-compliance guarantee is made.