← knowledge.oriz.in

Analytics — 5-tier stack (CFWA + GA4 + PostHog + Clarity + UTM)

decision analyticsdecisionsarchitectureclarityga4posthogcloudflare-analyticsutm

Analytics — 5-tier stack (CFWA + GA4 + PostHog + Clarity + UTM)

Decision

Every site in the family runs five analytics layers in parallel, each covering a different question with no overlap. All five are free, no card, and each can be killed by a per-site ENABLE_<TOOL>=true|false env-var without affecting the others.

# Layer Service Question it answers
1 Edge / raw load Cloudflare Web Analytics How many real visitors, from where, on what URL? (cookieless)
2 Marketing funnel Google Analytics 4 (GA4) Acquisition / engagement / conversion against the same definitions advertisers use
3 Product analytics PostHog Funnels, retention, feature-flag usage, session replay (product side)
4 Heatmaps + session replay (vendor-redundant) Microsoft Clarity Where do users click / scroll / rage-click; second replay so a PostHog quota miss never blinds us
5 Attribution convention UTM tracking Which channel / campaign drove this session — read by tiers 2-4 from the URL

Why five and not fewer

The user's direction was: "I want to use all of the analytics and all of the Google practices, Microsoft Clarity and everything … I want a free service for everything." Picking only one layer leaves real questions unanswered:

The five layers together answer every operationally interesting question with vendor redundancy on session replay (PostHog + Clarity) and funnel redundancy (GA4 + PostHog). Each layer preserves the family's no-card-on-file rule and each runs at a different vendor, so a single outage / quota trip never goes dark across the board.

Quota safeguards (per rules/interaction/never-hit-quotas.md)

Each layer has a per-site env-var kill-switch:

ENABLE_CFWA=true            # Cloudflare Web Analytics (no real cap)
ENABLE_GA4=true             # GA4 — sampled past 10M events/mo (free)
ENABLE_POSTHOG=true         # PostHog — 1M events/mo, 5K replays/mo
ENABLE_CLARITY=true         # Microsoft Clarity — no documented cap
ENABLE_UTM_HELPER=true      # <UtmLink> validation in @chirag127/oriz-kit

Set any to false per site if a quota cliff approaches. The <Analytics /> component in reads these flags at build time and tree-shakes the unused scripts.

Implications

Cross-refs