1

I have recently come across the relative importance of creating an 'Adjusted Bounce Rate' Metric. In order to do this, the following code needs to the integrated into the Google Analytics coding:

setTimeout("_gaq.push(['_trackEvent', '15_seconds', 'read'])",15000); 

The seconds can obviously be changed to whatever is needed.

My current tracking code is as follows:

<script async src="https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxxxx-x"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-xxxxxxxxx-x');
</script>

Whilst I have come across many articles, showing how to integrate the above line of coding, they all seem to use Google Tracking Codes which differ to mine.

As such, I am just wondering if anyone knows where I should place the line of coding into my own above Google Analytics tracking code?

2

Add this code to your snippet on pages that you need adjusted bounce rate to. You are trying to make old ga.js code with gtag.js code.

setTimeout("gtag('event', 'adjusted bounce rate', {'event_label':'more than 15 sec'})",15000 ); 
  • Thanks for your suggestion. Where, within the snippet, would I place this? – Craig Aug 18 '18 at 1:53
  • Just below your gtag('config', 'UA-xxxxxxxxx-x'); amd inside script tag. I would recommend testing this on a dev environment first before pushing it into production – AnkDasCo Aug 18 '18 at 1:57
  • If this works please mark this as an accepted answer so that it can help others too – AnkDasCo Aug 18 '18 at 2:07
  • Great! Thanks for your insight. I'll test run this, for a few days, where I will Accept/Modify question accordingly. – Craig Aug 18 '18 at 2:22
  • Because we are sending an event. You can check in real time reports if it is working or not. – AnkDasCo Aug 18 '18 at 9:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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