You are wondering how to add Google Analytics to Google Tag Manager and start analysing your website. Go no further, you’re on the right page.

In this tutorial, we will see step by step how to set up Google Analytics and configure Google Tag Manager so that the tools work together.

We will start with the installations of Google Analytics and Google Tag Manager.

Then we will configure a first Google Analytics tag with Google Tag Manager.

At the end of this tutorial, you will have a configuration of Google Analytics with Google Tag Manager ready for further integration with other marketing tags.

You might even say: “The setup of GA with GTM was easy

Google Analytics setup

If you have a website, this is the very first thing you have to do – setting up Google Analytics.

Google Analytics is a free tool (and you can pay for advanced features), and it will let you analyze the traffic of your website and the behavior of your visitors.

The key features of Google Analytics are articulated around:

  • Audience: Understand who are your website visitors
  • Acquisition: From where the visits are coming
  • Behavior: How do the visitors behave on your website, how is their flow through the pages
  • Conversion: Measure the impact of your actions
Google Analytics User Interface

You continue demystifying Google Analytics, and learn more about the features in this article, or follow up with the tutorial.

Get Google Analytics Tracking ID property

To track the visits on your website, you will have to set a simple piece of code on your web page. This code is the Google Analytics Tracking ID. To get this code, follow the following steps:

  1. Create a Google Analytics account
  2. Select Website (by default)
  3. Enter an Account Name, Website Name and Website URL
  4. Click on Get Tracking ID
Create a Google Analytics account

Once you see the screen below, simply copy and paste this code in the <HEAD> of every pages you want to track.

 copy and paste the Google Tracking Code

Test Google Analytics installation

The best way to test your installation of Google Analytics is to extend Google Chrome with the Tag Assistant.

Tag Assistant is a test tool and helps to troubleshoot the installation of multiple Google tags, including Google Analytics, Google Tag Manager, and more. We will need it again later in this tutorial.

To check if your analytics tag is properly working, click on the Tag Assistant extension in your web browser.

Google Chrome with the Tag Assistant

Great. Now you are setup with Google Analytics. Let’s move on with the installation of Google Tag Manager.

Getting started with Google Tag Manager

It is often a question asked by people: What is the difference between Google Analytics and Google Tag Manager? Can I use both of them?

The simple answer is: Yes, and you should use both.

With Google Tag Manager (GTM), you can manage all your marketing tags (snippets of code, tracking code) in one single place and deploy them to all your website with few clicks.

Once you Google Tag Manager is installed, you won’t have to call your IT service to modify the code of your website anymore. You will setup marketing tools that work with tags, such as your web analytics, or your marketing automation on your own.

Google Tag Manager offers powerful features such as

  • Tag: Create any Marketing Tag and use the various integrations already existing.
  • Trigger: Define when your tag should get executed.
  • Versions: Define several versions and deploy them to different websites.

You can get more details on the main features of Google Tag Manager here.

Google Tag Manager setup

In the following steps, we will install Google Tag Manager and then configure the first tag with Google Analytics. Indeed, Google Tag Manager, by itself, is an empty shell.

Let’s start the installation of GTM:

  1. Create a new Google Tag Manager account
  2. Enter an Account Name, and Container Name
  3. Click on Create
Create a new Google Tag Manager account

A popup window is inviting you to copy a piece of code on every page of your website. Follow the instruction.

Install GTM

Take care, and copy exactly the two piece of code on every page in the <HEAD> and in the <BODY>. It is not optional.

Google Tag Manager: copy exactly the two piece of code on every page

Test Google Tag Manager installation

We will use the same method than with Google Analytics. Go back to your website and click on the Tag Assistant in Chrome.

The Tag Assistant should display a yellow icon. Don’t worry; it is just telling you that the container is empty.

Result of Tag Analysis

In the following, we will see how to connect Google Tag Manager to Google Analytics.

Install Google Analytics with Google Tag Manager

Are you ready to set up Google Analytics in Tag Manager?

Are you ready to install your first tag with Google Tag Manager?

Yes, your first tag! Google Analytics is a tag inside Google Tag Manager. In other words Google Tag Manager is containing Google Analytics.

After these great explanation, let’s start the configuration.

From the main screen follow these steps:

Main screen of Google Tag Manager
  1. Click on Add new a tag, and a new window will popup
  2. Select a name, as an example “Google Analytics
  3. Click on the tag configuration area, and chose the type of tag Google Analytics – Universal Analytics
  4. Leave the track type on Page view
  5. Then pick a setting variable. (If it is a brand new container, you should have no variable. )
  6. Create a new variable Google Analytics Settings and name it “GA PROD
  7. Enter the Tracking ID of Google Analytics (UA-XXXXX)
  8. Leave the rest as it is and save
Tag configuration area with GTM

You should see some changes in your workspace

Publish the container changes to your website

And now it’s time to publish all your changes and make them live – to make them available on your website.

Hit the submit button on the right corner of Google Tag Manager. Create your first version and publish it.

Voila, your first version of your container is published, and it contains the tag for Google Analytics.

Before testing with the Tag Assistant, remove the previous Google Analytics tag from the <HEAD> of your page (indeed, if you follow the tutorial from the beginning you should still have the first Google Analytics code).

Now you have a basic setup of Google Analytics with Google Tag Manager. This is the minimum you should have for any website.

Go further with Google Tag Manager

This article is part of on advanced tutorial of Google Tag Manager and Analytics.

In the following articles, we will discuss advanced concepts that are often required for enterprise website configuration.

I invite you to continue configuring your site by learning how to configure environments with Google Tag Manager.


  1. Great guide, but Im confused, why do you tell us to install GA using the head code and then a few steps later tell us to remove it?

  2. Hi Tim,

    the first step shows how to install quickly GA and test it.

    Later I mention that “Before testing with the Tag Assistant, remove the previous Google Analytics tag from the of your page (indeed, if you follow the tutorial from the beginning you should still have the first Google Analytics code).”

    Maybe I should explain it in a better way.

    Thanks for your feedback.

  3. You say “Take care, and copy exactly the two piece of code on every page in the and in the . It is not optional.”

    This is not true, in fact there are good reasons to omit the second tag.

    – it’s only used when javascript is turned of
    – the people which switch js off might be more likely to complain regarding privacy issues if they realize they are still being tracked
    – it can only track a few events, see
    – iframe may cause a11y issues, see

  4. Should I add both the gtag.js code as well as the GTM code into the Head of every webpage?

Join the conversation