Time on page: how is it calculated?

Hi,

I can see from your API documentation that you send Heartbeat ping events to determine how much time visitors spend on a page, where the frequency in seconds goes like this: 15, 30, 60, 120, 240, 480, 960, 1800.

The documentation also says that when a page loses focus these pings will be paused until the focus is restored.

However, I am still unclear on what exactly happens when the page is restored. From my tests using the Tracker debugger, I have the impression that when the page is restored Piwik PRO sends all those pings that would have been triggered if I had left the page active in quick succession? Does this mean that the time on page will include all the time my page was not in focus?

Can you please explain exactly how the time on page calculation is made, maybe using the simple example below?

  1. I go to the home page of the website and I stay there for 45 seconds.
  2. Then I open a new tab on my browser and go do something else for 10 minutes.
  3. After 10 minutes I select my homepage again and stay on the page for an additional 60 seconds.
  4. I open again another tab and stay there for several hours (long after the session times out).

What would be the total time that gets recorded for the homepage in this example?

Thank you!

1 Like

I am also interested in an answer to this:

However, I am still unclear on what exactly happens when the page is restored. … Does this mean that the time on page will include all the time my page was not in focus?

Can anyone from Piwik offer insights on this? @anthonybartczak, @kuba or @Jarek ?

Hi @dav, @joao

@kamilb responded to this in a different thread. Does this answer your question?

1 Like