Skip to content

feat(analytics): Events card + eventName filter on Web Analytics - #565

Merged
Makisuo merged 1 commit into
mainfrom
feat/web-analytics-events-card
Aug 21, 2026
Merged

feat(analytics): Events card + eventName filter on Web Analytics#565
Makisuo merged 1 commit into
mainfrom
feat/web-analytics-events-card

Conversation

@Makisuo

@Makisuo Makisuo commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

What

Adds a custom events card to the Web Analytics page and an eventName page filter.

  • Query enginewebAnalyticsEventsQuery: top track() event names by firings (count()) with distinct sessions (uniq(SessionId)); rollup (web_events.Kind='custom') / raw (session_events.Type='custom') pair behind the existing withWebEventsFallback. host/pagePath narrow to the page the event fired on (same reading as Pages); replays dimensions reach it via the existing semi-join; its own eventName filter is excluded so the alternatives stay listed.
  • eventName filter on the shared WebAnalyticsFilters: a single SessionId IN (SELECT … WHERE Kind='custom' AND EventName = ?) semi-join, appended to replaysWhere and both navigationWhere* (so KPIs, chart, pages and all 12 breakdown branches narrow). matchingSessionsSubquery strips it to avoid nesting the same semi-join twice. navigationConditions* generalised into eventConditions*(kind).
  • Contract/APIWebAnalyticsEventsRequest/Response, POST /web-analytics-events, handler; registry pair webAnalyticsEvents/…Raw.
  • Web — 5th "Events" card (Event / Events / Sessions, viewsLabel on BreakdownDimension), sidebar "Event" section (hidden when nothing is tracked), ?eventName= URL param + event:<name> chip, webAnalyticsEventsResultAtom.
  • Tests — builder fixtures (default / url-filtered / semi-joined) + regenerated catalog.sql baseline; parity e2e gains the events query plus event / event+path filter cases (seed already has custom rows).

Why

track() events were ingested and rolled up into web_events but nothing outside the per-session replay rail aggregated them.

Reviewer notes

  • Baseline diff: the eventName semi-join is inlined into every branch of the all-dimensions-filtered breakdown union (same shape as the navigation semi-join); the new webAnalyticsEventsQuery:semi-joined fixture shows own-filter exclusion.
  • Verified in the dev app against real data: 40 event names render; clicking a row set ?eventName=onboarding_started, narrowed sessions 86.3K → 528 across KPIs/sidebar, kept all rows in the card with the selection highlighted; chip clears it.
  • bun typecheck, sql-catalog.test.ts, src/ch unit tests green. ClickHouse parity e2e not run locally — CI clickhouse-schema-e2e should cover it.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Custom `track()` events were stored (session_events Type='custom',
web_events Kind='custom') but nothing on the analytics page read them.

- webAnalyticsEventsQuery: top event names by firings + distinct sessions,
  rollup/raw pair with the usual web_events fallback; own filter excluded
- `eventName` page filter: one SessionId semi-join against the custom rows,
  applied to every query on the page (KPIs, chart, pages, 12 breakdowns)
- Events card (5th in the grid), sidebar Event section, URL param + chip
- builder fixtures + regenerated SQL baseline, parity e2e cases
@Makisuo
Makisuo merged commit 4ba4c42 into main Aug 21, 2026
32 checks passed
@Makisuo
Makisuo deleted the feat/web-analytics-events-card branch August 21, 2026 23:19
@Makisuo
Makisuo deployed to pr-preview August 21, 2026 23:19 — with GitHub Actions Active
@github-actions

Copy link
Copy Markdown

🍁 Maple PR preview

Note

Preview resources were removed when this pull request closed.

Final commit dd36e97 · View workflow run

Makisuo added a commit that referenced this pull request Aug 21, 2026
Carry the Events card + eventName filter (#565) onto the product_events
rename: useWebEvents -> useProductEvents, WebEvents -> ProductEvents,
withWebEventsFallback -> withProductEventsFallback, and mount the new
eventsResult on the analytics view beside the funnels tab. sql-catalog
baseline regenerated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant