Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent 1 action 0 seconds stats #16982

Open
matomoto opened this issue Dec 19, 2020 · 3 comments
Open

Prevent 1 action 0 seconds stats #16982

matomoto opened this issue Dec 19, 2020 · 3 comments

Comments

@matomoto
Copy link

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) {
 _paq.push(['ping']);
});

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(){
	_paq.push(['ping']);
	matomosetintervalcount++;
	if (matomosetintervalcount > 4) {
		clearInterval(matomosetinterval);
	}
}, 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
Copy link
Member

tsteur commented Dec 20, 2020

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
Copy link
Author

@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
Copy link
Member

tsteur commented Dec 23, 2020

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants