How to use guide for Google Tag manager

How to use guide for Google Tag manager


Internet marketers often have to add or edit different kinds of scripts on the site to track user actions. If the use of tags is not accompanied by effective management, it can lead to many problems and long implementation time:

  •  The abundance of code slows down the site work.
  • Unnecessary or improperly installed tags can distort the results.
  • Wrong tags lead to unwanted costs and prevent the collection of important data.
  • Changes after repeated mistakes delay the time when you can start the analysis.
  • Finally, to add new tags IT professionals and webmasters can take a lot of precious time, which can add to delays to any major marketing programs you may have running.

There are several options for solving a number of problems associated with tag addition. Today, we will talk about Google Tag Manager.

1. What is Google Tag Manager (GTM)?

Tag manager is a Google solution allowing you to place scripts on the site without the direct intervention into the code.
GTM provides the ability to add and update scripts directly through the web-based interface, as well as set activation rules for these scripts. Google Tag Manager is a simple, reliable and free tool. It provides marketers with flexibility and allows webmasters to focus on important tasks without worrying about the little things. This is a solution for marketers, with a single interface to manage all the tags on a site.

2. GTM Structure

An account is a place where you can manage your containers.


The container is the main and the only fragment of the JavaScript code we include on all pages of a site. In essence, it is a tag, but its function is that it serves as a container for all tags.

Tags are small snippets of websites that allow you to:

  • monitor traffic and visitor behavior,
  • analyze the effectiveness of advertising on websites and in social networks,
  • use the remarketing funds and targeting specific audiences,
  • test and improve your site as well as performing many other useful tasks.


Trigger specifies the circumstances for the tag fire with execution or block:

Variables are key-value pairs for which the values are transferred into the workflow. They are used for custom variables, and to determine the tag trigger conditions:


3. Setup and Installation

The first thing you should do is to log into Google Tag Manager, using an existing Google account. If you do not have a Google account – create a new one.

Within the next step, Tag Manager offers you to create an account for your site or app and provides container code to install on the site or app.
In this example, I will use the web-version of container:

Setup and Installation

Press “Yes” to accept the terms of Service Agreement.

Service Agreement

Now, you will see the container code Google recommends to include on all the pages after the tag. In the future, it can be viewed on the tab Admin -> Install Google Tag Manager.


That’s it. Google Tag Manager installation is finished! It is necessary to proceed to the immediate configuration of tags and triggers.

4. GTM Account Structure.

After you have correctly installed Google Tag Manager, you will be redirected to your account. This is the main reason why I decided to overview the GTM account structure to show you the common interface of the program.

Interface elements:


1 – Search line. The element that helps you quickly find a tag trigger or variable by name.
2 – Overview of your account.
3 – Tags. Open the list of tags.
4 – Triggers. A list of rules.
5 – Variables. A list of built-in and user-defined variables


6 – Folders. Create folders and organize your tags, triggers and variables structuring.
7 – New Tag. Quick access to the creation of the new tag.
8 – Add a note. To create a note.
9 – Status of the account includes a number of tags, triggers, variables, and their status (published or unpublished).
10 – Recent Activity. The history of the contents of the container.

5. How and why to use GTM (Capabilities and opportunities).

Google Tag Manager has plenty of opportunities and in this article, we will talk about the basic functions, necessary for every analyst or marketer.

We will discuss the creation of the Tag itself below because it is required to have some knowledge on what may serve as tag firing rules and what data we can operate to set up its internal settings.

To configure the necessary conditions of tag operation you should use Triggers. They can be created both separately and, which is less convenient when setting up the tag itself.
You will notice that in the interface of Google Tag Manager tags, triggers and variables are setting up in approximately the same order:

Name -> Type -> Settings -> Rule

For variables there is usually no fire configuration, the value will be accepted on all the pages of your website. The operation is not affected, and if the value is not defined, a key will be assigned to undefined.

6. Trigger and Variables Setup.

To begin with, let us look at the stages of trigger and variables creation.
Go to “Triggers” tab and click “New”. Here, you should choose a name (if not entered, while retaining, you will receive a notification that you can enter a friendly name for the trigger) and choose its type.


Each trigger type is used for various tasks. In order to fully use the functionality of the internal specific trigger settings, it is necessary to enable built-in variables, on page “Variables”. We will talk about them below and now let us analyze the available trigger configurations.

Page View” is a trigger enabling the tag fire when loading certain pages (Page View), when the full page is constructed in the browser (DOM Ready), or when all elements of the page have been loaded, including images and scripts (Window Loaded).


You should set up a rule for this trigger – there may be two options – “All page views” or for more flexible settings – “Some Page Views”, where you can select a specific page or DOM element that will lead to the trigger when the page loads.


The next type of trigger is “Click”. This is used to listen for click events of two types – “All Elements” and “Just Links”. As a rule, it can be used to listen for all the clicks – “All Elements”, but this leads to the need for more specific rules for setting up operation in step “Fire On”. By analogy with Page View, you can create a trigger fire condition. To use these settings you should enable parameters related to Clicks on the Variables tab.


After setting this up, in a list of parameters to fire the trigger, you will be able to select the trigger id, class, text, and other important parameters.

If there are no required built-in variables, you can use the user-defined variables. Just scroll the variables section down and click on “New”. These may be of various kinds and can be set from different sources (HTML or cookie). They also may be created as a data layer (a chunk of the information that you want to pass to Tag Manager) or via Custom JavaScript directly in the Tag Manager interface.

Custom JavaScript in user-defined variables has a truly fantastic opportunity for analysts and marketers. The knowledge of a number of tools to use almost disables the need to address the programmer.


