Claude Templates / A-tier · High leverage
Growth & SEO
The Customer Analytics Playbook
First-party event tracking that outlives cookie blockers — and costs nothing per event.
CUSTOMER-ANALYTICS-PLAYBOOK.md · 14 sections · 2,384 words · 19 KB · markdown
Own your funnel data. A single page_events table, a hardened /api/track ingest route, visitor-ID rotation, bot filtering, and signup attribution that survives the referrer being stripped. One source of truth that powers the landing-page HUD, the admin dashboard, and every conversion report.
What's inside
- //The page_events schema and the event taxonomy that goes in it
- //A hardened /api/track ingest route with bot filtering
- //visitor_id rotation + the anonymous → identified stitch on signup
- //Signup attribution: UTM capture, referrer classification, AI-source recovery
- //Funnel-step modeling that stays in lockstep across the code
- //Why first-party beats Mixpanel/Amplitude at this scale
When to use it
Week 4, before you start guessing about the funnel.
Build these first
Straight from the file
Trade-off you accept: no out-of-the-box "session replay" or "heatmap." If you need those, layer PostHog OSS on top — but the ingest stays first-party.
Table of contents
- 0. Use this spec
- 1. Why first-party (vs GA / Mixpanel / Segment)
- 2. Architecture
- 3. Schema (Supabase)
- 4. The atomic upsert RPC
- 5. /api/track ingest
- 6. Visitor + session IDs
- 7. Signup attribution (don't break visitor stability)
- 8. Event taxonomy (5–10 events, not 500)
- 9. /api/metrics/live (public HUD counters)
- 10. Admin analytics dashboard
- 11. Churn-risk signal
- 12. Common pitfalls
- 13. Kickoff prompt
How to run it
Drop CUSTOMER-ANALYTICS-PLAYBOOK.md into your repo, then tell Claude Code: “Read CUSTOMER-ANALYTICS-PLAYBOOK.md and implement it in this codebase.” It's written for an agent to execute end to end. Search the file for angle-bracket placeholders and swap in your own project names, domains, and keys before the first run.
More growth & seo playbooks
Topical Authority
The 5-layer model that turns a marketing site into 250-350 pages that actually rank.
Read + download →A-tierSEO/GEO Engine
The autonomous layer — trend discovery, LLM classification, auto-authored pages, tracking.
Read + download →A-tierPre-Sale Chatbot
A grounded pre-sale assistant that builds its own knowledge base on install.
Read + download →