I need to implement this event

setTimeout('pageTracker._trackEvent(\'NoBounce\',\'NoBounce\',\'Over 30 seconds\')',30000);

with the Google Analytics event tracking module, I do not understand how to proceed and create this event, The event is useful for count a bounced visitor only if the visitor leaves before 30 secons, I need to add that event, any help would be appreciated. Thanks

2 Answers 2


I finally found the way of add this event code in google analytics module.

Go to your admin->configs->google analytics

Go to advanced settings then open Custom Javascript code fieldset

Then in the field Code snippet (after) add this snipppet:

setTimeout(“ga(‘send’,’event’,’Profitable Engagement’,’time on page more than 3 minutes’)”, 180000);

I modified the code snippet in order to fit universal analytics code that is the one used in the Drupal google analytics module.

After that you will see how your bounce rates are more accurate


The GA Event Tracking module is designed to react to a number of different binded JS events. You're limited by what DOM events that jQuery can bind to. As such, there is no settimeout event.

One solution that comes to mind is adding some custom JS to the standard GA module. Go to configuration page under the Custom Javascript Code in the Advanced Settings fieldset. There you can add what custom JS needed to trigger your setTimeout GA event.

  • Ok so should I add it as it is? or I need to change something in the script?
    – svelandiag
    Commented Apr 23, 2015 at 16:37
  • I think depending on your setup you might need the ga function. That's really outside the scope of Drupal Answers.
    – Shawn Conn
    Commented Apr 23, 2015 at 17:02
  • 1
    FWIW, in the event tracking I used with UA I use something like this for triggering event tracking: var fieldObject = {'hitType': 'event', 'eventCategory': Category, 'eventAction': Action }; ga("set", fieldObject); ga('send', fieldObject);
    – Shawn Conn
    Commented Apr 23, 2015 at 17:03

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.