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 you’d like to add to GTM, you will use a GTM tag to add Googel Analytics 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 the 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).
- Log into your GTM workspace by going to tagmanager.google.com
- Click Variables on the left
- Under “User-Defined Variables,” click New
- Give your variable a name, like “Google Analytics – UA Code”
- Add the “Google Analytics Settings” variable type
- Add your Universal Analytics tracking ID (It starts with “UA-”)
- 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.
- Click the blue Save button in the top right corner.
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 setup 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.
- Click Tags on the left hand side, then click New
- Give your tag a name, such as “GA – Page View”
- Under Tag Configuration, choose the “Google Analytics: Universal Analytics” tag type
- Make sure Page View is selected under Track Type
- Select your Google Analytics Settings variable from the previous section
- Make any necessary changes in the Advanced Settings section
- Under Triggering, select the All Pages trigger
- Click the blue Save button in the top right corner
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
- Click Tags on the left hand side, then click New
- Give your tag a name, such as “GA4 – Config & Page View”
- Under Tag Configuration, choose the “Google Analytics: GA4 Configuration” tag type
- Make sure Page View is selected under Track Type
- Enter your Measurement ID (or select your GA4 Constant variable – see the optional section below)
- Make sure that the checkbox next to “Send a page view event when this configuration loads” is checked
- 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.
- Under Triggering, select the All Pages trigger
- Click the blue Save button in the top right corner
GA4 Constant Variable (Optional)
Unlike 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 to 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:
- Log into your GTM workspace by going to tagmanager.google.com
- Click Variables on the left
- Under “User-Defined Variables,” click New
- Give your variable a name, like “GA4 – Measurement ID”
- Add a “Constant” variable type
- Enter your Google Analytics 4 Measurement ID (It starts with “G-”).
- Click the blue Save button in the top right corner.
- You can now choose this variable as your Measurement ID in your Google Analytics 4 Configuration tag. See step 5 in the section above.
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!
5 Responses
This was the most helpful article I found when attempting to move Google Analytics Tags across to Tag Manager. Thank you so much for the clear step by step instructions. Easy to follow, to the point:)
Glad you found this so helpful and easy to follow.
wow.. butter smooth
I’ve used this to set up my GTM a few months ago. But my bounce rate is under 10%. Everything I read says this is either a duplicate tag (not applicable to me) or something called a “non-interaction event” error in my tag configuration. And to fix this, I need to edit my event tag in GTM (non-interaction event=true/false”.) But I don’t have any tags in GTM that are event types. Is the “Google Analytics Universal Analytics Tag” in GTM supposed to be a “page view” tag type or an “Event” tag type?
There are a lot of reasons why your bounce rate could be under 10% (which is why GA4 uses engagement rate instead), but it does seem low. Without looking at your website or GTM configuration specifically, it’s hard to tell what the exact problem is, but it does indeed sound like there is an issue with your current configuration.
Please make sure you have followed our instructions exactly in the “How to Add Universal Analytics to Google Tag Manager” section above to set up your Universal Analytics page view tag properly.
Once you’ve don that, you could also try pausing all UA tags (besides your UA page view tag) and see if that increases your bounce rate, then you can reactivate each tag one by one to better diagnose the issue. If you still need help, feel free to contact us about our Google Analytics setup service.