Google Tag Manager

Posted in Uncategorized By Raj On September 12, 2016


Usually market people wants to know howmany people have visited their website , what is the percentage of new visitor’s , bounce rate of particulate website, geographic wise user information, how many people have visited website after launch of a new advertising campaign etc… here, the google analytics or adobe analytics can help us to record user behaviour and generate reports, based on reports the marketing people or creative agency can take better decisions and market research


I am taking simple use case that there is an ecommerce portal which is maintaining desktop website but, they wanted to reach more audience for that they released a new  mobile app, after a while they wanted to see how many requests are coming from desktop website and how many requests are coming from the mobile app ?

The greyarea who provided google analytics solution for this ecommerce client have placed small piece of JavaScript’s on the source files of ecommerce website and also integrated mobile app with analytics,  every customer request the JavaScript reads the device information and send it to the Google Analytics database

Using Google analytics dashboard the greyarea quickly generated reports to find out how many hits are coming from mobile, desktop

In the past I mean around 10years back when I was working on “Urchin” later it was acquired by Google, we  used to include small piece of JavaScript code into the website source files and we used to call those JavaScript’s code either snippets or tags, the job of these snippets is to pass customer behavioural data to the analytics server , by mistake if any developer placed wrong JavaScript on the page then it used to impact on the entire page

Going onwards, they ecommerce client want to enhance their tracking for better understanding of the customer behaviour and to make site more relevant but, this ends up with adding more tags to the source files , here mainly there are two problems we have seen, first they need to depend on the web developers for any new tags they want to add and second it is very difficult to manage such a huge number of tags and there is no proper streamline process involved

There is an another problem with this what if client does not want continue with google analytics after sometime ?
do we need to replace entire system ? yes, we need to do because the snippets are included in the source files of a website, you need to modify your source files to support other third party analytics and delpoy it once again there the google tag manager helps us lot ? the google tag manager provides felxibility to connect to any third party analytics it could be google analytics or adobe analytics or someother analytics solution

The Google Tag Manager helps us lot to overcome all above mentioned problems , using GTM you do  not need to maintain tags in website source files, you can use GTM user interface to manage all tags

Google Tag Manager

Google Tag Manager is a tag management system this allows us to quickly create tags or update tags using google tag manager user interface, this is single source using which you can also connect to google analytics, google adwords, adobe analytics and some other third party analytics, no need of editing any source files for a change, we can manage this using google tag manager user interface

Integrate tag manager container to a website :

To establish a connection between your website and google tag manager first we need to include google tag manager container on all pages of your website the best approach is to place this container snippet below the body tag, you do not need to add any other google analytics snippet or adwords snippet to your website  if you are already added container snippet on the page

When you make a request to your website the container build urls something like this “” the browser request for all tags which you are created for this container using google tag manager user interface

If you open above url in the browser then you can see all JavaScript snippets and google analytics related information

Create a tag manager container :

  • login to
  • click on create account
  • Add account name
  • Enter container name
  • Select where you are going to use this container here, we are going to use in websites so you need to select web
  • click on create


There are mainly three things which we need to know in GTM those are Tags, Tiggers and Variables

Tags :

A tag is a snippet of java script code which execute on a page and sends user behaviour data to the google analytics or adobe analytics

Trigger :

The triggers specify that when the tag should fire, if you want to send some information to the google analytics while loading the page then you need to set trigger type to Page View, which means onload of the page the trigger will fire, sometimes you may need to send data to third party analytics when you perform some action on the page, in this case you must set trigger type to custom event and set a condition based on condition the JavaScript will fire

Variable :

When you perform some action on the page we need to send values to the third party analytics, how can we pass these values ? first we need to create variables in the google tag manager and assign values to these variables ,  the below snippet sends videoTitle and videoState to the third party analytics  when you click on play button of you tube video player

The videoTitle and VideoState are variable which we have created using google analytics user interface

In my next article I am going to cover how to track you tube video player events using google tag manager step by step

  • rocky

    valuable information. kudos to u