tracking-foundation
Use when setting up the analytics and tracking stack for a site — GTM, GA4, PostHog, Clarity, server-side tracking, CAPI fan-out, and attribution. Also use when the user says “set up tracking” or “analytics stack”.
| Model | Source |
|---|---|
| sonnet | pack: seo |
Full Reference
Tracking Foundation
Section titled “Tracking Foundation”Everything else depends on this. SEO audits, CRO analysis, performance monitoring — all built on analytics data. If that data is wrong, every downstream decision is wrong.
This orchestrator builds the complete analytics and tracking foundation from scratch or repairs an existing broken one. Six sequential phases, each building on the previous.
Quick Reference
Section titled “Quick Reference”| Phase | Task | Time |
|---|---|---|
| 1. Audit | Current state — what’s Green / Yellow / Red | 15–30 min |
| 2. GTM | Tag management, data layer, Consent Mode v2 | 30–45 min |
| 3. Analytics | GA4 + PostHog + Clarity — all three in parallel | 30–45 min |
| 4. Conversion | /api/track endpoint with two-tier consent + CAPI fan-out | 60–90 min |
| 5. Attribution | First-party identity, UTMs, click IDs, attribution model | 30–45 min |
| 6. Verification | Platform checks, dedup, consent, end-to-end flow | 30–45 min |
| Total | 3–6 hours |
Reference Index
Section titled “Reference Index”| I want to… | File |
|---|---|
| Audit current tracking state and set up GTM with Consent Mode v2 | reference/audit-and-gtm.md |
| Configure GA4, PostHog, and Microsoft Clarity | reference/analytics-layer.md |
| Build the /api/track endpoint with CAPI fan-out, dedup, and PII hashing | reference/conversion-pipeline.md |
| Implement attribution tracking and verify the complete setup | reference/attribution-and-verification.md |
Usage: Read the reference file matching your current task from the index above. Each file is self-contained with code examples and inline gotchas.
Announcement
Section titled “Announcement”┏━ 🔍 tracking-foundation ━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ Build or repair the complete analytics stack — ┃ ┃ GTM, GA4, PostHog, Clarity, and CAPI fan-out ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