Skip to content
This repository was archived by the owner on Aug 6, 2026. It is now read-only.

feat(loops): Add analytics events for loops - #3783

Merged
charlesvien merged 3 commits into
mainfrom
feat/loops-analytics-events
Jul 24, 2026
Merged

feat(loops): Add analytics events for loops#3783
charlesvien merged 3 commits into
mainfrom
feat/loops-analytics-events

Conversation

@charlesvien

Copy link
Copy Markdown
Member

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.ts and wires track(...) calls in the loops UI:

  • Loop list viewed and Loop viewed for the list and detail surfaces
  • Loop created, Loop updated and Loop deleted for the lifecycle
  • Loop enabled toggled for pause/resume, with was_auto_paused to separate clearing a billing or failure auto-pause from a routine toggle
  • Loop run started, Loop run blocked (with the backend block reason) and Loop run viewed for the manual-run funnel

Names and property shapes follow the existing conventions in that file: sentence-case names, snake_case properties and EventPropertyMap entries. 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 typecheck and pnpm --filter @posthog/ui typecheck
  • biome check on the changed files
  • vitest run loops in packages/ui (6 files, 113 tests, all passing)

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

@trunk-io

trunk-io Bot commented Jul 24, 2026

Copy link
Copy Markdown

😎 This pull request was merged.

@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 9ab43cf.

@greptile-apps

greptile-apps Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor
Prompt To Fix All With AI
Fix 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

Comment thread packages/ui/src/features/loops/components/LoopsListView.tsx Outdated
@charlesvien charlesvien added the Stamphog This will request an autostamp by stamphog on small changes label Jul 24, 2026
github-actions[bot]
github-actions Bot previously approved these changes Jul 24, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@stamphog
stamphog Bot dismissed github-actions[bot]’s stale review July 24, 2026 07:07

New commits pushed (delta classified non_trivial_delta) — stamphog approval dismissed; re-review running automatically.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@charlesvien
charlesvien merged commit bd0a351 into main Jul 24, 2026
33 checks passed
@charlesvien
charlesvien deleted the feat/loops-analytics-events branch July 24, 2026 07:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Stamphog This will request an autostamp by stamphog on small changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant