What is Time On Page?

To measure how long a visitor is on a certain page on your website, Burst uses an open source library, TimeMe.js. This is a JavaScript library built to precisely measure how long users actively engage with a web page. It excludes any time when the user minimizes the browser, switches to another tab, or becomes idle—defined as a lack of mouse movements or keyboard activity for a set, adjustable duration. By pausing the timer during these periods of inactivity, this tool provides a pretty reliable reflection of the actual time users spend interacting with a web page.

So how does the calculation of Time On Page work?

The library calculates time on page by monitoring user activity and tracking the time spent on the page. It initializes the timer when the page loads, capturing the user’s arrival timestamp. When the user navigates away, minimizes the browser, or switches to another tab, the library records the timestamp of inactivity. By leveraging events like focus and blur, it can determine when the page gains or loses focus. The focus event marks the page as active, while the blur event signals that the user has left or shifted their attention elsewhere.

The tool uses these timestamps to calculate the duration of active engagement. When the user leaves the page, the time spent between the last focus and blur events is added to a running total. If the user returns, a new focus timestamp is recorded, and tracking resumes. In addition to focus and blur events, the library can incorporate the Page Visibility API for more accurate tracking of visibility changes, ensuring precise calculations even in modern browsers.

By summing up the active durations between focus and blur or visibility change events, we can get a reliable measure of how long visitors interact with a given webpage.

When the user closes the window, or leaves it idle for over 30 seconds, Burst will return this time on page information to the webserver, and stores it there.

The end result is shown in the pages overview: