Avg time on page... how is it calculated?

Hi all !

I noticed recently something that confused me quite a lot: many pages on my website are granted of visits lasting ( I quote piwik :slight_smile: ) 00:00:00s. I guess it happens, people closing immediately a window they just opened by mistake, but here it seems to occur an unusual number of time.

So here is my question: how does this “avg time on page” work ? What is it calculating exactly and how is it doing it ? If piwik displays a 00:00:00s visit, does it really mean that the visitor left immediately after opening the page ?

(Sorry for such a basic question… I guess it was already raised and most likely answered a hundred time, but I’ve failed to find the information so far :frowning: )

Thanks in advance for your help !

Hello gain,

Sorry for upping my own topic but the question is quite important to me. Can’t someone explain how this “avg time on page” works ? (or is my question stupid ? )


I’m also interrested ! Does anyone know how it measures it ?

Hi guys,

it’s the average amount of time users spent doing this action. It’s processed by taking the time for the NEXT pageview and substracting the time of this page view.

In case the page was the last page on the website, we could a time on page of 10 second.

The time spent on a page will be improved once we work on this feature request: Support Ping requests to report a better 'time on page' · Issue #2041 · matomo-org/piwik · GitHub

Hi !

Thanks a lot for your answer. I’d just like to be sure I understood :
When it is the last visited page, is it a 10s or a 0s visit that is counted ? If it’s 10s, then what can lead to a 0s visit ? Is it only a page immediately closed after its opening ?

Thanks again for your help,

Hi Jean,

Sorry I wrote 0s or 10s and actually Piwik sets the time to 0s

note this will change and become a good approximate average time (and not 0s) once we work on: Support Ping requests to report a better 'time on page' · Issue #2041 · matomo-org/piwik · GitHub

Thanks a lot for clearing things up !

have a nice day.

Good news! Starting in Piwik 2.14.0 the new feature of tracking how long users stay on page (using a Heart beat timer “ping” request) has been released. You can enable it with


By default, a ping request will be sent every 15 seconds. You can specify a custom ping delay (in seconds) by passing an argument, eg,

_paq.push(['enableHeartBeatTimer', 10]);

Learn more in the Tracking JavaScript guide: JavaScript Tracking Client: API Reference - Matomo Analytics (formerly Piwik Analytics) - Developer Docs - v3

Update today to enjoy this new feature (as well as many other improvements!)

In my opinion times Average time means the average time all the visitors spend on the website. If ten people visited on the site like 1 visitor spend 60sec, 6 visitors spends 120sec, 3 spend 240sec etc then the total avg. time will be
((1x60) + (6 x 120) + (3 x 240)) / 10 = 150
so, the average time will be calculated like this.