Installing Google Analytics with Google Tag Manager

February 01, 2023

Table of Contents:

Collecting website data using marketing tools such as Google Analytics is essential to growing your business, making the right decisions when promoting your site, converting visitors into leads and optimizing your business strategies.

However, in its pure form, Google Analytics may not provide data in the necessary cuts. That's why tags come to the rescue.

Tags refer to pieces of code in the form of Java scripts and HTML code that is added to the pages of the site to collect certain information.

For example, tags can collect data on how long the visitor has been on a particular page, how much information he viewed, how he fills out the contact form and which fields cause the most trouble when filling out, where the visitor came from, which products he added to the "Cart" and which he removed from it.

As a rule, a new tag is created to extract information about a particular action. It is installed on the pages of the site and sends the specified information to the used analytics system.

The disadvantages of introducing individual tags directly on the page are: the bloat of the page code due to inline inserts, the difficulty of debugging the code, there are difficulties when working together with multiple developers, etc.

Since 2012, Google has provided the ability to merge and manage all tags in the Tag Manager. The tagging process is simplified many times over. Google Tag Manager (hereinafter - GTM) code is once added to the page template code, and all work with tags is performed through a remote interface.

What is Google Tag Manager?

Google Tag Manager(GTM) is an advanced tag management system that allows you to create, debug and use tags in the user interface without having to change the page template code every time you want to create or modify a tag. You just need to add GTM code to every page on the site. This speeds up the tag development process and removes the need to provide access to site templates that untrained programmers can damage.

So, GTM allows site developers to focus on larger tasks, shifting the burden of creating marketing tags directly to their consumers. At the same time, Dispatcher has both ready-made templates and debugging tools built in, greatly reducing the chance of human error in coding. The marketing department has full control over the tags they create, which greatly increases the efficiency of data retrieval and the work of the department as a whole.

Using GTM allows you to customize the activation of tags when certain events occur or when the user interacts with the site. For example, you can track which of the form fields causes difficulty when filling out, resulting in user abandonment. This usually doesn't require special code. The user himself sets the sequence of activation of certain tags.

The Tag Manager is provided by Google for free, so you can start exploring its features right now.

Getting Started with GTM

Setting up an account

Setting up an account is a fairly simple process.

  1. Go to and click the "Register" button. Next, enter your account or company name, country and website URL, and where you want to use the Google tag (website, iOS, android, AMP). When you're done, click the "Create" button.

    Next, accept the "Google Tag Manager Terms of Use Agreement" by clicking "Yes.

  2. After that you will be provided with a special code (script) of GTM container and instructions for adding it to the site. The code must be placed on all pages of the site. It is necessary to activate other tags according to the rules set in the GTM interface. The code consists of two parts. The first part is inserted into the HEAD header of the page template and the second after the BODY tag. You can place the script immediately or a little later (you can find the GTM code in your dashboard). Once you're done, click "OK".

So, we have added a container to the site. In fact, it is a global tag, occupying the highest level in the hierarchy. It is the container that allows the Tag Manager to work with your site.

Once you have a GTM account and pasted the container code into the site pages, it's time to move on to setting up the first tag.

Adding Google Analytics

In GTM, a container is not only a script code added to the site, but also a workspace for interacting with elements such as variables, triggers, and tags.

Let's see how to set up our first tag:

  1. In the Google Tag Manager toolbar, click Add New Tag.
  2. Name your tag, and then click anywhere at the top of "Tag Configuration" to select its type.
  3. There are dozens of standard tag types available in the configuration. If the ones presented here aren't enough for you, you can always create your own tag. Choose "Google Analytics - Universal Analytics".
  4. Create a new variable where we add the tracking ID in Google Analytics. A variable in GTM refers to an object that we can assign arbitrary values to. They are used to store data. A variable has a "Key - Value" form and is used to replace a predefined value in processes with its key. GTM uses built-in and custom variables. We will define a custom variable. To do this, select "New Variable" from the drop-down list.

    Add an identifier that we get in Google Analytics ("Administrator" - select your resource - "Resource Settings"). It looks like UA-XXXXX-X.

    When we use such a variable, there is no need to copy the full GA code.

  5. After that, select the trigger that will activate the tag. A trigger is defined as a rule which, when executed, refers to the tag. Triggers are divided into activation triggers and tag lock triggers. In this case, we need an activation trigger. We select All Pages (1), which means that the GA code will be activated on all pages of the site.

    Note that variable (2) is enclosed in double curly braces. In addition, it should be understood that the tag will not work without an activation trigger.

  6. Check the added information in the "Tag Configuration" and "Trigger" fields and click the blue "Save" button.
  7. Click the blue "Submit" button. Your tag won't work until you do.
  8. When you click Submit, you will be taken to the Submit Configuration page. There are two options: Publish and Create Version or New Version. We need to add the tag to all pages on the site, so choose Publish and Create Version, then enter the version name (and description) and click the blue Publish button in the upper right corner.
  9. Make sure that the tag is displayed in the report.

So we successfully created the first tag and installed GA on the pages of the site.

Istead of a conclusion

If you are interested in using GTM, then we plan to write several training articles where we'll go into detail about the details of setting up triggers and variables, learn how to customize goals, and learn dozens of tricks of professional marketers when using the "Tag Manager".

Need to check positions on Google? The answer is here:

Join Rankinity

Get 300 checks per month absolutely FREE!

No credit card needed. No strings attached. 👍