• Courses
    • Courses
    • Course bundles
  • Blog
  • Services
  • Resources
    • Youtube channel
    • E-books and Guides
    • GTM Recipes
    • View All Resources
    • GTM Community
    • GA4 community
  • About
    • About
    • Contact
  • Login
  • Courses
    • Courses
    • Course bundles
  • Blog
  • Services
  • Resources
    • Youtube channel
    • E-books and Guides
    • GTM Recipes
    • View All Resources
    • GTM Community
    • GA4 community
  • About
    • About
    • Contact
  • Login

September 25, 2020

Google Analytics Settings Variable in Google Tag Manager

Updated: September 25th, 2020

Note: In July 2023, Universal Analytics stops working. It is no longer recommended to do new implementations with Universal Analytics (GA3). Use Google Analytics 4 instead.

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.

 

Video tutorial

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).

 

The problem

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
  • anonymizeIp

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.

Subscribe and Get the Ebook - Real Book Img - GTM for Beginners

 

The solution

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:

  1. You can reuse all settings from the Google Analytics Settings variable.
  2. Don’t use a Google Analytics Settings variable at all, and set all settings manually (within UA tag), instead. Not recommended in many cases.
  3. 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.
override google analytics settings variable

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.

 

Use Cases

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.

Subscribe and Get the Ebook - Real Book Img - GTM for Beginners
Julius Fedorovicius
In Google Analytics Tips Google Tag Manager Tips
5 COMMENTS
Michel
  • Dec 11 2020
  • Reply

Hi Julius,

I'm wondering if we can use the same variable for GA4.. Will it work? And if not, would you advise to use a user variable for the GA4 tracking ID?

    Julius Fedorovicius
    • Dec 11 2020
    • Reply

    It will not work. In GA4, config tag replaced the GA settings variable

Michel
  • Dec 11 2020
  • Reply

Thank you for your quick reply. I think the new config tag confuses me.. In this config tag you need to enter the GA4 tracking ID. With UA, you can use the built-in Google Analytics Settings variable for this, so you don't have to enter the same tracking ID over and over again.

My question is if you can do the same in the GA4 config tag? Instead of entering the GA4 tracking ID manually, can you use the built in Google Analytics Settings variable to store this tracking ID? Or do I need to set-up the config tag only once (so there's no need to store the tracking ID in a variable/constant)?

    Julius
    • Dec 11 2020
    • Reply

    Create config tag once and reuse it in other tags

Yishai Fried
  • Jan 17 2021
  • Reply

How does GA4 treat the utm source, it's not an hit, it applies to the entire session, also how funnels work in GA4

Leave a comment Cancel reply

Your email address will not be published. Required fields are marked *

 

Hi, I'm Julius Fedorovicius and I'm here to help you learn Google Tag Manager and Google Analytics. Join thousands of other digital marketers and digital analysts in this exciting journey. Read more
Analytics Mania
  • Google Tag Manager Courses
  • Google Tag Manager Recipes
  • Google Tag Manager Resources
  • Google Tag Manager Community
  • Login to courses
Follow Analytics Mania
  • Subscribe to newsletter
Recent Posts
  • Introduction to Google Tag Manager Server-side Tagging
  • 3 Ways to Pull Data from Data Layer with Google Tag Manager
  • Cannot See the Google Tag Manager Option in Google Ads Conversion?
Analytics Mania - Google Tag Manager and Google Analytics Blog | Privacy Policy
Manage Cookie Settings