August 20, 2019
Trigger Groups in Google Tag Manager: 6 Use Cases
In the first quarter of 2019, the Google Tag Manager team released a new feature, called Trigger Groups. Initially, I was planning to write a guide about them as soon as the feature was released but seeing other authors doing the same, I decided to wait and think of some additional use cases/examples.
Now I feel like the time has come to revisit this topic. In today’s blog post, I’ll show you 6 use cases where Google Tag Manager trigger groups might come in handy. Additionally, I’ll also walk you through some basics you need to know before diving into this feature.
Table of contents:
- What is a Trigger Group in Google Tag Manager?
- How to create a Trigger Group in Google Tag Manager?
- Generic example
- Let’s test
- Other things to keep in mind
- Use cases for Google Tag Manager Trigger Groups:
- Final words
What is a Trigger Group in Google Tag Manager?
Event tracking in Google Tag Manager depends on triggers. As you probably already know, a trigger is a condition that defines when a certain tag (read: script) must be activated. It can be a form submission, click on a certain element, etc.
However, before March of 2019, it was not easy to combine several events into a single super-condition (for example, if a visitor does X and also Y, then activate the tag Z).
Luckily, those days are now long gone, thanks to Trigger Groups. Trigger group allows you to use a set of triggers and if ALL of them are activated on the same page, a tag (or multiple tags) will be fired.
In this section, I wanted to write some witty analogy comparing individual triggers to superheroes. How are they already quite powerful on their own but combine all their strengths and you’ll get Avengers. Unfortunately, I couldn’t find the right way to express this comparison. Or did I?
I know that this analogy is total overkill and is unnecessary but I wanted to find even the smallest reason to do this mockup. Alright, let’s move on!
Before we dive deeper into use cases, first, let’s take a look at how Trigger Groups work in a nutshell.
How to create a Trigger group in Google Tag Manager?
The workflow here is fairly simple. In your GTM interface, go to Triggers > New > Choose Trigger Group. After that, you’ll see a view like this:
The most important section here is that gray area asking to Choose a trigger. That’s where all separate triggers must be included and turned into this one super condition.
The next step you need to do is to choose the triggers that will be a part of the group. You can do that by clicking the Plus icon and choosing the triggers.
Then choose triggers to include in the group.
And after you do that, you will see something like this:
While working with Trigger Groups, you need to keep two things in mind (well, actually there are more but these two are the key):
- If ALL triggers within the group are activated at least once on a page, then the trigger group will be activated and all the associated tags will be dispatched.
- You can even add a single trigger more than once in the same trigger group. In that case, that trigger will need to be activated the corresponding number of times for the entire group to be triggered.
Important: if you refresh the page, all activated triggers within the trigger group reset as well (meaning they will have to be triggered once again in order for the trigger group to fire a tag). But if you know/understand how Data Layer works, this should not surprise you.
For this example, let’s say I have two triggers in the group. One tracks clicks of a call-to-action button (that opens a popup) and the other one tracks the form submission within that popup.
To make this work, first I need to create two separate triggers, one for the click, the other one for the form submission. I will not dive deeper into the exact rules/conditions of those individual triggers (for inspiration, you can check my other two guides on click and form submission tracking).
After both triggers are created, let’s create a Trigger group. Go to Triggers > New > Trigger group. Click the Plus icon and include both triggers.
You can either take the long route (choosing and adding triggers one by one), or you can just hover your mouse on trigger icons and tick all checkboxes you need (in order to pick several triggers at once).
After this is done, a final result might look like this. After you’ve selected all the triggers you wish to have in the group, hit Save.
Then assign this trigger group to a tag that you want to fire when both those events occur on a page. Now, it’s time to test.
Enable the GTM Preview and Debug mode and go the page where you plan to test that trigger group.
Complete all the actions that activate triggers of that trigger group. The order of those triggers is irrelevant. You could first activate trigger A, then B, and vice versa.
When BOTH triggers are activated (and you see them in the preview and debug mode), after that, you’ll see a new event called Trigger Group.
Click it, and you’ll see the tag that you have assigned to that GTM trigger group. That’s it!
Other things to keep in mind
There are several more things you should know:
- The order in which you add triggers to the group does not mean anything. The only thing that matters to the group is whether ALL triggers in it are activated at least once per page.
- The trigger group is fired only once per page. Even if all triggers (that are within the group) fire once again, the trigger group will remain silent. As of the moment of writing this blog post, there is no way to reset the trigger group (in order to fire it multiple times per page).
Even though this feature is really awesome, it’s not perfect.
Caveat #1. You cannot reset trigger groups
When this feature was released, one of my first questions was How can I properly work with trigger groups in single page applications? What should I do if a visitor/user navigates from one state to another and I want to reset the trigger group to start from scratch?
Unfortunately, this cannot be done right now. I tried to reset GTM’s internal data model by using the following method:
But after failed attempts and some conversations in the community, I learned the hard truth that this feature is not yet available. Hopefully, this will change in the future.
Caveat #2. A higher chance of stuffing the container with too many separate triggers
Another caveat is the need to actually create separate triggers before including them in the trigger. If I want to create a more complex trigger group (that includes maybe 5 triggers), first I need to create those 5 triggers as separate entities and only then include them in the trigger group.
Another way to approach this (at least this sounds good in theory) would be to create all the trigger conditions within the Trigger group. I mean that I would like to configure the event names and their conditions within the group’s settings.
Or maybe even better, I’d like to have a combination: the ability to include some already existing triggers but also be able to add some additional rules to extend the functionality of a trigger group.
But once again, I might be totally wrong. Maybe I just imagine this feature to be helpful but in the end result, this would be a totally inconvenient nonsense.
Caveat #3. No mechanism to preserve the trigger group across multiple pageviews
Every time a page reloads, a trigger group resets. If you want to track when a visitor clicks the X button on page A and then completes another action on page B, this would not be possible without additional tweaks.
And by saying tweaks, I mean utilizing cookies or browser’s storage. As of this moment, Trigger Groups do not offer such a feature.
Use cases for Google Tag Manager Trigger Groups
Alright, now that we have run through some basics/essentials of the feature, let’s take a look at examples. Obviously, this is not the final list (nor will there ever be one) but I found these the most common from my experience.
#1. Timer + scroll trigger
This example is the most popular if you have already seen other guides or videos on this topic. However, it’s too good to skip.
If you want to track visitors and consider them as engaged if they scroll at least 50% of the page height and also stay on a page for at least 60 seconds, this can now be easily achieved with Google Tag Manager trigger groups.
First, let’s create a timer trigger with the following settings:
Then, it’s time for the scroll trigger. Just be aware that the time limit and scroll threshold I chose is totally arbitrary. You can choose/set whatever you find the most appropriate.
Then create a trigger group, include both triggers and voilà. You just got yourself a more complex condition to fire a tag. This group can be used to activate a Google Analytics event tag that sends the event engaged user (or you can use any other name).
#2. Timer + scroll trigger + page attribute
The first thing I had to do in my email marketing platform was to set the popup to appear immediately. I did that because I want to take full control of it with Google Tag Manager.
Now, let’s talk about the triggers in GTM. As for the Timer and Scroll trigger, I will be using the same triggers from Use Case #1. But in addition to that, I’ll add another trigger, page view.
This time, I want a popup X to appear only when:
- A visitor scrolls for more than 50% of the page height
- AND a visitor spends more than, say, 60 seconds
- AND a visitor is on a page of which category (or in this case, a blog post tag) is “gtm-intermediate”.
My blog runs on WordPress, therefore, it has built-in functionality to add tags to each article (These tags have nothing to do with tags in GTM. These are the old school blog post tags.).
Currently, I categorize my blog posts based on the level of GTM (beginner, intermediate or advanced). Naturally, I’d like to display different popups based on that GTM level.
Why would someone (who’s experienced) like to subscribe and get the e-book Google Tag Manager for Beginners? Usually, this just does not make sense.
That’s why I want to offer some other GTM goodie for those who browse my articles that belong to the intermediate-gtm bucket.
Anyway, that’s enough for the reasons why I implemented this. Let’s go to the actual setup. If you’re working with WordPress, you should be using the brilliant GTM4WP plugin. It adds a lot of awesome functionality needed for Google Tag Manager. One of them is pushing article tags to the Data Layer (before the pageview event).
Here’s an example of what that dataLayer.push looks like:
Now I would simply need to create a Data Layer Variable that accesses the pageAttributes (this is the name that the GTM4WP plugin uses) and use it in the Page view trigger.
After all three triggers are ready, include them in a group.
P.S. Alternatively, the pageAttributes condition can be implemented directly in the timer trigger. This can be done in the section Enable this trigger when all of these conditions are true.
#3. Clicked at least 3 particular elements on a page
Here’s another example. Let’s say that you work with a page that has an FAQ section and all questions there are presented on a single page. If you want to view an answer to that question, you need to click it to expand. In other words, it’s an accordion.
You could track if someone read more than 3 questions (or, to be more precise, expanded questions at least 3 times). Of course, this would also include those cases where a visitor just expands and collapses the same question 3 times, but for sake of demonstration, let’s ignore that part.
Usually, all items in the FAQ list are coded in the same way (and they look identically), therefore, you could create a single click trigger for the list item and include that trigger in the group 3 times (again, this situation is hypothetical and your conditions in the click trigger would look different).
Here are the click trigger’s settings that are applicable to my situation:
And here’s the final result, a trigger group. If the list item is clicked 3 times, the trigger group would be activated.
If you’re just starting with GTM click tracking, take a look at this guide.
#4. Clicked a button and then submitted a form in a popup
Let’s imagine that you’re working on a website where you want to track popup form submissions. But additionally, you want to know how was that popup initiated in the first place.
In this hypothetical example, a popup form can appear under 2 circumstances:
- A visitor clicks the “Send an enquiry” button in the menu bar
- A visitor clicks the “Send an enquiry” button on the product page
If you want to distinguish in your reports how was that popup activated, one of the possible ways is to use the trigger group (personally, I would probably go with something more advanced but this is still a possible use case). Create a trigger for the form submission, for example:
Then create two triggers, one for the “Send an inquiry” button click in the menu bar and the other one for the button on the product page. Once again, I’d like to emphasize that trigger conditions in my screenshots are hypothetical and in your case, element IDs, classes, etc. will most likely be totally different. Here’s an example of a click trigger.
Finally, create two trigger groups, the first one should include the click of the button in the menu bar and the form submission trigger. The other should include the product page’s button click and the form submission trigger.
After this is done, you could create two tags (e.g. Google Analytics events). One will send the event when the form was submitted after clicking the button in the menu bar, and the other one – after clicking the product page’s button.
You get the idea.
#5. Played video + clicked the call-to-action
Another hypothetical situation, yay! This time, let’s imagine that we are working on a landing page where the main hero section contains an embedded Youtube video + a call-to-action button.
You’re interested to know how many call-to-action button clicks happen because of a video player interaction. Yes, I know that the same thing can be accomplished by using Sequence segments in GA. This example is just another illustration of how a particular challenge can be tackled from different angles.
So to make this work, you need to create a Youtube trigger for that specific video. It can track just the “Play” button, or you can require to watch at least 20% of the video. It’s up to you.
Then, create a click trigger that captures the call-to-action button clicks.
Finally (once again), combine them and yet another trigger group is at your service.
#6. Number of pageviews
We’re now entering the realm of Single Page Applications/Websites. Even though I have mentioned that Google Tag Manager Trigger Groups reset on every pageview, this does not apply to SPA.
That’s because SPAs don’t refresh the page. Even though it might look like you have navigated from one page to another, the actual page never reloads, therefore, a trigger group continues to track.
If you’re not familiar with the Single Page Application tracking, it definitely has its nuances. Go and check this guide to learn more.
So if you run a website that is built as an SPA, you could just include the Virtual Pageview trigger 3 times (feel free to choose any other number of pageviews) and the trigger group will trigger itself after that particular number of virtual pageviews.
Why would you find this trigger group useful? After all, GA already provides built-in functionality to create goals based on the number of page views, right? Well, yeah. But not every other tool has such a feature, therefore, this group might be useful with Facebook Pixel, etc.
Google Tag Manager Trigger Groups: Final Words
All in all, trigger groups in GTM is definitely a nice addition to the existing feature set. Even though it lacks some functionality (like the ability to reset the group), I have already managed to save some time cutting various corners and avoiding workarounds in order to combine 2+ unique triggers.
Got any questions? Or maybe you can share some use cases of your own? The comments section is at your service.