feat(loops): Add analytics events for loops - #3783
Conversation
|
😎 This pull request was merged. |
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
Prompt To Fix All With AIFix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
packages/ui/src/features/loops/components/LoopsListView.tsx:105-106
**Builder-session count freezes early**
When persisted builder sessions exist while their task summaries are still loading, this effect permanently records the pre-liveness-check count, causing `builder_session_count` to include sessions that are subsequently removed as ended.
Reviews (1): Last reviewed commit: "add loops analytics events" | Re-trigger Greptile |
There was a problem hiding this comment.
Purely additive analytics instrumentation (new typed events, track() calls in loops UI) with no schema, API contract, billing, auth, or CI changes; the one substantive Greptile finding (builder-session count freezing early) is directly fixed in this diff via the new isSettled gating, and the author has STRONG familiarity with this code.
- Author wrote 90% of the modified lines and has 26 merged PRs in these paths (familiarity STRONG).
- 👍 on the PR from greptile-apps[bot].
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✓ | no deny categories matched |
| size | ✓ | 353L, 7F substantive — within ceiling |
| tier | ✓ | T1-agent / T1d-complex (353L, 7F, single-area, feat) |
| stamphog 2.0.0b3 | .stamphog/policy.yml @ f969fec · reviewed head ace377f |
New commits pushed (delta classified non_trivial_delta) — stamphog approval dismissed; re-review running automatically.
There was a problem hiding this comment.
Pure analytics instrumentation (new event definitions plus track() calls) with no data-model, API-contract, billing-logic, or security changes; the one Greptile concern about premature builder-session counting is fixed by the accompanying isSettled gating logic, and the change is well covered by new tests.
- Author wrote 90% of the modified lines and has 26 merged PRs in these paths (familiarity STRONG).
- 👍 on the PR from greptile-apps[bot].
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✓ | no deny categories matched |
| size | ✓ | 366L, 8F substantive, 789L/10F incl. docs/generated/snapshots — within ceiling |
| tier | ✓ | T1-agent / T1d-complex (789L, 10F, single-area, feat) |
| stamphog 2.0.0b3 | .stamphog/policy.yml @ f969fec · reviewed head 9ab43cf |
Problem
Loops has no product analytics beyond the three promo-card events, so we cannot see adoption, configuration choices or run engagement for the feature at all.
Changes
Adds a typed loops event family to
packages/shared/src/analytics-events.tsand wirestrack(...)calls in the loops UI:Loop list viewedandLoop viewedfor the list and detail surfacesLoop created,Loop updatedandLoop deletedfor the lifecycleLoop enabled toggledfor pause/resume, withwas_auto_pausedto separate clearing a billing or failure auto-pause from a routine toggleLoop run started,Loop run blocked(with the backend block reason) andLoop run viewedfor the manual-run funnelNames and property shapes follow the existing conventions in that file: sentence-case names, snake_case properties and
EventPropertyMapentries. Properties carry only ids, enums, booleans and counts, never loop names or prompt text. No visual changes, so no screenshots.How did you test this?
pnpm --filter @posthog/shared typecheckandpnpm --filter @posthog/ui typecheckbiome checkon the changed filesvitest run loopsinpackages/ui(6 files, 113 tests, all passing)Automatic notifications