How is the time on a page calculated?

Hello,

I want to analyze how long users stay on the different pages of my site.

I have this information in my data exports but sometimes I find “0s”. But this is not possible, because to go to the next page, they must spend at least 5 seconds on it

How is this calculated?
Maybe it’s only calculated from the moment the user’s page is fully loaded?

Thanks!
Mathie

Hi Mathie,

Great question! One common way of finding those zero seconds is the user’s last pageview/event. If Matomo don’t get any signal from the user it cannot calculate the time on page. For instance those bouncing users that do not trigger any events before they leave.

A couple of questions though:

  • What user-agent do those users typically have?
  • Can there be bots in your data?
  • Do you ever experience long loading of your tracking script? I’ve occasionally seen several seconds load time in some instances and things like that might contribute to some loss of data.

On the question on exactly when Matomo “starts its clock”, perhaps someone else familiar with the event firing order in browsers and the tracking script have some input?

Also have a look at:

(the use of senBeacon allows a more acurate visit time)

1 Like

Hello !

This is not the last action of the user

  • The user is on IE 11, but I have this problem only on one action. The data is correct on his other actions
  • There is no bot
  • The pages load very fast and there is no script that takes time.

Maybe the user moved to the next page before the page finished loading. And that the timer was not triggered?

@heurteph-ei Thanks, I’ll look 0:)

EDIT:

@heurteph-ei

It’s ok by default no ? => Note: use of sendBeacon will be enabled by default starting in Matomo 4.

Maybe the user moved to the next page before the page finished loading. And that the timer was not triggered?

My Javascript skills is rudimentary, but yes, I think that the order of loading external Javascript files and resources on each webpage may be impacting your findings.

Is this about one single user? On multiple visits?
If not, are you seeing any patterns such as the 0s is more common on certain URLs? Pages with bigger footprint and users with similar equipment…

The sendbeacon feature doesn’t work on IE11:
https://caniuse.com/?search=sendbeacon