Group PostHog events by workspace
Send repository, work, and member.joined events with a workspace group keyed by namespace ID. Set the workspace kind through $groupidentify on successful repository events. Pass the namespace to the web merge path so work events carry namespace_id. Plannotator review returned no changes requested. All 104 tests, typecheck, production build, and diff checks pass.
3 decisions
Group PostHog events by workspace, keyed by namespace ID, and count the north star as weekly workspaces with work.landed.
Why
- The north-star metric is weekly workspaces with accepted agent work, not people
- Solo developers and small teams must appear as separate workspace rows
Assumes
- Existing workspaces receive their kind on their next successful repository event
Touches
analytics.tsindex.tspushes.tssessions.tsproduct-analytics.md
Carry namespace_id on work events and pass the namespace into the web merge path.
Why
- Workspace grouping needs the namespace on every work event
Touches
analytics.tsindex.ts
Send only the namespace ID and kind to PostHog for a workspace, never its name, slug, or handle.
Why
- Namespace names and handles identify pilot members
- The owner maps workspace IDs to pilot members outside PostHog
Touches
analytics.ts
8 files changed · +39 −21
apps/backend/analytics.ts+11 −6
apps/backend/index.ts+4 −4
apps/backend/pushes.ts+1 −1
apps/backend/sessions.ts+2 −2
apps/backend/test/provision-analytics.test.ts+5 −2
apps/backend/test/pushes.test.ts+2 −1
apps/backend/test/repository-analytics.test.ts+5 −3
docs/product-analytics.md+9 −2