Heartbeattimer does not work correctly

Hi everyone, we have implemented the heartbeattimer via tag manager.

However, it does not work correctly. No pings are fired.
Any ideas on how to fix this?

Thank you in advance!

The function of the heartbeattimer was changed few years ago. Read more here: https://github.com/matomo-org/matomo/issues/20225


Is there no way to correctly measure the time on page?

In UA we had duration times between 2 and 4 minutes on each page (as we are a publisher) and in Matomo the time on page is stated between 15 and 40 seconds in most of the cases.

Hi @KimCarolyn
Which browser do you use?
Did you activate the SendBeacon?

We are using Google Chrome.
As for the SendBeacon: no, could you explain further?

Thanks a lot!

A JavaScript Snippet for a own really HeartBeatTimer looks like this:

var my_matomo_heartbeat = setInterval(function() {
}, 10 * 1000); // a Ping will be send at every 10 seconds
setTimeout(function() {
}, 5 * (60 * 1000)); // the HeartBeatTimer will be deactivated after 5 Minutes.
// │     │      └ Milliseconds multiplicator (1000 milliseconds = 1 second)
// │     └─────── Seconds (60 seconds = 1 minute)
// └───────────── Minutes
1 Like

Thanks a lot, I’ll try this!