Add PostHog account analytics foundation
Record successful account creation, approval, and login as separate steps. Use immutable account IDs and allowlisted properties without private inputs. Plannotator review returned no changes requested. Typecheck, all 93 tests, production build, and diff checks pass.
2 decisions
Send account analytics through the PostHog capture API using waitUntil and an explicit property allowlist.
Why
- Keep analytics delivery outside the response path
- Exclude private account inputs and raw URLs
- Keep delivery failures separate from business outcomes
Touches
analytics.tsindex.ts
Keep collection disabled until the intended deployment is explicitly enabled.
Why
- Prevent development and test activity from polluting pilot measurements
- Separate account approval from user activity and product activation
Touches
wrangler.jsoncproduct-analytics.md
6 files changed · +233 −4
apps/backend/analytics.ts+52 −0
apps/backend/index.ts+11 −3
apps/backend/test/analytics.test.ts+110 −0
docs/product-analytics.md+52 −0
worker-configuration.d.ts+0 −0
File too large to display
wrangler.jsonc+8 −1