Skip to content
Sign inStart free trial

Visit duration

Visit duration is the average amount of time visitors spend on your site during a single visit.

MetriXs calculates visit duration as the time between the first pageview and the last event in a visit:

Visit duration = timestamp of last event − timestamp of first pageview

The last event can be a pageview or a custom event.

Like all analytics tools that don’t use persistent tracking, MetriXs cannot know how long a visitor spent on the last page of their visit. There is no “page close” event.

This means:

  • A visit with 1 pageview always has a duration of 0 seconds (only one timestamp available)
  • A visit with 2 pageviews records duration as the time between page 1 and page 2
Time Event Duration so far
09:00:00 Pageview: / 0s
09:02:30 Pageview: /pricing 2m 30s
09:05:00 Pageview: /register 5m 0s
(visitor leaves) Duration = 5m 0s

Time spent reading /register before leaving is not counted.

The dashboard shows the average visit duration across all visits in the selected period. Visits with only one pageview (duration = 0s) are included in this average, which will pull the average down on sites with high bounce rates.

Because duration is last event − first pageview, the last-page problem only bites when a visitor reads a page and leaves without firing any further event. You can recover that lost time by firing custom events during real interactions — each one becomes a new “last event” timestamp and pushes the measured duration forward.

For example, on a long article you can fire a scroll_to_bottom event when the reader reaches the end:

window.addEventListener('scroll', () => {
if (window.scrollY + window.innerHeight >= document.body.scrollHeight - 50) {
metrixs('scroll_to_bottom', { props: { article: 'gdpr' }, interactive: false })
}
}, { once: true })
Time Event Duration so far
09:00:00 Pageview: /blog/gdpr 0s
09:04:30 Custom event: scroll_to_bottom 4m 30s
(visitor leaves) Duration = 4m 30s (was 0s without the event)

Useful signals to fire: scroll-to-bottom, video play/pause, form focus, expand accordion, reach comments.

A note on the interactive: false flag: by default, a custom event counts as a real interaction and will lower bounce rate (a single-pageview visit with a custom event is no longer a “bounce”). If the event is a passive reading signal (scroll, visibility) rather than a genuine engagement, pass interactive: false so it extends duration without distorting bounce rate. See Custom events for the full API.