Imagine you have a client that has 10 franchised businesses across the USA. Same templated websites, goals, offers, etc. What works on one, works on all the others. The client wants you to implement conversion tracking and advertise their businesses. Let’s say that the best way to do it is to have a separate Google Ads account for each business.

Now, you have several options. One, you can implement 10 unique GTM containers on each website, build 10 triggers, 10 Google Ads conversion tags, and set up 10 conversions in each Google Ads platform. That would work, but it would take a lot of manual work. And what if you have 60 such businesses?

If you implement the same GTM container on all websites, you can use either Lookup Table or RegEx Table variables and do the same work but with less effort.

 

Lookup Tables

Before we take on a technical setup, let me cover why you should even care about this. If your goal is to only track a page view of the Thank You page as a conversion, you can use a lookup table to enter each URL (example1.com/thank-you.html, example2.com/thank-you.html, etc.) and based on which page (business) the user is, the appropriate Google Ads Conversion label (example) would be outputted.

Think of it as a simple IF-THEN statement. 

If the URL is example7.com/thank-you.html then the output of the Lookup table variable is 71234568 which is the Google Ads Conversion label for the business number 7. 

Same for all other businesses. You don’t have to make 10 triggers and tags, just two variables (Google Ads Conversion Labels and IDs). Then you need one trigger (page URL  contains “thank-you”) and one Google Ads Conversion Tag. You would just add the appropriate Lookup variables to the ID and Label fields. Much simpler and much less time-consuming.

Still not sure you got it, or you want to see how to actually make it happen? Let’s go!

You can find them in GTM under Variables > User-Defined Variables > New > Variable Configuration > Utilities > Lookup Table

You will see this:

Lookup And RegEx Tables in Google Tag Manager 1

Looks easy but a bit alien as well

Input variable: choose what will you use as your IF statement. In our example, that’s the page URL.

Now we need to add each URL EXACTLY as it is. So our finished variable should look like this:

Lookup And RegEx Tables in Google Tag Manager 2

I used only four rows because I’m lazy

Now repeat the process for Google Ads Conversion Label. The neat part is that you can recycle the URLs. If you have a lot of them you can use a spreadsheet and import that, but that’s a topic for another time.

Now your Google Ads Conversion Tag, the only one you will need for all 10 businesses, would look like this:

Lookup And RegEx Tables in Google Tag Manager 3

One of a few cases when easy, peasy, lemon, squeezy doesn’t turn to difficult, difficult, lemon, difficult

You may have noticed that the Lookup table works with exact matches (think exact negative keyword in Google Ads). But what if we need more?

Enter RegEx tables.

 

RegEx Tables

What is RegEx? It’s short for Regular Expression. I won’t dive deeper into RegEx, but I can recommend you THIS YouTube video that explains it pretty well. 

Now, let’s make it interesting and use the same example but a different goal. The client is really impressed by your GTM skills and now wants you to implement GA4 tracking for all 10 businesses. Let’s also say you need 10 GA4 properties, each business will have it’s own. Again, you can do it by making 10 GA4 config tags. But, since you’re already going with one GTM container for all websites, let’s go down that road. As we said, Lookup Table works with exact matches (URLs in our case). So we can’t use that. We will RegEx table variable.

Look for it in the same place as you did for Lookup Table. When you open it, it looks the same. Let’s choose Page URL again. However, instead of entering exact URLs, we will enter each domain using RegEx because we want our GA4 tag to fire on all pages.

Our strategy is to have a GA4 Config tag for all businesses, but GA4 measurement ID (same as tracking ID for UA) will fire based on the URL. If the user is on the example4.com website, the variable will output GA4 measurement ID for GA4 for business 4. The variable will act like a sorting hub.

Ok, let’s implement this. Btw, if you want to test your RegEx, I recommend RegExr (LINK) or RegEx101 (LINK)

Now our tag looks like this:

Lookup And RegEx Tables in Google Tag Manager 4

Useful and saves time, doesn’t it?

The regEx ((http|https):\/\/example1.com) is used to include HTTP and HTTPS options, but since most websites now use only HTTPS you might not need it. I wanted to show you an example use of RegEx.

That takes care of the variable, you just need to add it to the tag so it would look like this:

Lookup And RegEx Tables in Google Tag Manager 5

Again, this is the only tag you’ll need for all X number of businesses

If you want to play with these variables but don’t have a 10 templated businesses handy, you can use your sandbox website, or any website for that matter, and configure the Lookup table to fire on a specific page and output specific event name (works for UA and GA4). If the URL contains sample page output the event name sample_page_view or something similar.

I hope this will save you some time and make your life easier.

Have fun 🙂

 

Want to learn more about digital marketing? Check out our other blog posts:

Ivan Vatović is a PPC Specialist and Trainer at the Will Marlow Agency. Keeping up to date with the latest Google Ads releases, Ivan is in charge of educating our team on the most important industry news and changes. He’s the go-to person to ask for anything related to Google Analytics 4 and Google Tag Manager.

Marketing Certification Badges

 

Data-Driven Training

We created Royku to train marketers in data-driven marketing.

Lesson Templates