In the interest of trying to generate more meaningful insights, I have inserted the following Event snippet into my Google Analytics Tracking code:

setTimeout("gtag('event', 'adjusted bounce rate', {'event_label':'more than 45 sec'})",45000 );

As you can see, I want to be able to class all page visits at 45 seconds or more, as being 'Engaged' whether they Bounce or not.

As I understand, Analytics software measures the time spent on a page, using the following simple equation:

(Timestamp of 2nd Internal Page Load Time) - (Timestamp of 1st Internal Page Load Time) = Time spent on page.

In the event that there is no '2nd Internal Page', the Analytics will assign 'Timestamp of 2nd Internal Page Load Time' a '0' after the 30 minute session has surpassed. Thus, generating a Bounce.

Common instances of when no 2nd Internal Page is generated being:

  • Visitor clicks back;
  • Visitor selects an on page External Link;
  • Visitor loses connection.

Is there anyway I could modify the Google Analytics code, to be able to factor in the Load time of an External Link in order to get a more accurate 'Time Spent on Page' metric in the event of a Bounce?

Possible Solutions

  • Google Analytics: Does Google Analytics have some kind of other event, which tells you how long someone has been on your page for, even if they select an external link? I have yet to come across it.
  • Maths Logic: Maybe there could be a way to modify the tracking code to have the following Event calculation:

    (Event: Clicked on External Link/Back Button Timestamp) - Timestamp of 1st Internal Page Load Time Time = Time spent on page if external link/back button is selected.

1 Answer 1


Google Analytics tracks events as an interaction with the website. Without interaction GA registers 00:00 time.

In your case if there is an event fired before 45 secs for different conditions, you will get the time spent on the page.

If you have a page with longer scroll and less interaction, I would recommend using scroll tracking (i.e. event fired when user scrolls x% of the screen) as this will help you see how much user interacts with your content and removes users who didn't find content relevant. For example user clicking on back button before scrolling 10% of the page might not be relevant after all.

  • For external link clicks

Fire an event when an external link is clicked.

  • For page back

Use scroll tracking events for %of screen

  • User loses connection

In this case analytics hit won't be registered but the session will end. If you still want to achieve it, you can look into batch processing (A complex implementation typically used with mobile tracking, only recommended if you have more offline user interaction, maybe a subway application :p)

  • Thanks for a few of the pointers. Just experimenting at the moment as I expand my Analytics knowledge. I have just come across support.google.com/analytics/answer/1136920?hl=en I have 3 Analytics Tracking Codes on the website. How would I 'assign' each script to each Tracking Account/Code?
    – Craig
    Commented Aug 23, 2018 at 22:41
  • Glad to be of help. I think this query is different than you are asking in your original post. This would require more info to suggest anything. Please create a new question with the details.
    – AnkDasCo
    Commented Aug 23, 2018 at 22:48
  • Thought as much. I have popped my follow question over at: webmasters.stackexchange.com/questions/117282/… if you think you may be able to assist on my follow query. Regardless, thank you once again, for your time!
    – Craig
    Commented Aug 23, 2018 at 23:18
  • Everything is correct, just wanted to comment that all this will work only if Non Interaction Event is set to false (default value) developers.google.com/analytics/devguides/collection/gtagjs/…
    – Emirodgar
    Commented Aug 24, 2018 at 7:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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