Setting up smart triggers with lookup tabels in Google Tag Manager

I often need to manage a series of tags, where i have to handle multiple business units in multiple languages, where multiple events needs to occur to fire specific variables.

When you are using variables, you are often limited when using lookup tables, as you can only define it from one variable as input / output. However, since the release of the Regex Lookup table, a lot of things have been easier to do.

Everything is an event

Whenever something happens within Google Tag Manager, an event is fired. A DOM load is a gtm.dom event, a Page load is a gtm.load event and so on. In this post I will write about how to use this to make your tracking a bit smarter and your triggers more dynamic.

In my last post i showed how to strip down Floodlight Tag Parameters. As i hate making a ton of tags i thought: “What if i could combine all my floodlight tags into 2 tags“, A counter and a Sales tag, and only having to use the 3 variables necessary  to build them (Category, Source and Type).

To do this i decided to make a very small piece of JavaScript to handle the task:

function() {
var combinedVariables = {{Event}}+{{Page Path}};
return combinedVariables;

This is just an example, but it has endless possibilities. Imagine that you want a tag to trigger once some specific DataLayer variables are present on certain pages? Now you can! Just go an add that in your custom variable and select the things you need for being able to fire your tags. See how I set it up here:

Above i have combined the business unit, with a country, with a event, with a pageview. This means that i can switch between any organisation build into the DataLayer and do any type of combination i need. This is quite need, as it gives me the flexibility to use 3 variables to control 2 floodlight tags instead of 20, saving me time and giving others a better overview when having to use multiple marketing tags.

Join the discussion One Comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.