Are you looking for ways to fire a specific tracking script or pop-up after 20-second-delay? If your answer is Yes, then hop on board, because I’ll show you how to make use of timer trigger (gtm.timer) in Google Tag Manager.

In fact, in Analytics Mania blog, I am also using timer trigger. If you wait 60 seconds (on desktop device), a small widget with email icon will appear at the bottom right corner. That’s a one way to subscribe to my newsletter.


What is 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.

Timer Trigger Explained

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. But don’t limit yourself!

Create 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.

A sample timer trigger could look like this (fires once after 10 seconds on all pages):

Timer trigger example in Google Tag Manager


What Happens in 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.

Timer trigger in GTM preview and Debug mode

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

Timer trigger data layer tab

Every time a timer trigger activates, it pushes 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 data layer and turn it into variable.

If you wish to know the event number (which iteration of timer trigger was just completed), you can create a Data Layer variable gtm.timerEventNumber (see the example below). P.S. dlv – stands for Data Layer Variable.

dlv - gtm.timer

After you create this variable, refresh both P&D Mode and website you’re currently working on. Wait for timer trigger to fire. Click it and head over to Variables tab of Preview and Debug pane. What you’ll see it your newly created variable gtm.timerEventNumber.

timer variable in preview and debug mode

What does it mean? Say, that you set the timer to fire every minute which dispatches Universal Analytics Event tag. That tag sends the following data:

  • Event Category – Visitor spent some time on a page
  • Event Action  – {{dlv – gtm.timerEventNumber}} minutes
  • Event Label – Page: {{Page Path}}

As a result, the final values of the event could look like this:

  • Event Category – Visitor spent some time on a page
  • Event Action  – 2 minutes
  • Event Label – Page: /blog/post/example

If you keep this event set as “non-interaction hit: false”, it will reduce your bounce rate.

Use Cases of Timer Trigger

If you’re still looking for ideas where timer trigger might come in handy, here is some food for thought.


Postponing Email Popup

As I have already mentioned, I use this type of trigger myself (in this blog) in order to delay my email popup AND blue widget which ask my visitors to subscribe.


Altering bounce rate

Although I don’t personally use this tactic, it’s still worth mentioning. Some digital marketers use a timer trigger to fire a Google Analytics event.

If a visitor stays on a page for more than 60 seconds, a timer trigger activates and GA event called “Visitor Stayed for 60 seconds” fires. It’s important to mention that GA event must use non-interaction:false setting (which is a default in Google Tag Manager).

Such event might dramatically lower your bounce rate because a visitor not only landed on your page (1st interaction), but also stayed for more than a minute (which is considered as another interaction).

Visitors who make the 2nd interaction are not counted as bounced visitors on that page.

Although this sounds very appealing, there’s a reason I don’t use this tactic. A timer trigger activates even if the visitor isn’t actually looking at your page. He/she might simply have opened tens of browser tabs (with your site among them) and currently browse totally different website.

Even if the visitor isn’t interacting with your website, it will count as an interaction in Google Analytics (because you just sent an event after a page is opened for more than 60 seconds).

That’s why I prefer other ways of lowering bounce rate (which I describe in the nearest future).


But Wait, there’s More! Start A Timer Trigger After A Click

This idea came from Simo Ahava. In case you want a timer to start when the user does something (e.g. click), you’ll need to use a Custom HTML tag with custom code. Here’s the code:

It does pretty much the same thing as the timer trigger. The difference is that you can use any trigger you want to fire this custom HTML tag, for example form submission, Facebook Like button click, etc.

Example: Show a popup 10 seconds after visitor clicks LIKE button under your article.

And don’t forget to edit timer interval (var interval) and limit (var limit) in the script above to match your needs.

Also, the keys pushed into dataLayer differ in that the prefix is not gtm. but custom.. So gtm.timerId becomes custom.timerId, etc.


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.

I use it to postpone email pop-up (on this blog), while others utilize it in order to lower bounce rate in their Google Analytics report.

Where do you use timer trigger in your GTM setup? Share your ideas in the comments below.

Julius Fed

Head of Developer Operations at Omnisend. I am highly interested in Google Tag Manager, Google Analytics, Adwords, Email marketing, Email Deliverability, Digital Marketing in general. You can follow me on Twitter.