Understanding Triggers in Google Tag Manager

Trigger Events

A trigger event is one of the conditions when the trigger should fire/execute. Following are the various events when a trigger can be fired:

#1 Pageview – fire the trigger on pageview

#2 Click – fire the trigger when a click event occurs.

#3 Form – fire the trigger when the form submit event occurs.

#4 History Change – fire the trigger when the user’s current browser history changes.

#5 Custom Event – fire the trigger when the custom event occurs.

#6 JavaScript Error – fire the trigger when a javascript error occurs.

#7 Timer – fire the trigger after a given interval.

In GTM v2, triggers have been made an integral part of a tag creation process, so you can not create a tag without first creating the corresponding trigger.

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

fire on

Creating a trigger while creating a new tag

Moreclick on this button to select an existing trigger or to create and select a new trigger.

Click Trigger

When you click on the ‘Click’ trigger button, you see a ‘Create trigger’ dialog box through which you can select trigger type: ‘click’ or ‘link click’:

create trigger

If you select ‘Click’ from the drop-down menu, your tag can fire on any click on your website, no matter which element a user clicks on.  If you select ‘Link Click’ from the drop-down menu, your tag will fire only on clicks on a link(s).

Once you have selected ‘Link Click’ as trigger type, you will see additional fields: ‘Wait for Tag‘, ‘Check for validation‘ and additional filter field:

trigger link click

Select the checkbox ‘wait for tags‘ to delay the opening of the links until all dependent tags have fired or specified time (i.e. max wait time) has elapsed, whichever comes first.

Select the checkbox ‘Check Validation‘ if you want the tag to fire only when the link has actually being clicked i.e. the click on the link takes a user to another page.

You also need to set up filters to specify when your link click trigger should fire. For example, I want to fire a tag on the page whose URL contains ‘/shop/men/shirts/’ and when the ‘Click ID’ is ‘smshrt’. That’s why I set up the following filters:

url contains /shop/men/shirts

Click ID equals smshrt

Do you want expert help in setting up/fixing GA4 and GTM?

If you are not sure whether your GA4 property is setup correctly or you want expert help migrating to GA4 then contact us. We can fix your website tracking issues.


My step-by-step blueprint for selecting the best Excel charts for data analysis and reporting (40 pages)

Get the FREE e-book on Best Excel Charts For Data Analysis And Reporting (40 Pages)

Download the FREE ebook

 

Form Trigger

 

form trigger2

When you click on the ‘Form’ trigger button, you see a ‘Create trigger’ dialog box:

form trigger

If you select ‘All Forms’, your tag will fire on submit event for any form.

If you select ‘Some Forms’, your tag will fire on submit event but only for selected forms. While configuring your ‘Form’ trigger you get the option to select ‘wait for tags‘ and ‘check validation‘.

Select the checkbox ‘wait for tags‘ to delay the form submit until all dependent tags have fired or specified time (i.e. max wait time) has elapsed, whichever comes first.

Select the checkbox ‘Check Validation‘ if you want the tag to fire only when the form is successfully submitted. If you keep this checkbox unselected then the tag may fire even when a user is just trying to submit the form.

You also need to set up filters to specify when your form trigger should fire. For example, I want to fire a tag on the page whose URL contains ‘/shop/men/checkout’ because this page contains my form. That’s why I set-up the following filter:

form fire on

url contains /shop/men/checkout

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 BeyondSECOND EDITION OUT NOW!
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.

About the Author

Himanshu Sharma

  • Founder, OptimizeSmart.com
  • Over 15 years of experience in digital analytics and marketing
  • Author of four best-selling books on digital analytics and conversion optimization
  • Nominated for Digital Analytics Association Awards for Excellence
  • Runs one of the most popular blogs in the world on digital analytics
  • Consultant to countless small and big businesses over the decade