How to Implement Google Analytics with Google Tag Manager

A step-by-step tutorial with screenshots on how to connect Google Analytics with Google Tag Manager (GTM) on your website.

Introduction

How to connect Google Analytics with Google Tag Manager? Also, what is Google Tag Manager, after all? You are probably familiar with Google Analytics. It’s a free service from Google. You add several lines of code to your website and voila – you can now get detailed statistics about users visiting your website, the content they are reading, the time they spent on the website, traffic sources and so much more.

What is Google Tag Manager?

On the other hand, there is a Google Tag Manager. When I first heard about Google Tag Manager (or GTM how it is often abbreviated), I was wondering – why would I need this. I already have Google Analytics running on several of my websites, and they seem to be just fine.

According to Google itself – Google Tag Manager is a tag management system. Still doesn’t mean much? I feel you. Bear with me; I will explain what does Google Tag Manager do in simple terms.

When you add Google Analytics on your website, you need to add a code snippet to ensure its functionalities. However, what if you need to add another tool, say the tool for A/B testing or Google’s own Optimize? Instead of adding many snippets of code for each of those services (tags, beacons), you can now use Google Tag Manager.

You add GTM code once and then you “connect” or “attach” other tags to it. You don’t need to bother developers to do it for you every time you want to try and experiment with some new tags.

Google claims that Google Tag Manager is simple, easy, and reliable. It is, once you get a hold of it. However, in the beginning, there is a steep learning curve.

What is this tutorial about?

This tutorial doesn’t get into a too detailed discussion about the Google Tag Manager and its powerful capabilities. I will cover those in some of the future posts. This tutorial explains how to implement Google Analytics with Google Tag Manager. You will learn how to implement Google Analytics tracking, set up the Google Tag Manager and Google Analytics account, and deploy tags on your website.

I will show you Google Analytics tag type and explain what a track type is and what are the containers. You will need about 15 minutes to complete this tutorial. However, your mileage might vary depending on if you already know your ways around Google Analytics and have some basic web development experience.

The time needed: 15 minutes.

This tutorial assumes that you already have a Google Analytics (GA) account and your tracking code. If you don’t have it, you can still follow the tutorial and then create your GA account.

