1000planets-site/spec-kit/decisions/0007-analytics-stack.md

33 lines
1.5 KiB
Markdown

# ADR 0007: Analytics Stack & Privacy
**Status**: ✅ Approved
**Date**: 2025-12-11
**Owner**: Delivery Lead (Analytics)
---
## Context
`spec-kit/checklist.md:13` requires analytics/tracking on the marketing site. We are implementing a dual stack (Plausible + Google Analytics) because Plausible covers privacy and lightweight event tracking while GA provides deeper signal analysis. Both are active without interfering with the privacy promise.
## Implementation
1. **Plausible**
- Script loaded from `https://plausible.io/js/plausible.js` via `app/layout.tsx`.
- Configured with the `NEXT_PUBLIC_PLAUSIBLE_DOMAIN` environment variable (default `1000planets.cloud`).
- No cookies unless the visitor opts in; complies with privacy-first mandates.
2. **Google Analytics (GA4)**
- Loaded via `gtag.js` when `NEXT_PUBLIC_GA_MEASUREMENT_ID` is provided.
- Basic page view tracking configured at load time.
- Additional events (e.g., CTA clicks, form submissions) can be wired in later via `gtag('event', ...)`.
## Deployment Notes
- Add API keys to the server environment (or `.env` for local development) before building.
- Ensure Plausible domain matches the deployed hostname to avoid data loss.
- GA measurement ID should be created in Google Analytics with site ownership verified.
## Monitoring & Governance
- Monitor the Plausible dashboard for spikes and GA for conversion funnels.
- Document any additional events in this ADR as new measurement needs arise.