`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.
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.
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`.