September 25, 2020
Google Analytics Settings Variable in Google Tag Manager
Updated: September 25th, 2020
If you’re just starting to work with Google Tag Manager and you plan to implement Universal Analytics (Google Analytics) tags, remember this: it is a MUST to use the Google Analytics settings variable. Why? Let me show you.
If you prefer video content, here’s a video tutorial for you that will explain why you MUST use the Google Analytics settings variable in every GTM setup (where Universal GA is involved).
My story with Google Tag Manager begins with the idea of managing Google Analytics tracking codes much easier. I bet yours too, right?
One of the biggest problems with Universal Analytics in Google Tag Manager has been how to manage a larger number of different GA tags within one container. If you have ever tried to create them in a container (and I’m 110% sure that you have), you probably noticed that you need to configure settings in every tag individually, for example:
- Tracking ID
- cookie settings
and these are just several examples.
The key takeaway here is that this must be done in every Google Analytics tag. If you have just 5 tags, this is not a big deal. But what if you reach 50 tags? Or 100? Or even more?
Here’s an example. I have a container with 12 Google Analytics and in every tag, I had to manually enter the GA tracking ID (UA-XXXXX-X).
What if you then need to add a custom dimension (or some other setting) to all tags? That’s a lot of clicking and time-wasting right here.
What if we could set some GA parameters in one place and then all Google Analytics tag would inherit that automatically?
Well, the good news is that you can do that with Google Analytics settings variable and this blog post + video is dedicated just for that.
Google Analytics settings variable acts as a central location to configure sets of Google Analytics settings for use across multiple tags. You configure them in one place and then all GA tags (that use this variable) inherit all the changes.
So, instead of this (where several tags are using individual configuration (even though it is the same)):
You could have this:
And this is used not only for tracking ID setting. Any Universal Analytics parameter can be configured on the level of the GA tag.
Where can I find this new variable?
The new user-defined variable is waiting for you in the variable creation menu, the Utilities section.
All fields in this variable are optional, except Universal Analytics Tracking ID (UA-XXXXXX-X). If you click More Settings, you’ll see all the fields available for configuration.
Add Google Analytics settings variable to Universal Analytics tag
To add this centralized Google Analytics settings variable to Universal Analytics (a.k.a. Google Analytics) tags, click the drop-down under the heading Google Analytics Settings that instructs you to select a variable from the list.
If you don’t have one yet, just click “New Variable” in that very same dropdown.
Don’t worry, you can still configure settings individually for this tag, but with one centralized variable, this becomes unnecessary in many cases. Please keep in mind, that you’ll still need to add an individual trigger(s) to this tag.
Google Analytics Settings variable is for UA settings only, such as Enable advertising features, cookieDomain, cross-domain-tracking-related settings, etc., not triggers.
Google Analytics settings variable offers you three ways to create and manage Universal Analytics tags:
- You can reuse all settings from the Google Analytics Settings variable.
- Don’t use a Google Analytics Settings variable at all, and set all settings manually (within UA tag), instead. Not recommended in many cases.
- Use a combination of both: set the fields with a Google Analytics Settings variable, and then override some fields with custom values within the Universal Analytics tag (this is handy, for example, in Enhanced Ecommerce configurations).
The first way. When you apply the variable and save the tag, all Google Analytics settings are fetched from the GA settings variable. This is the most light-weight and straightforward way to implement the variable.
If (after some time) you want to add some additional setting to all GA tags, just configure it in the GA settings variable.
The second way can be chosen by ticking Enable overriding settings in this tag checkbox (in your Universal Analytics tag). By doing so, you’ll completely ignore any Google Analytics Settings variables in the container and just configure the tag independently for a particular tag only.
But this is not very scalable. If you choose this method and eventually, your container grows to 20 or more tags, you’ll end up with a lot of manual work.
The third way is a mix of the aforementioned two methods. This is useful if you want the benefit of the GA settings variable, but you want to make some adjustments for this tag in particular. Example:
- In your GA settings variable, you have configured cookie settings and the GA tracking ID.
- But in a particular GA event tag, you also want to configure a custom dimension.
In this case, your configuration would look like this:
This means that all settings are inherited from the GA settings variable (including the GA tracking ID), but additionally (just in this tag) we will also send a custom dimension No.1 that contains the name of the author of the article/blog post.
Here are a couple of ideas of how you can use the Google Analytics settings variable (but remember, the sky’s the limit).
Cross-domain tracking. If you website/store/etc. spans across different domains, then you had to set the following settings with each Universal Analytics tag, such as Allow Linker: true, Auto Link Domains: example.com.
Now, there’s one variable to rule them all.
GDPR-related settings. It is always a good practice to anonymized IP (meaning that it will be a little modified and no longer be personally identifiable information). You can learn more about the GDPR configuration here.
Final words regarding the Google Analytics Settings Variable
This is a great time-saver. I remember the older times (pre-2017) when we had to configure GA tags individually in Google Tag Manager. There were some workarounds (you might still find older blog posts suggesting to use the Constant Variable), but they were never the perfect solution.
So if you were wondering why should you use the Google Analytics Settings Variable in GTM, I hope that this blog post + video answered that. It just makes the work more streamlined and human mistakes less frequent.