server-side-tracking
Use when implementing server-side tracking, building a unified /api/track endpoint, setting up Conversions API fan-out to Meta/GA4/Pinterest/PostHog, configuring consent management, or implementing PII hashing. Also use when debugging event deduplication, attribution models, or CAPI health.
| Model | Source |
|---|---|
| sonnet | pack: cro |
Full Reference
Server-Side Tracking
Section titled “Server-Side Tracking”A single /api/track endpoint receives every conversion event, enriches it with server-side data, enforces consent, hashes PII, and fans out to every platform in parallel. No ad blockers. No cookie drift. No scattered pixels. One source of truth.
Analytics-tier platforms (GA4 basic events, PostHog) always fire. Marketing-tier platforms (Meta CAPI, Pinterest CAPI, Google Ads) are GPC-gated and consent-checked before every call. The endpoint always returns HTTP 200 — tracking never breaks UX.
Quick Reference
Section titled “Quick Reference”| Item | Value |
|---|---|
| Meta CAPI endpoint | POST https://graph.facebook.com/{api_version}/{pixel_id}/events |
| GA4 MP endpoint | POST https://www.google-analytics.com/mp/collect |
| Pinterest CAPI endpoint | POST https://api.pinterest.com/v5/ad_accounts/{id}/events |
| PostHog package | posthog-node |
| GPC header | Sec-GPC: 1 blocks all marketing-tier platforms |
| Pinterest token expiry | 60 days (continuous refresh since May 2025) |
| Meta event dedup window | 48 hours |
| Meta EMQ target | ≥ 6.0 |
| GA4 session cookie format | GS1 (pre-May 2025) or GS2 (May 2025+) |
| Fan-out method | Promise.allSettled() always — never Promise.all() |
Reference Index
Section titled “Reference Index”| I want to… | File |
|---|---|
| Understand the full pipeline architecture | reference/architecture.md |
| Extract cookies and enrich events server-side | reference/cookie-extraction.md |
| Hash PII before sending to platforms | reference/pii-hashing.md |
| Configure consent tiers and GPC enforcement | reference/consent.md |
| Implement Meta CAPI, GA4, Pinterest, PostHog, and Google Ads fan-out | reference/platform-fanout.md |
| Map events consistently across all platforms | reference/event-taxonomy.md |
| Set up attribution models and identity resolution | reference/attribution.md |
| Configure cron jobs for batch uploads and health checks | reference/cron-infrastructure.md |
| Verify launch readiness with per-platform checklist | reference/launch-checklist.md |
| Know the non-negotiable safety gates | reference/safety-gates.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”┏━ 📡 server-side-tracking ━━━━━━━━━━━━━━━━━━━━━━┓ ┃ Unified /api/track endpoint fanning out to Meta, GA4, Pinterest, PostHog ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