简体   繁体   中英

Using JavaScript to trigger Google Analytics to register interaction with a single page website to reduce perceived bounce rate

I have a single page website, and I am going to be starting Google Ads, I would really like to get as much data as possible from Google Analytics, but of course my bounce rate is always sky high due to the site being a single page site.

Is there a way in which I can use a JavaScript event to trigger Google Analytics into thinking there was page interaction, for example if the user scrolled 25% of the page?

Thanks!

You can achive it in at least 2 ways (in my opinion second one is much faster, easier and elegant):

  1. Write your own javascript code which will bind page scroll event and than send Google Analytics event. Docs (for new gtag.js): https://developers.google.com/analytics/devguides/collection/gtagjs/events (send it as "interactive" [events by default are send as interactive]; it means that event will be considered in calculating bounce rate and in "time on page" metrics)

  2. Install Google Tag Manager on your page and just use built in mechanism which allows to measure scroll depth and many other things. You can check how to set it up here: https://www.simoahava.com/analytics/scroll-depth-trigger-google-tag-manager/

If you choose second option (Google Tag Manager) i recommend also to remove your google analytics code from page template and run it through Google Tag Manager.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM