Google Tag Manager and Multiple Domains: How to Configure? (2024)

Updated: September 11th, 2023

So, you have probably landed on this article because you are working with multiple domains (e.g. domain1.com and domain2.com) and have some doubts on how to handle Google Tag Manager. Should you use one GTM container on all domains? Or should you use one container per domain?

In this guide, I’ll show you how to handle Google Tag Manager on multiple domains. These tips apply to subdomains too.

Video tutorial

If you prefer video content, here’s a tutorial on my Youtube channel.

Google Tag Manager does not care about domains or subdomains

As the subtitle of this chapter has already spoiled, the GTM container does not care about how many domains you use it on. If you want, you can use the same container on five related websites (that are hosted on different domains or subdomains). Even though (most likely) this will cause you some headaches, there are no technical limitations.

When it comes to managing Google Tag Manager on multiple domains, the main thing you should be thinking about ismanagement. Will it be convenient to manage tags, triggers, and variables of 5 different websites in a single container?

Think about this. You have a tag that you want to fire on all pages of the domain1.com (but not on the domain2.com). Reminder: you are using the same GTM container on both domains.

In this case, theAll Pages trigger will not work because it will fire on BOTH domains. But you need to fire it only on one. What do you do? You need to create a Pageview trigger that fires only on domain1.com.

As time goes by, you will notice that the number of assets in your GTM container grows exponentially: a lot of tags, triggers, and variables that are related only to one domain. But since you are working on multiple domains at the same time, the number of assets is 2x, 3x (or more) than it should be.

Eventually, the container might even exceed itsmaximum size,and you will be forced to either get rid of some items or migrate to separate containers.

Also, larger container = more resources to download for your browser. This affects page performance as well.

It is recommended to use one GTM container per domain

Having the previous example in mind, always think about how different those websites (on different domains or subdomains are). How likely are you going to need a tag, trigger, or variable that is needed only on domain1.com but not on domain2.com.

If the answer is “very likely”, then you need to use separate GTM containers per domain/subdomain.

By using separate GTM containers, you’ll notice a smoother tag management process. There will be fewer tags/triggers/variables, triggers will be less complex (with fewer conditions and exceptions). It will be easier for you to find particular container elements (rather than browse hundreds of assets).

Even if you are operating on the same domain but have separate subdomains, for example,blog.mydomain.com, support.mydomain.com, and www.mydomain.com,you (probably) should use separate GTM containers.

Why? Because those subdomains serve different purposes, their structure is different and, most likely, you will be measuring different things.

  • onblog.mydomain.com,you will probably be tracking content consumption, email opt-ins, how visitors engage with your content (blog posts), etc.
  • onsupport.mydomain.com, you will be tracking how visitors engage withyour help articles, how they create or close tickets.
  • on www.mydomain.com, you will be tracking how visitors sign up for your product (or maybe purchase your products), how they engage with your landing pages, etc.

Most likely, all those websites will have different elements, classes, and ids. Therefore, your triggers will be very much subdomain-specific. And in that case, one container per subdomain makes tag management easier.

Sometimes it makes sense to use one GTM container on multiple domains

On the other hand, I don’t always recommend having separate GTM containers. What if the websites are pretty similar?

Here’s what the process looks like if each website has its own GTM container (even though they all are being tracked with the same Google Analytics Property, same Facebook Pixel, same interactions are being measured, etc.):

  • You configure particular changes in container A.
  • Then you need to copy the same changes to containers B and C. You can try to do that manually (oh no!),export a part of the container with gtmtools.comor use theGTM Copy/Paste extension.
  • And this will happen every time you implement a change. Far from an efficient and agile work process!

But if you had one GTM container across all three websites, one single change would be applied to all three websites instantly.

Of course, sometimes you will want to fire a tag only on one website but the scale of such “unique” tracking implementations will probably be pretty low.

Hard to imagine similar websites on different subdomains or domains? Here’s an example: a business with localized versions, for example:

  • country1.mybusiness.com
  • country2.mybusiness.com
  • country3.mybusiness.com

or a more common scenario – completely different domains.

  • mybusiness.com
  • mybusiness.co.uk
  • mybusiness.de, etc.

All websites are almost identical structure-wise, code-wise. The main difference is translations.

In this situation, you should ask yourself and other people involved in the tracking/analytics + your boss: are you going to track the same things on all domains/subdomains of different locations or not? If the answer isyes orvery likely, then it makes sense to use the same container for all the domains/domains of similar websites.

If the answer isnot sure, not likely, or just a plain no, then create a separate Google Tag Manager container for each domain/subdomains.

What about things like Google Analytics?

The way you structure your tracking tools like Google Analytics or Facebook Pixel does not matter to Google Tag Manager. The number of GTM containers has absolutely no relationship to the number of GA properties or Facebook Pixel accounts you use.

If you want to track visitors across different subdomainsor domainsof your business, then you will need to use the same GA property. But that does not mean that you need to use the same GTM container. Every website can use a different Google Tag Manager container but send the data to the same GA property. This applies to any other tool that you have installed via GTM.

Google Tag Manager and Multiple Domains: Final words

When it comes to deciding the number of containers, I always think of the structure of websites and what kind of things I am going to measure.

Are your websites (hosted on different domains/subdomains) very similar (in terms of content, structure, etc.)? Or are they quite different?

  • If you have, say, three websites that are very similar and the main difference is localization (language), thenI’d recommend using the same GTM container on all three websites. Because, most likely, you’ll be tracking the same things on all websites. But you should definitely discuss that with your colleagues, boss or someone else who is involved. Ask if you will be tracking similar or different things on those domains. The more differences there will be, the higher chance of separate GTM containers.
  • If you have three websites that are different in terms of their content, structure, and functionality, e.g., an online store, a blog, and a support page,I’d recommend using separate containers for each websitebecause (probably) each one of them will have pretty unique tags, triggers, and variables.

Google Tag Manager and Multiple Domains: How to Configure? (2024)

References

Top Articles
Latest Posts
Article information

Author: Saturnina Altenwerth DVM

Last Updated:

Views: 5786

Rating: 4.3 / 5 (64 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Saturnina Altenwerth DVM

Birthday: 1992-08-21

Address: Apt. 237 662 Haag Mills, East Verenaport, MO 57071-5493

Phone: +331850833384

Job: District Real-Estate Architect

Hobby: Skateboarding, Taxidermy, Air sports, Painting, Knife making, Letterboxing, Inline skating

Introduction: My name is Saturnina Altenwerth DVM, I am a witty, perfect, combative, beautiful, determined, fancy, determined person who loves writing and wants to share my knowledge and understanding with you.