matomo-org / matomo

Empowering People Ethically with the leading open source alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. Liberating Web Analytics. Star us on Github? +1. And we love Pull Requests!
https://matomo.org/
GNU General Public License v3.0
19.72k stars 2.63k forks source link

Clarify in docs that "enableHeartBeatTimer" JS feature does not actually simply send a "ping" every x seconds #20225

Open matomoto opened 1 year ago

matomoto commented 1 year ago

Matomo Version: 4.13.1 Matomo Update History: 4.11.0,4.10.1,4.9.1,4.7.0,4.6.2,4.6.1 Matomo Install Version: Unknown - pre 3.8. Latest Available Version: 4.13.1

Hello, i have a question about the enableHeartBeatTimer in case of the setting of the seconds like _paq.push(['enableHeartBeatTimer', 30]);.

I have used a _paq.push(['enableHeartBeatTimer', 1]); and have observed, that the Heart Beat Timer do not accept a value lower than 5, also 5 seconds is the minimum. It is also only possible to set the Heart Beat Timer max or higher than 5 seconds. This information is missing in the documentation. https://developer.matomo.org/api-reference/tracking-javascript https://developer.matomo.org/guides/tracking-javascript-guide

The next matter is, that the information about the "sent" of data is not correct. Matomo sent only when the real view-time on page is greater than 4 seconds and the leaving of the page is detected by matomo. In other cases no data will be sent.

The next matter is the information:

... then a ping request will be sent

"Ping" is a bit misleading in the context of specifying seconds. Not every x seconds a ping is sent, but only one by leaving the active view of the page.

Concluding
The name enableHeartBeatTimer is a little bit misleading, because it is not a interval (setInterval). It is more/near a beforeunload (but not really a beforeunload). It is a leaveactiveview.

Somewhere the false information is circulating that the heart beat timer should not be set to too fast (less than 15 or 30 seconds), so that the requests are not too high. But - since only a maximum of 1 request is sent with the heart beat timer anyway - the question is: why it is not set to 1 second by default? Then there is finally an accurate measurement result.

MatomoForumNotifications commented 1 year ago

This issue has been mentioned on Matomo forums. There might be relevant details there:

https://forum.matomo.org/t/change-the-heartbeat-time/49237/3

Findus23 commented 1 year ago

I think this is because the behavior changed with https://github.com/matomo-org/matomo/pull/15058 and before it was actually a ping every x seconds.

sgiehl commented 1 year ago

Ok. So this is more about updating/improving the documentation.

matomoto commented 1 year ago

Hello sgiehl,

Ok. So this is more about updating/improving the documentation.

Should I open a new issue for the matter with the 5 seconds?

sgiehl commented 1 year ago

Afaik it's on purpose that less than 5 seconds is not allowed.

matomoto commented 1 year ago

@sgiehl , notice: i need a value less than 5 seconds (1 second). Please give the matomo users the choise over that.

sgiehl commented 1 year ago

So for you it it relevant to see how long in detail a user visited a certain page less than 5 seconds?

I guess we added the 5 seconds limit for some reason. maybe @tsteur can remember why.

matomoto commented 1 year ago

@sgiehl , in one of my websites many of the "time on page" are between 0 and 10 seconds. For a better observing of visitors interests, i have a

setInterval(function() {
_paq.push(['ping']);
}, 1000);

for the first 11 seconds. With this, i see the differences between the "time on page". One, there are so called website-hopper, wich visit only one page without further actions. Second, there are multi-page viewer, who click very quickly through the website. This is not a problem. The thing is, that i must track accurate to every second to see the less or more interests, otherwise i don't see a difference between this visits. 0 seconds time on page are less, 3 seconds time on page more interest.

MatomoForumNotifications commented 1 year ago

This issue has been mentioned on Matomo forums. There might be relevant details there:

https://forum.matomo.org/t/0-sekunden-aufenthaltsdauer-pro-url/49486/2

MatomoForumNotifications commented 1 year ago

This issue has been mentioned on Matomo forums. There might be relevant details there:

https://forum.matomo.org/t/0-sekunden-aufenthaltsdauer-pro-url/49486/10

MatomoForumNotifications commented 1 year ago

This issue has been mentioned on Matomo forums. There might be relevant details there:

https://forum.matomo.org/t/heartbeattimer-does-not-work-correctly/52742/2