To be more concise, I will use GTM as an abbreviation for Google Tag Manager and GA as an abbreviation for Google Analytics.

  1. Sign up for Google Tag Manager

    Go to the Google Tag Manager website and sign up for the service.
    Once you are there, you will see a screen like this. Click on the Create Account button.

    Create an account for Google Tag Manager

  2. Add a new Google Tag Manager account

    Add a New Account screen appears. Under Account Setup, find the Account Name field and enter a name for your account.

    Next, find the Container Setup section and enter a name for your container in the Container name textbox. I suggest you use your website name or a domain.

    And, lastly, select the Web as your Target platform. Click Create to finish.

    Add a new Google Tag Manager account

  3. Accept the Terms of Service Agreement

    GTM will display its Terms of Service Agreement. Review it carefully and once you are okay with it – click the Yes button.

    Also, be sure to check the Data Processing Terms and GDPR consent.GTM Terms of Service Agreement

  4. Get the GTM code snippets for your website

    After you accept the Terms of Service, you will be directed to a page where you will see GTM code snippets.

    The first part of the code should be pasted in the <head> HTML tag section of your webpage.

    The second part goes right after the opening of the <body> HTML tag. However, for now, click the OK button.

    You can add this code a bit later. If you are using WordPress, you might want to open header.php file of your theme and then add the code there. Also, there are plugins enabling you to add code to the header, body, and footer sections of your website – they might be an easier option for you if you don’t feel comfortable editing code.


    Install Google Tag Manager code snippets

  5. Adding a new GTM Tag

    What you see in front of you now is your Workspace. There are many parts of it, but for now, direct your attention to the New Tag.

    Click the Add a new tag link.Adding a new GTM Tag

  6. Selecting the Google Analytics tag

    In the new screen that appears, enter the name for your tag. I called it GA Tag, but you can pick any name.

    Next, under the Tag Configuration section, click on the big tag icon. A slide-in from the right-hand side will appear with dozens of available tags.

    This is the right moment for you to scroll around to get feeling of all the different tags available to you.

    However, for now, just find and click on Google Analytics – Universal Analytics.

    Selecting Google Analytics - Universal Analytics GTM tag

  7. Configure Google Analytics – Universal Analytics tag

    Next up is tag configuration. Be sure that under the Track Type you select Page View. This tells GTM that we want to track every page view.

    Make sure that you check the box Enable overriding settings in this tag.

    And then under the Tracking ID add your Google Analytics tracking ID. If you don’t know how to get it, I will show you how to do it in the next step.

    Configuring Google Analytics - Universal Analytics tag

  8. How to find your Google Analytics Tracking ID?

    Log in to your Google Analytics account.

    Then, navigate to the Admin section and then locate the Property column. Typically, it is in the center of the screen.

    From there, click on a Tracking Info and then on Tracking Code.

    Right after that, you should be able to see your Tracking ID clearly visible.

    How to locate you Google Analytics Tracking ID?

  9. Choosing a trigger for Google Analytics tag

    Let’s get back to the Tag Configuration window. Locate the Triggering section. This is where we are going to select the type of the trigger.

    Click on a Choose the trigger icon and a slide-in will appear on the right-hand side.
    In the Choose a trigger dialog, click on the All Pages/Page View.

    Choose a trigger for Google Analytics and GTM

    If you did everything correctly, your Tag Configuration should now look like this.
    Click on the Save button.

    Tag Configuration - Google Analytics - recap

  10. Review your workspace before you publish your container

    After you successfully configure your tag, your job is still not done. You need to publish your container so that it takes effect on your actual, live website.

    On the workspace Overview page, you can see the Container Not Published section. Just above it, you will notice two buttons – Preview and Submit.

    Click on the Submit button.

    Reviewing workspace before publishing your container

  11. Submit changes and publish your container

    After you click on the Submit button, you will see Submit Changes dialog with the Submission Configuration section.

    Under the Version Name enter a descriptive name of this first deployment. This will appear in your history and activity lists, so it helps to make it descriptive. You can add even more details under the Version Description.

    Once you are happy with your entries, hit that Publish button.

  12. Your container is now live

    A quick look at the workspace Overview will now show Live Version section indicating that your container has been deployed successfully.

    If you now open your Google Analytics and Real-time view and start browsing on your website with the tags deployed, you should be able to see GA recording visits. Keep in mind that it might take up to 24 hours for GA to start collecting and displaying data. However, typically, it will begin working within 15 – 30 minutes.

    Publishing Google Analytics tag - live version

Conclusion – Google Analytics with Google Tag Manager

In this tutorial, I showed you how to connect Google Analytics and Google Tag Manager. Also, I tried to explain what is the Google Tag Manager in simple terms.

This tutorial assumes that you already have a Google Analytics account. If you don’t have it – getting one is free and straightforward. Let me know in comments if you need help getting one for yourself.

This is not the ultimate Google Tag Manager tutorial or Google Analytics tutorial. There are still many topics to be covered — for example, a preview mode during the container configuration. Moreover, there is a whole sleeve of Google Analytics topics like e-commerce tracking, understanding the data layer, event tracking, custom dimensions, and so much more.

For more information on Google Tag Manager, check out Google’s official content.

Or take a look at this video explaining the key GTM concepts.

More Articles for You

How to: Make Your WordPress Blog GDPR Compliant

How to make your WordPress blog GDPR compliant + a step-by-step tutorial on making Google Analytics GDPR compliant.

— Featured —

What Are the Most Profitable Blogging Niches in 2019

Most profitable blogging niches in 2019 are personal finance, health and fitness, food, beauty and fashion, travel, and parenting.

— Featured —

Blogging Money © Copyright 2019. All Rights Reserved. With a commitment to quality content for our community.