After setting the variables, the list of conditions in triggers will expand. Also, these variables can be used as additional data transmission parameters in the system of site monitoring and analysis in the form of user-defined parameters and variables.

Triggers for the Form and History Change are created similarly.

Special attention is required to “Custom Event” and “Timer”.

Custom Event” is a trigger type, where the firing rule should be established by a developer with the use of variable dataLayer.push ({‘event’: ‘event_name’});

Embedded in a code for certain actions or simply page download. The rule here will be a load of this variable. This trigger type offers many interesting possibilities and methods of implementation; read more about them in the official Google documentation.

Timer” is a trigger that enables to create a rule for a tag to fire on the expiration of a certain period of time, for example, to allocate a separate, more engaged audience and run remarketing for such audience.


I hope you managed to read to this point as you will now know the basic trigger setup principles and GTM indexes.

7. Tag Setup.

Now, let us proceed to the Tag setup.


Tag setup is very important because the way you publish the script and the rules you assign to fire your tags will affect the data you will receive. Google Tag Manager has a number of tag templates available for installation.

Installation of counters and tags of products, available in the interface.

You can view the full list of tags provided by Google when creating a tag.


This list is constantly growing, but if there is no built-in functionality, you can use Custom HTML Tag or Custom Image Tag.


In most cases, this approach works, but to install some exclusive products you need to become familiar with a supplier manual or to clarify the details with the support team.

The process of tag creation is trivial. We discussed the required steps above and as for the fields to fill in – those are often the script identification elements (id, a unique name or the name of the product, etc.). When configuring the built-in tags there is often an opportunity to fill in the fields to create additional options for products.

You can use the indicators we discussed above, selecting the matching one from the list. In addition, there is an option to change the figure for the product if it is sent by default, by specifying a new value and it will be replaced automatically.



With the next step, the system requires the installation of a trigger. As was mentioned above, it is possible to create it in advance or when creating a tag. To test the efficiency of the set tag, GTM provides you with preview and debug function.


Click on “Preview” button and then go to your website. There you will see an additional console displaying a series of tags being fired or not fired on this page. It is also possible to view the firing conditions, the reasons of firing or not firing and used indicators. After you make sure that everything works, click “Publish”.

8. How to Use GTM for Marketing.

Marketers or analysts need to use Google Tag Manager when:

  • It takes a lot of time for a web developer to install and test the system, while you need to make an analysis urgently.
  • Retargeting codes installation requires a long time and the management team wants to already see the results.
  • It is necessary to set up dozens of events, and set tasks for a programmer and intervention into the code is a matter of days.
  • There is a need to create custom variables and metrics for the expansion of the analyzed data, etc.

As an example, let us analyze the installation of the Google Analytics code.

To begin with, I advise to create a custom variable, to use as property id for your account.

Go to the “Variables” tab,


scroll down and click “New” in User-Defined Variables section.


Select the type of the variable as “Constant”:


Name it “GA Property” and enter your Google Analytics id as a value in “Variable Configuration”. Click “Create Variable” button. In the future, such manipulations will facilitate the work with tags.


Now, go to the “Tag” tab and click “New”.


Enter the name of the tag “GA Property”, choose Google Analytics on the list of products (if it is not available – you can use the Custom HTML), select the correct version of Google Analytics. Clink on Tracking ID box and select the created GA Property Tag. Track Type is “Pageview” by default which is correct.

In the “More settings”, you can enter additional parameters that you want to use.
The most commonly used settings are:

Fields to Set – is used to pass parameters provided in Google Analytics. This can be a page (for a creation of the title of the page) or & cid to represent a user id.

Custom dimensions and custom metrics – are used to transmit additional information about the user’s behavior and interaction with the site to Google Analytics.

E-commerce features – is used to adjust Enhanced e-commerce. (For Enhanced e-commerce data transmission the tag type Page View is used for all stages! Transaction tag type is used only for the classic e-commerce.)


Next, set a tag firing rule – “All Pages”. As a result, you should come up with this:


Click “Create Tag” and follow the steps described above. (Preview -> Publish)
To configure “Events”, you should create an additional tag of Google Analytics type and select the event in track type box. Fill in the default settings and in “Fire On” create a rule to send an event (do not forget to place checkmarks on necessary variables in “Variables” tab).


Non-standard, but quite a regular task is to obtain Google Analytics cid or client id, as a Custom Variable. The need arises if a company wants to send some data through the measurement protocol.

Measurement protocol empowers marketers to collect more data about users’ behavior and interaction with the site. Measurement Protocol is available in Universal Analytics. It has the form of a set of rules which allow to send raw data about user interaction directly to Google Analytics servers.

A feature of Google Analytics cid or client id, as a Custom Variable, is stored in Google Analytics cookie files.
We need to:

1. Create a variable 1st Party Cookie with the name “_ga”


2. Create a Custom JavaScript with the following code


Now how it works: 1st Party Cookie named “_ga” returns data in the form similar to GA1.2.475226310.1380715146. Next, Custom JavaScript parses the string and returns the cid deleting the first 4 characters from received data (GA1.2.) And returns a set of numbers (475226310.1380715146), showing the full user’s clientID.

This indicator can be used as custom variable in Google Analytics. You need to create it with Google Analytics and add to the tag to the Custom Dimension box with the parameter session.



Where Index is a number of Google Analytics variable.


This is a great example of how to get and use the variables in Google Tag Manager.


I hope you found this article useful, and in conclusion, I would like to say that Google Tag Manager is a very powerful tool that can be used to achieve a variety of purposes, ranging from the installation of code and configuration of analyses systems to A / B testing and more complex tasks without the involvement of a developer.

Expert reviews of marketing tools, proven online marketing ideas and case studies.