Setting up Google Analytics with Tag Manager

Posted by Vernon Joyce
January 14, 2020

There are a couple of ways to report website performance, but I would argue that none are as powerful as Google Analytics. This is especially true when used in conjunction with Google Tag Manager and I would almost argue that it’s a non-negotiable.

Tag Manager gives you much more scale-ability; and this is especially useful when it comes to custom events, data layer and some other concepts that we won’t cover in this article. For this reason I would personally recommend setting up Google Analytics through Tag Manager as opposed to using the default embed script – and I’ll briefly cover how this can easily be done.


  • Register an account Google Analytics
  • Copy or save your Google Analytics tracking code (UA code)
  • Start a new account on Google Tag Manager (you can use the same login details as with your GA account)
  • In Tag Manager, create a new Tag
  • In this new tag, under Tag Configuration, click the white space and from the tag list select Google Analytics: Universal Analytics
  • Leave Track Type on Page View
  • Under Google Analytics Settings select New Variable from the drop-down menu. Add your UA code under Tracking ID in this new pop-over
  • Under Triggering in the Google Analytics Tag, click the box and choose a trigger. Select All Pages as your trigger
  • Save your tag and preview your container
  • Use the Tag Manager debug window to check that your tag is working
  • Publish your container
  • Check real-time traffic in Google Analytics

Getting started

If you haven’t already, register a new account on Google Analytics by following these steps. While following the set-up prompts you should eventually get to a final instruction to install your tracking code – ignore this prompt for now and keep your UA tracking ID handy.

Tag Manager is a useful Google tool that allows you to embed scripts on your website or application without needing a developer, using what are called containers. A GTM container is essentially an empty box, and this box gets embedded on your website. Everything that you then put into that box becomes available on your website as well. In our example, we’ll be installing a container onto a website and adding Google Analytics to our box, essentially making it available as a script on our website.

Start by visiting and creating a new account by clicking the button in the top right corner. Follow the account creation prompts by naming your account, giving your container a name, and selecting your target platform (this article will primarily focus on web platforms). Once done, click Create and and accept the terms and conditions. You’ll be redirected to your Tag Manager container and should see a pop-up with the embed scripts for installation.

There are several ways for installing Google Tag Manager depending on your platform. For WordPress, I would recommend installing it through your theme (if the option is available) or alternatively using Google Tag Manager for WordPress – a free plugin. Alternatively, I would recommend your web administrator, developer or host for assistance with getting it installed.

Creating the Google Analytics Tag

It’s time to set up your first tag now that you’ve installed Tag Manager on your website. To orient yourself, you can create a tag in one of two ways using the interface: Using the menu on the far left by clicking on Tags or by clicking Add a new tag from the New Tag card on the Overview page.

Click to add a new tag in either of these sections and the tag creation window will open up. Firstly, name your tag appropriately. It’s good practice to make your tag names descriptive and this becomes especially useful when you have hundreds of tags. A good name could be: TAG GA – Universal Analytics.

The next step is to configure your tag. Click anywhere in the first block, under Tag Configuration, and a new window will pop-over where you can choose your tag type. As you can see, Tag Manager offers several built-in tag types such as tags for ads, social networks, marketing tools and even custom HTML. This flexibility makes it easy to add almost any code to your website without needing any developer intervention. In this instance we’ll be selecting Google Analytics: Universal Analytics as our tag – click on it and it will add it to the new tag window.

We now need to add our actual tag configuration. Click on the Tag Configuration block again, and to open the configuration options for your tag. By default Track Type will be set to Page View – this you can leave as is as we will be tracking page views and its associated data. Below this is a drop-down called Google Analytics Settings. Select this drop-down and then select the last option labelled New Variable – this opens a new pop-up with configuration options for variables. Variables are placeholders for values that you want to reference in a tag and make managing these values much easier across your container. We’ll be creating a new variable for our Google Analytics tracking code.

You’ll notice that the variable window is already set to Google Analytics Setting. Google automatically selected this variable type because you created a new variable from the Universal Analytics tag. The only option we need to worry about here is Tracking ID – this is where you paste your UA code. You can also give your variable a name; I am calling mine VAR – Google Analytics Tracking Code.

Save your variable; and you’ll now see that your variable has been added to the Google Analytics Settings drop-down. The variable name is wrapped in two sets of curly braces; this is how Tag Manager references variables.

The last step is to add a Trigger. Triggers are essentially the specific conditions that cause our tag to fire. Click the second block, labelled Triggering; the next pop-over will display a list of available triggers. By default the only trigger available to you will be All Pages with the option to create your own triggers; but we’ll be using All Pages for the purpose of this implementation. The type for All Pages is Page View; which essentially means that this trigger will only fire if a page is viewed.

Hover over the trigger, and you’ll notice a checkbox come up on the left hand side. Check this box and click Add from the top right – your tag will now fire on all your pages when they are viewed. Click save and you’re done!

Testing your implementation

The last thing to do is to test your tag. Tag Manager allows you to preview tags before you publish them to your live environment and this is especially useful when testing complex implementations. Make sure your tag is saved and then click on Preview in the top right-hand corner of your work space. Tag Manager will refresh and you will now see a large orange notification, indicating that you are in preview mode.

When you open your website now, you should see Tag Manager’s Debug window. If you are unable to see the debug window, your installation is most likely faulty and you would need to check your GTM embed script to ensure it’s installed correctly.

From the debug window, under Summary on the far left, you should now see all the various events that have fired since you loaded the page. The very first one should be Page View, which corresponds to the trigger you set up in Google Tag Manager. When you select this event by clicking on it, you’ll see a preview of all the tags that fired in the preview pane to the right. One of these cards will be for our TAG GA – Universal Analytics tag, and the description should be Google Analytics: Universal Analytics – Succeeded. This means that your Google Analytics tag was fired correctly.

You should now be able to see your traffic from within Google Analytics itself. Open your analytics dashboard and from the left-hand menu select Realtime, then Overview. Your implementation was successful if you are able to see a single active user in your real-time dashboard. You can now publish your tag by hopping back into Tag Manager and clicking on Submit next to the preview button. Give your container a descriptive version name, and provide some detail as to what you implemented. Submit your container, leave preview mode and check your realtime dashboard again to ensure that it’s working.

Posted in Analytics

Featured categories



Your Partner In Digital

We are a small digital consultancy with a strong implementation team across digital marketing, technology and design.

Read More

Featured authors

Ecommerce Email Marketing & SMS Platform

Diginauts recommends Omnisend for your email and SMS automation needs for both Shopify and Woocommerce.

Get Omnisend

Related content

The only 4 SEO metrics that matter (at first)

The only 4 SEO metrics that matter (at first)

I often see new SEO practitioners ask questions about what they should be putting on their dashboards or reporting to their clients. The truth, however, is that there is no magic metric or standard. If you're asking publically how to measure success for your clients...

Setting up Google Analytics Audiences

Setting up Google Analytics Audiences

Getting started Audiences can be found in the Properties section of your Google Analytics admin section. To get there, click on the gear icon (labelled Admin) in the lower left and in this new pop-over select the Account and then the Property for which you want to add...

Divi for WordPress

Diginauts recommends Divi, the premium page builder by Elegant Themes.

Get Divi