Commit Graph
4 Commits
Author SHA1 Message Date
Federico D'Eredità 92e9b276d2 fix(queries): count custom events correctly on the hourly rollup, trying to address greptile findings
`website_event_stats_hourly` sets `views` to
`sumIf(1, event_type NOT IN (2, 5))`, so `views` is 0 on custom event
rows and the `events_count` join was summing zeroes. Switched it to
`sum(length(event_name))`, which is how `getWebsiteSessionStats`
already counts custom events on that table.

Also dropped the `getEventExpandedMetrics` change from the previous
commit. That report is filtered to custom events, so every visit it
lists has already fired at least one, and its `bounces` column counts
visits where the event fired exactly once rather than visits with a
single pageview. The threshold rule does not apply there, so the query
is left untouched.
2026-07-26 18:49:59 +02:00
Federico D'Eredità 82a5a12208 refactor(constants): simplify BOUNCE_THRESHOLD parsing
`parseInt(undefined, 10)` returns NaN and the `|| 1` fallback already
covers it, so the `|| '1'` default was redundant.
2026-07-26 18:49:59 +02:00
Federico D'Eredità cb035fdc1a feat(queries): add BOUNCE_THRESHOLD and enhance bounce calculation logic
Updated bounce calculations to account for visits with custom events
(`EVENT_TYPE.customEvent`). A visit counts as a bounce only when its
custom event count is below `BOUNCE_THRESHOLD`, so engaged single
pageview visits are no longer misreported.

Since #3614 was opened v3 moved `getInsights` into `getBreakdown` and
copied the old formula into the channel, pageview and session
breakdowns, so those are updated too.
2026-07-26 18:49:59 +02:00
Federico D'Eredità 19fcde2c9c refactor(queries): replace hardcoded event types with constants
Replaced hardcoded `event_type` values with named constants from
`EVENT_TYPE`, as in #3614. Added the `BOUNCE_THRESHOLD` constant and
documented it in `docker-compose.yml`.
2026-07-26 18:49:58 +02:00