Learn Google Tag Manager
Learn Google Tag Manager
Manager
Tutorial
Google Tag Manager is the next big thing in the Digital
Marketing world. For any product marketer, it becomes a
task to achieve efficient data from the product blog/website.
When it comes to the data, there are multiple product
marketing tools available. To handle these tools, Google
Tag Manager provides a universal solution. This tutorial will
take you through the basics of Google Tag Manager, right
from the Tag formation to interacting with special functions
such as Form Submission, Mouse Scroll Events, etc.
-------------------------------------------------
FREE EBOOKs
Copyright © 2021 by SuSu. All Right Reserved.
SEE MORE FREE EBOOKS: CLICK HERE
TABLE OF CONTENTS
• Google Analytics
• Chartbeat
• Kissmetrics
• Sprint Metrics
• Woopra
• Clicky
• User Testing
• Crazy Egg
• Mouseflow
• Mint
Step 3 − Enter your credentials for Google, and you will see
the following screen for creating your blog.
• Setup Account
• Setup Container
• Workspace
• Versions
• Admin
WORKSPACE
• Overview
• Tags
• Triggers
• Variables
• Folders
VERSIONS
You can also configure the account details and review the
activities related to the account, if there are multiple users
associated with this account.
Google Tag Manager -
Getting Started
This chapter provides an overview of how to get started with
Google Tag Manager, add a tag and analyze it for
completeness.
You will get to see the Install Google Tag Manager dialog
box.
Now, here we want to install the Google Tag Manager code
on our blog.
Step 4 − Click Edit HTML to edit the HTML code for the
blog. An HTML source code for your blog will be visible, as
shown in the following figure.
Note − You can use shortcut key Ctrl + F to find the <head>
and <body> tag. The browser search functionality will come
in handy to find the tags.
Once you have located the <body> tag, repeat the procedure
to copy the code associated with <body> tag from Google
Tag Manager.
For ease of locating the tag, typically, <body> tag will begin
with <body expr:class = '"loading" +
data:blog.mobileClass'>.
Paste the required code under the <body> tag and then click
Save theme.
j = d.createElement(s),dl = l != 'dataLayer'?'
&l = '+l:'';j.async = true;j.src =
INTRODUCTION TO TAG
As put simply on Google Tag Manager Support website, a
tag is a piece of code that sends information to a third party,
such as Google Analytics.
LOCATION OF A TAG
TRIGGERS
Triggers actually detect when a tag will be fired. These are a
set of rules to configure a tag to be fired. For instance, the
triggers may decide that a particular tag ‘X’ will be fired
when a user performs ‘Y’ action. More specifically, a trigger
can direct a tag to fire when a particular button in a
particular form is clicked.
Triggers are conditions which can be attached to a tag to
function the desired way. A real world example will be,
consider that a tag is being configured for a successful
transaction on an ecommerce page.
The tag will indicate whether the transaction was carried out
successfully. To do so, a trigger will be created, which will
say, fire the tag only when the transaction confirmation page
is displayed to the user.
VARIABLES
Essentially, variables are values that can be changed.
Going in a bit detail, you can also record the particular div
class of the element that was clicked, using variables. They
are called variables, because if there are 10 different link
buttons on the page, the redirection from these link buttons
is going to change, depending on which of the elements are
clicked on.
You can access variables by using the left panel and clicking
Variables.
Google Tag Manager offers two types of variables −
• Built-in variables
• User-defined variables
DEBUGGING A TAG
In the initial section of this chapter, we took time to add
Google Tag Manager Tracking Code to our blog on
Blogger.com.
This was the first step to have Google Tag Manager identify
our tracking code. If you observe closely, in the script that
has got included in the <head> tag, there exists a Google
Tag Manager Tracking Code in the format GTM-
XXXXXXX.
Another panel will slide from the right, which will have the
following tag types displayed.
• Universal Analytics
• Classic Google Analytics
• AdWords Remarketing
• Google Optimize
Step 7 − Copy the Tracking Id. The tracking Id will have the
format UA-XXXXX-X.
Step 8 − Once you have copied the tracking ID, return to the
Google Tag Manager interface. As already shown earlier,
paste the Tracking Id in the associated text box.
A dialog box will slide from the left, requiring you to select
a trigger. It will show the trigger as shown in the following
screenshot.
Step 2 − Click First Tag, it will show the dialog box with
the configured triggers, etc.
LINK TAGS
Many a times there will be certain promotional offers for
which a user may be required to leave the blog or website.
Along with promotions, these can be some third party
surveys that a user may be required to take. These surveys
will yield certain statistics, which will be different from the
data that is coming in via different tags.
Step 2 − Follow the same process as the initial tag setup for
having the Google Analytics code entered in the correct
field – Tracking Id.
• Category – Outbound
• Action - Click
• Leave Label and Value fields blank
• Keep Non-Interaction Hit as False
Step 6 − Click the blue + icon at the top right corner. It will
open the custom trigger section. Provide a name to this
trigger as – Click Trigger.
As shown above, since we have not yet clicked the link, the
tag still appears under Tags Not Fired On This Page.
EVENT TRACKING
Event tracking stands for any action that is different than a
page load. The browser has a specific response to any action
that you take on the page. For instance, the action can be as
simple as clicking a link or submitting a form to a complex
one such as tracking file views and downloads.
With the Google Tag Manager, you can easily track the
events generated in the browser. It records the responses
from the browser for potential action, thereby getting the
particular event track easily.
The trigger will be enabled when a user clicks all the URLs,
which are redirecting outside the blog. Creating this trigger
is fairly simple.
Step 6 − For the option, This trigger fires on, select Some
Link Clicks.
But, you won’t see any change in the Tags Fired On This
Page section. This is because we have configured the tab for
outbound links.
In this way, you can employ event tracking with Google Tag
Manager and configure tags for critical data that you need
from your website/blog.
FORM TRACKING
More often than not, on any website/blog you will see a
form, which will capture certain details from the user. As a
product marketer, it becomes tedious to know whether the
Form is getting used by the visitors.
The trigger will be enabled when the user submits any data
in the Contact Us form.
Step 6 − For the option, This trigger fires on, select All
Forms.
Once you are done with the above step, it will enable
tracking for all the forms submitted on the blog page. You
can also use a specific Form ID, which can be configured
when you created your blog.
USER MANAGEMENT
It is not an uncommon scenario for a product marketing
team to use a single Google Tag Manager account to
manage different marketing campaigns. There will be
different roles, which will have certain permissions such as
creating a tag, deleting/modifying a tag, creating another
user, etc.
• Account Level
• Container Level
FOLDERS
Folders are required especially when you have numerous
tags and triggers in your account. Folders can prove useful
when you have such a large number or tags/triggers to
handle.
For organizing the tags and triggers in these folders, one can
use his/her own creativity. The folders can be created on the
basis of different application areas or the users or maybe the
purpose why they are being created. The produce marketing
team can take their own decision of having a specific folder
structure in place.
From the previous screen, you can always move the tags as
per your requirement into the desired folder.
dataLayer = [{
'products': [{
'name': 'Western Cotton',
'tuning': 'High-G',
'price': 49.75
},
{
'name': 'Fenda Speakers',
'tuning': 'Drop-C',
'price': 199
}],
'stores': ['Hyderabad', 'Bangloer],
'date': Sat Sep 13 2017 17:05:32 GMT+0530
(IST),
'employee': {'name': 'Raghav}
}];
push({‘event’: ‘new_subscriber’});
If you require, you can ask your developer for some more
information, such as the form location. This is required if
there are more than one form on your website. It can be
achieved using the following code.
The values that are present, are due to the Blogger gadget
that is in use at that particular position/space. This is the
reason why there is certain information there.
If you look at object 1, you will notice that the event that is
fired, is – gtm.dom. It is fired by GTM while loading the
page.
In this way, you can inspect the data layer and add
information in it as and when needed.
Here, we are going to try and read the event using a data
layer variable.
In this way, one can inspect the data layer and capture the
values in the data layer as required.
Google Tag Manager -
Advanced Tracking
It is time to look at some complex scenarios, where you can
track critical elements for the business. We will look into
how to create a custom event, which is not pre-defined or
available by default.
Step 3 − Follow the same process for creating the tag. Here
are the details −
Step 9 − Now, start the GTM Debugger and refresh the blog
page. You will see two major changes in the Summary and
Tag section.
Step 10 − Now, scroll down to see the rest of the blog, a
couple of more events will get triggered.
• ScrollDistance
• ScrollTiming
Thank you!