@matomoto opened this Issue on December 19th 2020

Matomo 4.0.5.
Hi, how can i prevent the “1 action 0 seconds” visitor stats?

I have added this code snipped:

window.addEventListener('beforeunload', function(e) {

and i have a mouseleave event arranged.
Both have an effect of the stats, but i have still “1 action 0 seconds” visitors in the stats.

mouseleave prevent only by desktop visitors a “1 action 0 seconds”, because via the event it is a “action”. And this different is visible in the stats. Desktop mouseleave visitors also not longer “1 action 0 seconds”. Than i have very little bit “1 action <15 seconds”. This, i think, are the effect of beforeunload. And i think this is also only affected by desktop visitors, because beforeunload don't work on mobile devices.

I will not use the heartbeat, sorry, it is also not a solution, because, this log only >15 or >5 seconds.

Yet i have added this code snippet:

var matomosetintervalcount = 0;
var matomosetinterval = setInterval(function(){
    if (matomosetintervalcount > 4) {
}, 1000);

It is similar to heartbeat, but reverse. Yet i have only a few “1 action 0 seconds” visitors, and more “1 action 3/5/6/7 seconds”. I Think this is the effect of the setInterval. Though, it is imprecise in the visit time.

My question is therefore a different one. Apparently the "1 action 0 seconds" are all mobile device visitors and not everything works there. So how could this be improved, for example beforeunload also works on mobile devices? Or how could a setInterval() be better designed?

@tsteur commented on December 20th 2020 Member

Both have an effect of the stats, but i have still “1 action 0 seconds” visitors in the stats.

Hi @matomoto which stats exactly do you refer to?

I think beforeunload works on mobile see https://caniuse.com/?search=beforeunload

@matomoto commented on December 23rd 2020

@tsteur, it's a curiously thinking! :)
fact: beforeunload don't work on all mobile devices.
If you want to change the status, please update all browsers on all mobile devices. Good luck!

@tsteur commented on December 23rd 2020 Member

@matomoto is there anything more to do from our side? I think we can close this issue? Unfortunately there's otherwise no other way if beforeunload doesn't work in older mobile browsers.

Powered by GitHub Issue Mirror