How To Add Google Analytics To Google Tag Manager

How To Add Google Analytics to Google Tag Manager Blog Header Image - Intigress

Jump To:

Google Analytics is a very powerful (& free) web analytics tool, which is why it is one of the first things we add to Google Tag Manager. If you aren’t familiar with Google Tag Manager, we recommend reading our article about why you should add GTM to your website before you continue to install Google Analytics. For the rest of this article, we will assume that you have already set up your Google Analytics account and installed Google Tag Manager on your site, and would now like to add Google Analytics to Google Tag Manager (GTM).

Since Google Analytics and Google Tag Manager are both created by Google, the process to add Google Analytics to GTM is relatively straightforward. However, since there are currently two different Google Analytics property types, Universal Analytics (aka Google Analytics 3) and Google Analytics 4 (GA4), you must first decide which one(s) you’d like to add.

Regardless of which version of Google Analytics that you’d like to add to GTM, you will use a GTM tag to add it to your website. The process is very similar, but we’ll go through both processes here to give you the instructions no matter which version of Google Analytics you choose to add to Google Tag Manager.

Before getting started, we recommend having your Universal Analytics tracking ID (UA-XXXXXXXX-X) and/or your Google Analytics 4 Measurement ID (G-XXXXXXXXXX) on hand. If you are looking for an overview of Google Analytics and the two available versions, you can take a look at our introduction to Google Analytics.

How to Add Universal Analytics to Google Tag Manager

There are two things you need to do to add Universal Analytics to GTM. First, to streamline the process, we recommend creating your Google Analytics Settings variable first before you deploy Universal Analytics via GTM.

Google Analytics Settings Variable (for Universal Analytics)

Before we move on, let’s cover what the Google Analytics Settings variable is in context of Google Tag Manager. First, a variable in GTM is a placeholder to store some dynamic value. In the case of the Google Analytics Settings variable, this stores your Universal Analytics tracking code and other common settings so that you can share them consistently between tags, such as your Page view and Event tags. By using this premade variable, you will save yourself a lot of extra work and headaches.

It’s also worth noting that despite its name, the Google Analytics Settings variable is only needed for Universal Analytics tags (not Google Analytics 4).

  1. Log into your GTM workspace by going to tagmanager.google.com
  2. Click Variables on the left
  3. Under “User-Defined Variables,” click New
  4. Give your variable a name, like “Google Analytics – UA Code”
  5. Add the “Google Analytics Settings” variable type
  6. Add your Universal Analytics tracking ID (It starts with “UA-”)
  7. Review the options under the More Settings dropdown. If you’re just starting out, you may not need to change any of these, but this is where you can enable different Google Analytics plugins like Enhanced Ecommerce, Advertising features, Enhanced Link Attribution, set custom dimensions, etc.
  8. Click the blue Save button in the top right corner.
Google Tag Manager Screenshot of Google Analytics UA Code - Intigress
Voila! You have now added your Google Analytics Settings variable to GTM and are now ready to move on to the next step. This will make the rest of your set up easier.

Add Universal Analytics Tag to GTM

Once your Google Analytics Settings variable is set up, you can move on to adding your actual Universal Analytics page view tag that will send data to the Google Analytics servers when your pages load.

  1. Click Tags on the left hand side, then click New
  2. Give your tag a name, such as “GA – Page View”
  3. Under Tag Configuration, choose the “Google Analytics: Universal Analytics” tag type
  4. Make sure Page View is selected under Track Type
  5. Select your Google Analytics Settings variable from the previous section
  6. Make any necessary changes in the Advanced Settings section
  7. Under Triggering, select the All Pages trigger
  8. Click the blue Save button in the top right corner
Google Analytics Page View Tag Screenshot from Google Tag Manager - Intigress

If this is the only tag you’d like to add to your GTM container, preview your changes using the GTM Preview mode, then publish your changes by clicking Submit.

After clicking submit & previewing to make sure your tag is working, you will have successfully added Universal Analytics to Google Tag Manager. Because we selected a trigger for All Pages, you’ll now be able to see web analytics in your Google Analytics account such as the number of page views, average time on site, bounce rate, traffic source, etc, for every page on your website.

If you would like to add more tags, like Google Analytics 4, to Google Tag Manager, proceed to the next section.

How To Add Google Analytics 4 To Google Tag Manager

The process to add Google Analytics 4 to Google Tag Manager is very similar to the one we just went through for Universal Analytics. However, instead of a settings variable that’s referenced in every Universal Analytics tag, Google Analytics 4 tags use a configuration tag to share its settings with other GA4 Tags. This means that there is only one thing that you only need to create to add your Google Analytics 4 tag to GTM. 

Before getting started be sure to have your Measurement ID (G-XXXXXXXXXX) on hand, as you’ll need that to complete this installation.

Add Google Analytics 4 Tag to GTM

  1. Click Tags on the left hand side, then click New
  2. Give your tag a name, such as “GA4 – Config & Page View”
  3. Under Tag Configuration, choose the “Google Analytics: GA4 Configuration” tag type
  4. Make sure Page View is selected under Track Type
  5. Enter your Measurement ID (or select your GA4 Constant variable – see the optional section below)
  6. Make sure that the checkbox next to “Send a page view event when this configuration loads” is checked
  7. Make any necessary changes in the Fields to Set, User Properties, and Advanced Settings sections. These are optional advanced settings so you may not need to change any of these unless required in your measurement strategy.
  8. Under Triggering, select the All Pages trigger
  9. Click the blue Save button in the top right corner
Google Tag Manager Screenshot - Google Analytics 4 Tag Configuration

GA4 Constant Variable (Optional)

Unlike with Universal Analytics, creating a Constant variable to store your GA4 Measurement ID is optional, but not required. If you are just starting out with GTM, your setup likely won’t benefit from creating this variable.

Creating a GA4 Constant variable makes adding your Measurement ID into other tags, triggers, and variables a little easier. It also makes it a little easier to find your GA4 Measurement ID without having to open Google Analytics.

To create a Constant variable, follow these steps:

  1. Log into your GTM workspace by going to tagmanager.google.com
  2. Click Variables on the left
  3. Under “User-Defined Variables,” click New
  4. Give your variable a name, like “GA4 – Measurement ID”
  5. Add a “Constant” variable type
  6. Enter your Google Analytics 4 Measurement ID (It starts with “G-”).
  7. Click the blue Save button in the top right corner.
  8. You can now choose this variable as your Measurement ID in your Google Analytics 4 Configuration tag. See step 5 in the section above.
Google Tag Manager Screenshot of Google Analytics 4 Constant Variable

The very last step when adding Google Analytics 4 to Google Tag Manager is to test & publish your GTM container with the tag(s) that you’ve just added.

Once the new version of your GTM container is published, congratulations! You’ve now added Google Analytics to Google Tag Manager.

Now that you’re on a roll with adding tags, keep going. While this guide shows the basic implementation of Google Analytics via Google Tag Manager, you can use GTM to add other tags like the Facebook Pixel or Google Analytics event tags to track clicks, video views, form submissions and more. Adding these other tags can help you to better understand your online marketing performance and help you reach your business goals.

If you need help with your Google Analytics implementation or adding other tags to Google Tag Manager, contact our Google Tag Manager experts to let us know how we can help!

Share This Article

Share on facebook
Share on linkedin
Share on twitter
Share on reddit
Share on email

Leave a Reply

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