Blog

Track Multiple Websites With One Google Tag Manager Container

By
Tim Flint
August 27, 2024
Share this post
Flint Analytics + Inc. 5000 custom graphic

Tag Manager has made analysts’ lives easier over the last few years. This is especially true when dealing with multiple websites.

We have many clients that use multiple websites for marketing. They may be a property management company with a website for each property, or a franchise business that has a different website for each location to have local variation in copy, messaging, and more. These clients tend to have a template with similar functionality on their sites, but each site needs its own analytics ID or profile view for varying reasons. Most commonly, because individual managers only need access to a specific site’s data.

What we are trying to track is similar across sites, it would be a pain to create a new container or a new tag for each Google Analytics pageview or event we want to track. That would mean that any change we made to the analytics tracking would have to be done for every site. And depending on the number of sites you have this could be an awful experience.

By default, these sites have similar contact forms, purchasing tools, custom metrics, custom events, etc. With this much similarity and the only difference being tracking, it would be a whole lot of copy and paste work to track all these sites at once. But, we have an easier way to do this. It is called the Lookup table in Google Tag Manager.

Google Tag Manager allows us to ask the question of, “What site am I on?”, and then give the answer by using the proper Google Analytics account. Let’s see how this works.

First you need to create a new variable and select Lookup Table.

Google Tag Manager Lookup Table

Next select {{Page Hostname}} as the input variable. Don’t forget to name this new variable as well. I just named it GA-ID. You can use most characters like dashes or spaces. An error window will pop up if there's a character it doesn't accept.

Page Hostname as Input Variable in Google Tag Manager

If Page Hostname is not available to you, go to the variable section of your container and check the box next to that variable under the “Pages” section.

Page Hostname in Google Tag Manager

Now it is time to set up the input and outputs you want for the table. You must set up one for every hostname you want tracked. Remember that one site will potentially have multiple hostnames. Every subdomain is a hostname. So, example.com, www.example.com, shop.example.com, and blog.example.com are all different hostnames. If your site uses both the www and the non www version then you will need to do an input and output for both. But, it is good practice to generally have your site use one or the other. The screenshot below shows how you would set this up.

Setting up inputs and outputs for Google Tag Manager

These lists can be as long as you need. So whether you have 10 sites or 100 sites, the lookup table should work great.

Time To Use The Variable

Now it is time to use the variable to create a new tag. You use the following process any time you want to create a new Google Analytics tag with a lookup table variable. For example, if you wanted to fire off the general analytics tracking code on every page:

  1. You would create a tag.
  2. Name it.
  3. Select Google Analytics and Universal Analytics.
  4. Then, where it asks for your Tracking ID, you are going to use the variable {{GA-ID}} you created. Either type it in or use the Lego brick next to the form to select it.

Tracking ID in Google Tag Manager

Finally, set your trigger of all pages and publish. Now, when you go to each site in your list it will use the proper tracking id for all the sites in this tag. This gives you one tag that works for all sites that this container is functioning on.

A whole new world of tracking possibilities is open by using the lookup table, and we will be talking about many more of them in the future. Bottom line, countless hours can be saved tracking multiple websites with tag manager. Let us know if you have any questions.

 

Photo Credit: 123rf.com/enotmaks

Let us solve your analytics problem.

Share this post
Tim Flint
Founder

Contact Flint Today

Ready For A New Digital Marketing Partner?

We would love to discuss how we can help you reach your digital marketing goals.  Just call us at (317) 993-3411 or send in the following form today!