Skip to content

Accurate Bounce & Time-on-Site Metrics for Long Single-Page Visits (Heartbeat & Engagement Events Support) #3518

@gpicron

Description

@gpicron

Describe the feature or enhancement

Hi Umami team,

The problem

For many content-driven websites (and especially on single-page apps or landing pages), most user engagement happens on a single page, often the homepage. If a visitor spends several minutes reading, scrolling, and interacting—but does not navigate away or reload—the current Umami analytics engine:

  • Counts the visit as a bounce
  • Records time on page as zero seconds

This is because both bounce and time-on-site metrics are calculated using only pageview events, and do not factor in custom events or signals of engagement.

This results in unrealistically high bounce rates and zero time-on-site for highly engaged visitors, which is misleading for site owners and makes it hard to assess actual user engagement.


Proposed Solution

1. Add a native “heartbeat” mechanism to the JS tracker

  • The Umami tracker could automatically send periodic engagement events (e.g., every 15/30 seconds), but only while there is evidence of user activity—such as scroll, mouse movement, keyboard input, or visibility changes.
  • Heartbeats should stop when the tab is hidden, page is unloaded, or there is no further user activity for N seconds.

2. Upgrade backend logic to count these “engagement” events

  • When calculating bounce rate and time-on-site, sessions with at least one “engagement” (heartbeat and others) event in addition to a pageview should not be counted as bounces.
  • Time-on-site for single-page sessions should be calculated as the interval between the first pageview and the last engagement event (mirroring the way Google Analytics and Matomo allow custom events to break bounces).

3. Add a configuration option

  • Site owners should be able to enable/disable this feature for their sites, so those who want to retain the old behavior (pageviews only) can do so.

4. Document recommended practice

  • The tracker documentation should clearly recommend when and how to use this option (e.g., for blogs, documentation sites, SPAs, etc.), and how it affects metrics.

Benefits

  • Much more accurate bounce rate and time-on-site stats for content-rich or SPA sites
  • No need for JS hacks or artificial “pageview” duplication workarounds
  • Cleaner, more reliable engagement analytics—competitive with GA, Plausible, Matomo, etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions