Google Tag Manager Triggers and Variables Tutorial

This article is related to Google Tag Manager (GTM). If you are brand new to GTM then read the following two articles first:

  1. Beginner’s guide to Google Tag Manager
  2. Google Tag Manager Implementation & deployment Guide

Introduction to Triggers in Google Tag Manager

A trigger is a condition that must evaluate to either true or false at run time.

In GTM, triggers are an integral part of a tag creation process. So you can not create a tag without first creating a corresponding trigger.

There are two methods for creating a trigger in GTM. One is while you are creating a new tag and one is through the triggers menu:

Now watch this short video to improve your understanding of GTM triggers:

There are two categories of triggers in GTM:

  1. Firing triggers (commonly known as triggers)
  2. Blocking triggers

Firing Triggers

A firing trigger (or firing rule) is a condition that must be met (must evaluate to true) at run time, for a tag to fire/execute.

A firing trigger tells GTM when the tag should fire. Following is an example of a firing trigger:

{{url}} matches http://www.abc.com/cart/thankyou.html

This trigger fires the tag when the URL of the currently loaded page matches http://www.abc.com/cart/thankyou.html

There are two categories of firing triggers:

  1. Built-in firing triggers
  2. User-defined firing triggers (also known as custom triggers)

Get the E-book (72 Pages)

Get the E-Book (62 Pages)

Built-in and User-Defined Firing Triggers

Built-in triggers are predefined firing triggers. These are ready to use triggers. User-defined triggers are the ones defined by people like me and you. There are two methods to see the list of built-in and user-defined triggers. One is while you are creating/editing a tag and one is through the triggers menu.

Method-1: While creating/editing a tag

In order to see the list of built-in and user-defined triggers, follow the steps below:

Step-1: Create or edit a new tag.

Step-2: Click on the ‘Choose a trigger to make this tag fire…’ button:

Step-3: Click on the ‘+’ button on the top right-hand side:

Step-4: Click on ‘Choose a trigger type to begin setup’:

You will now see the list of available built-in triggers:

For each built-in trigger, there is a corresponding user-defined trigger available. In other words, GTM lets you customize built-in triggers.

For example, in order to customize a built-in trigger say ‘DOM Ready‘ just click on it and then select ‘Some DOM Ready Events‘:

Following is a complete list of built-in triggers along with their corresponding user defined trigger:

Method-2: Using the ‘Triggers’ menu

In order to see the list of built-in and user-defined triggers using the ‘Triggers’ menu, follow the steps below:

Step-1: Click on the ‘Triggers’ menu:

Step-2: Click on the ‘New’ button:

Step-3: Click on ‘Choose a trigger type to begin setup’:

You will now see the list of available built-in triggers:

Blocking Triggers

A blocking trigger is a condition that must be met (must evaluate to true) for a tag to not fire/execute. A blocking trigger tells GTM when the tag should not fire. You can create a blocking trigger (or blocking rule) by clicking on the ‘Add Exception‘ link while creating/editing your tag. Follow the steps below:

Step-1: Create/edit a tag

Step-2: Scroll down to the ‘Triggering’ section and hover your mouse over this section. You should now see a ‘Pencil’ button. Click on it:

Step-3: Once you clicked on the ‘Pencil’ button you will see an ‘Ad Exception’ link. Click on it:

The rest of the process of creating a blocking trigger is similar to the process of creating a firing trigger.

Note: Whenever your firing trigger contradicts with your blocking trigger then the blocking trigger takes precedence.

For example, if you set a trigger to fire tag on all pages of your website and then you set a blocking trigger which prevents the same tag from firing on the ‘order confirmation’ page then your tag will not fire on the ‘order confirmation’ page even when the tag is supposed to fire on all pages of your website according to the firing trigger.

Introduction to GTM Variables

A variable is a storage location in the computer memory. It has got ‘name‘ and ‘value‘. A variable is referenced by its name. Value is that expression that can not be solved any further. For example, the expression ‘2+3’ is not a value because it can be solved further into 5. However the expression ‘5’ can not be solved further, so it can be used as a value.

In the context of GTM, a variable is a function that can be called from within a tag, trigger or another variable. A variable tells GTM where to fire a tag. For example,

{{url}} matches RegEx .* // fire the tag on any page that is downloaded by a user.

Here {{url}} is a built-in variable (predefined variable) which refers to the URL of the currently loaded page.

Following is the syntax for calling/referencing a variable in GTM:

{{Variable Name}}

You can reference/call a variable in any text field in GTM wherever you can see the ‘variable’ button:

Note: The value of the GTM variable is populated during run time.

A variable is used to store data that is used in defining a trigger and/or to pass information (like product price, google analytics account id etc) to tag(s) at runtime from:

  • Data layers
  • JavaScript Variables
  • First Party Cookies
  • HTML DOM

In GTM there are two categories of variables:

  1. Built-in variables (or predefined variables)
  2. User-defined variables

Built-in Variables in Google Tag Manager

Built-in variables are predefined variables. These variables can not be customized. In order to see the list of built-in variables available to you, click on the ‘Variables’ menu:

Configuring a built-in variable means activating or deactivating the variable from within the GTM interface. Only a particular set of built-in variables are activated by default:

Once a built-in variable is activated it can be used just like any user-defined variable. Activate all of the built-in variables so that they are available to be used anytime. 

In GTM the number and type of built-variables that are available depend upon the type of GTM container being used. Following are the different types of GTM containers:

  1. Web container
  2. AMP container
  3. Android container
  4. IOS container

User-Defined Variables in Google Tag Manager

User-defined variables are the variables defined by people like me and you. If you have created user-defined variables then you can see them by clicking on the ‘Variables’ menu:

The real power of Google Tag Manager lies in the usage of variables.

Another article you will find useful: Google Tag Manager Training Resources

 

Do you know the difference between Web Analytics and Google Analytics?


99.99% of course creators themselves don’t know the difference between Web analytics, Google Analytics (GA) and Google Tag Manager (GTM).

So they are teaching GA and GTM in the name of teaching Web analytics.

They just copy each other. Monkey see, monkey do.

But Web analytics is not about GA, GTM.

It is about analyzing and interpreting data, setting up goals, strategies and KPIs.

It’s about creating strategic roadmap for your business.


Web Analytics is the core skill. Google Analytics is just a tool used to implement ‘Web Analytics’.

You can also implement ‘Web analytics’ via other tools like ‘adobe analytics’, ‘kissmetrics’ etc.

Using Google Analytics without the good understanding of ‘Web analytics’ is like driving around in a car, in a big city without understanding the traffic rules and road signs.

You are either likely to end up somewhere other than your destination or you get involved in an accident.


You learn data analysis and interpretation from Web analytics and not from Google Analytics.

The direction in which your analysis will move, will determine the direction in which your marketing campaigns and eventually your company will move to get the highest possible return on investment.

You get that direction from ‘Web analytics’ and not from ‘Google Analytics’.


You learn to set up KPIs, strategies and measurement framework for your business from ‘Web analytics’ and not from ‘Google Analytics’.

So if you are taking a course only on 'Google Analytics’, you are learning to use one of the tools of ‘Web analytics’. You are not learning the ‘Web analytics’ itself.

Since any person can learn to use Google Analytics in couple of weeks, you do no get any competitive advantage in the marketplace just by knowing GA.

You need to know lot more than GA in order to work in Web analytics and marketing field.


So what I have done, if you are interested, is I have put together a completely free training that will teach you exactly how I have been able to leverage web/digital analytics to generate floods of news sales and customers and how you can literally copy what I have done to get similar results.

Here what You'll Learn On This FREE Web Class!


1) Why digital analytics is the key to online business success

2) The number 1 reason why most marketers are not able to scale their advertising and maximize sales.

3) Why Google and Facebook ads don’t work for most businesses & how to make them work.

4) Why you won’t get any competitive advantage in the marketplace just by knowing Google Analytics.


5) The number 1 reason why conversion optimization is not working for your business.

6) How to advertise on any marketing platform for FREE with an unlimited budget.

7) How to learn and master digital analytics and conversion optimization in record time.

 
 

My best selling books on Digital Analytics and Conversion Optimization

Maths and Stats for Web Analytics and Conversion Optimization
This expert guide will teach you how to leverage the knowledge of maths and statistics in order to accurately interpret data and take actions, which can quickly improve the bottom-line of your online business.

Master the Essentials of Email Marketing Analytics
This book focuses solely on the ‘analytics’ that power your email marketing optimization program and will help you dramatically reduce your cost per acquisition and increase marketing ROI by tracking the performance of the various KPIs and metrics used for email marketing.

Attribution Modelling in Google Analytics and Beyond
Attribution modelling is the process of determining the most effective marketing channels for investment. This book has been written to help you implement attribution modelling. It will teach you how to leverage the knowledge of attribution modelling in order to allocate marketing budget and understand buying behaviour.

Attribution Modelling in Google Ads and Facebook
This book has been written to help you implement attribution modelling in Google Ads (Google AdWords) and Facebook. It will teach you, how to leverage the knowledge of attribution modelling in order to understand the customer purchasing journey and determine the most effective marketing channels for investment.

Himanshu Sharma

Digital Marketing Consultant and Founder of Optimizesmart.com

Himanshu helps business owners and marketing professionals in generating more sales and ROI by fixing their website tracking issues, helping them understand their true customers' purchase journey and helping them determine the most effective marketing channels for investment.

He has over 12 years of experience in digital analytics and digital marketing.

He was nominated for the Digital Analytics Association's Awards for Excellence. The Digital Analytics Association is a world-renowned not-for-profit association that helps organisations overcome the challenges of data acquisition and application.

He is the author of four best-selling books on analytics and conversion optimization:

error: Alert: Content is protected !!