1

On one of my pages I have Javascript code, so when the user clicks buttons the page responds without going to an other page or doing an Ajax call.

So the user can be on the page for a while pushing the buttons. Does Analytics track time on page by monitoring button clicks automatically?

Or do I have to create an analytics event explicitly in the code run by the buttons, so Analytics knows the user is still on the page interacting with it?

2

Google Analytics by default only measures time on page between page views. All in-page interactions such as button presses, mouse movement, and scrolling do not cause any data to be sent to Google Analytics.

You need to implement events for in page interactions that you want to count towards time on the page. That includes button presses that don't load a new page.

See the Google Analytics event help documents for information about how to implement that.

  • Thanks, that's incovenient, because then I have to add events just for this, so analytics doesn't think the user is bounced when he's still on the page. I'd think analytics could monitor button presses, for example, because if the user presses a button on the page then he's doing something even if there is no new pageview, so it should take it into account for time spent on the page. – Tom Feb 11 at 16:16
  • Yes, annoying that button presses aren't tracked by default. I end up adding events to all my sites. – Stephen Ostermiller Feb 11 at 16:22
1

I have to say, that much easier way is for you to use Google Tag Manager. 1.You will end up with less code on site 2.You can add/remove/reconfigure tags at any moment you want without bothering programmers or entering the code. 3.You can set a lot more tracking scripts easier 4.You can pull out and send a lot more data with a lot less effort.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.