How To Use Timer Trigger in Google Tag Manager?

Google Tag Manager’s timer trigger allows to send events to Tag Manager at timed intervals. Use this trigger to measure the amount of time a user spends on a page to complete a task (e.g. read an article, fill out a form, or complete a purchase.)

What is a Timer Trigger in Google Tag Manager?

Timer Trigger is a type of trigger which fires after a certain duration of time has passed on the web page.

The most common uses for the timer trigger seem to be either to send an event to Google Analytics after X seconds (to lower the Bounce), or to defer a tag from firing until some asynchronous request has completed with certainty.

Create a Timer Trigger within Google Tag Manager

To get started, you will need to have a Google Tag Manager account (duh) and permissions to edit your website’s GTM container. Create the timer trigger as follows:

  • Add a new trigger.
  • Choose timer as the trigger type.
  • Then, enter the following options:
    • Event Name: This lets you customize the event name that GTM pushes to dataLayer. It’s most useful in the case when you want to fire multiple timers on the same page.
    • Interval: Here you can specify how many milliseconds should pass between each activation of this trigger. Enter 30000 if you want the time trigger to activate after 30 seconds.
    • Limit: This option lets you choose how many times the trigger fires before it is stopped.
    • Also, you can delimit the timer to only fire on specific pages by using the Enable When option. You’ll need to provide some condition which is already present when Google Tag Manager is first loaded, such as Page Path equals /home-page/, or something similar. In my blog, I use timer on all pages, thus Enable When condition is Page Path matches Regex .*
    • Last, you can decide whether you want to fire a trigger either on all timers, or only particular ones. I used All timers.
  • Hit save.

What Happens in the Data Layer?

After you created a timer trigger, enable GTM Preview and Debug mode, then refresh the website you’re currently working on (in order to test how the trigger works).

After preview and debug console appears, wait for timer trigger to activate.

Pro tip by Captain Obvious: for testing purposes create a timer trigger which fires after 10 seconds (or less). If you set it to fire after 60 seconds (or more), you’ll end up waiting way too long and your debugging session will become less effective.

Anyway, let’s go back to our Preview and Debug mode. After waiting 10 seconds gtm.timer event appears on the left side of the pane.

Click it and navigate to Data Layer tab. You should see the array of various parameters.

Every time a timer trigger activates, it pushes a particular set of data to the data layer:

  • gtm.timerId – A unique identifier number for the timer. Each timer you have on the page has a different ID.
  • gtm.timerEventNumber – The number of timers that have activated on the current page.
  • gtm.timerInterval – The value you set in the Interval option when creating the timer.
  • gtm.timerStartTime – The timestamp of when the timer first started.
  • gtm.timerCurrentTime – The timestamp of the most recent timer activation.
  • gtm.timerElapsedTime – The time in milliseconds since the timer started.

The awesome thing about Google Tag Manager is that you can fetch any parameter from the data layer and turn it into a variable.

Why use Time Triggers?

Why use Time Triggers when Google Analytics (GA) can automatically track the time spent by the user on website? Here’s why. GA can only determine the time spent by the users on website by calculating the difference between the timestamp of their landing (or pageview) and their following interaction (or hit) on the site. If a user leaves without a second hit, GA will record the duration as zero seconds, resulting in a highly misleading analytics tracking value, unnecessarily inflating the bounce rate!

For instance, if a user has spent 15 to 20 minutes on the page that they landed on and left the site after that without navigating to any other page or further interaction, GA will treat that visit as a bounce as the user didn’t take any further action or visit another page on your site. This is highly misleading and also frustrating for blog owners to see a high amount of bounce rates.

This problem of inflated bounce rate is effectively resolved by using the Time Triggers! Time Triggers in Google Tag Manager facilitate more accurate tracking of various web analytics metrics like time spent on the site, bounce rate, and session duration and so on.

Google Tag Manager Timer Trigger: Conclusion

Although timer trigger is pretty basic, it’s one of those must-have weapons in your Google Tag Manager arsenal. It’s fairly easy to use and allows you to postpone a certain tag for a particular period of time.

Need help with Digital Analytics? Get in touch: