Google Tag Manager Tutorial 2018 with FREE PDF E-Book

What is Google Tag Manager?

Google Tag Manager (also known as GTM) is a free tag management solution provided by Google.

Through this ‘online tool’, you can deploy and manage various marketing and analytics tags on a website or mobile app.

Introduction to Tags


A tag is a bunch of JavaScript code which is used to collect measurement and marketing data from your website/mobile app and then send that data to 3rd party services. 

The third party service could be: Google Analytics, Google Adwords, Twitter, Facebook, Comscore etc.

Following is an example of Google Analytics Tag (also known as Google Analytics Tracking code):

<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-XXXX-Y', 'auto');
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->

 

Following is an example of Google Adwords Conversion Tracking Tag (also known as Google Adwords Conversion Tracking code):

<!-- Google Code for Test Conversion Page -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 928804124;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "wceHCILzjGQQ7drxugM";
var google_conversion_value = 100.00;
var google_conversion_currency = "GBP";
var google_remarketing_only = false;
/* ]]> */
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/928804124/?value=100.00&amp;currency_code=GBP&amp;label=wceHCILzjGQQ7drxugM&amp;guid=ON&amp;script=0"/>
</div>
</noscript>

 

Following is an example of Facebook Tag (also known as Facebook Pixel Code):

<!-- Facebook Pixel Code -->
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','//connect.facebook.net/en_US/fbevents.js');

fbq('init', '879030082151151');
fbq('track', "PageView");</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=879030082151151&ev=PageView&noscript=1"
/></noscript>
<!-- End Facebook Pixel Code -->

Other examples of tags are:

So you see, that tag is just a snippet of code.

You can add this snippet of code (or tag) directly to your website, by copying-pasting it, in your website template files (like header.php) or you can add the tag indirectly on your website, via Google Tag Manager (GTM).

Get the FREE PDF E-book (72 Pages)

Get the E-Book (62 Pages)

 

What is the Advantage of Adding Tags via Google Tag Manager?

What is the advantage of adding the tags to your website via GTM, when you can simply, directly place them on the website?

The advantage is, when you use GTM to add tags on a website, you get more control over:

  1. When the tag should fire.
  2. When the tag should not fire.
  3. Where the tag should fire.
  4. Where the tag should not fire and
  5. What the tag should do, when it get fired (executed)

In addition to this, via GTM, you can very easily: add, remove, enable or disable any tag on your website.

You can very easily change the functionality of almost any tag.

If you are not using Google Tag Manager, then you need to, manually add or remove the tags from one or many website template files, and you won’t be able to enable or disable these tags.

To disable a tag, you have to remove it from the template files.

To enable the tag, you have to add the tag back in your template files.

This is a lot of work (code changes) esp. if your website is big and use several tags.

Similarly, if you want to change the functionality of a tag, you have to first manually find the template file(s) where the tag is installed and then edit the tag code.

If you are using same tag in several different template files, you may miss to update the tag in some of the template files which can result in data discrepancies.

So when you do not use Google Tag Manager to deploy and manage tags, then your web developer/ IT has to work extra hard to maintain various tags on your website.

This increases your website maintenance cost.

So by not using Google Tag Manager, you end up spending more time and money on tag deployment and management. 

That is why you should use Google Tag Manager.

And above all, GTM is free to use

There is no monthly or yearly fees.

So there is really, no excuse, for not using GTM.

Now watch this short video to improve your understanding of GTM tags and other key concepts:

Key Benefits of using Google Tag Manager

Following are the key benefits of using Google Tag Manager:

Benefit #1: GTM removes the need for editing the website code over and over again

GTM removes the need for editing the website code over and over again just for adding, removing or editing tags.

Instead, one code is placed on every page on the website, which is the GTM container code.

This container code literally acts as a container, as it can store and deploy several marketing and analytics tags.

Through GTM user interface, you can: add, edit, enable, disable or remove any tag, with just few button clicks.

No need to hard code the website over and over again just for deploying and maintaining various tags.

Benefit #2: Through GTM you can test and deploy tags very fast

Through GTM you can test and deploy tags very fast without hard coding the tags each and every time on your website.

If you want to adapt rapidly and cost efficiently in response to changes in marketing conditions, search engine and social media landscape and competitive landscape then you need to move fast.

You can’t afford to spend weeks or even months, just to add bunch of tags on your website, because your IT team is too busy updating the product catalogues.

A common problem for most online businesses owners/marketers is, over dependence on web developers for any task related to website code which makes them very slow, when it comes to adopting anything agile or lean (agile analytics, agile marketing, lean startup etc). 

With GTM installed on the website, tags can be: added, edited, tested or removed in a matter of minutes.

That means you can move quickly.

For example, if you want to add survey on your website, say for just one day, just add and publish the survey tag to the website via GTM.

Once the day is over, disable the tag.

That’s it. 

No heavy coding,  no booking the time with IT, no direct changes to the website code.

Benefit #3: GTM makes advanced analytics tracking possible

The biggest advantage of using GTM is that, it makes advanced analytics tracking possible for your website.

GTM provides many in-built tags and variables through which you can implement advanced tracking in short amount of time.

The same task may take several days or weeks without GTM.

For example, say you want to track clicks on all external links on your website, so that you can determine how much traffic the website is sending out to other websites (advertisers, affiliates etc).

If you are using Google Tag manager, you can complete this task in a matter of minutes.

Without using GTM, you will have to add, event tracking code, to each and every external link, which is very time consuming and prone to errors.

Similarly, if you are using Google Tag manager, you can track clicks on ‘submit’ buttons embedded on pages across your website in a matter of minutes.

Without using GTM, you will have to manually add, event tracking code, to each and every submit button on the website, which is very time consuming and prone to errors.

Benefit #4: GTM makes tag management very efficient

When you use GTM, you can add, edit, enable, disable and remove all website tags from one central location.

This ability of the GTM, makes tag management extremely efficient esp. when you have got dozens of marketing and analytics tags on your website.

Benefit #5: By using GTM, you can improve website speed

When you deploy tags via GTM, they are deployed asynchronously, meaning a slow loading tag won’t block other tags from being fired (executed).

Understanding the Anatomy of Google Tag Manager Tool

If you treat Google Tag Manager tool as a car, then its engine is the container tag and its skin (look and feel) and controls are the user interface.

The container tag provides all the functionality needed for GTM tool, to run and deploy tags on your website.

The user interface makes it easy for you, as an end user, to control the container tag.

Just like, when you drive a car, the car steering, makes it easy for you to control the car engine, make it, turn the car left or right.

When coders refer to GTM, they usually refer to the container tag.

When non-coders refer to GTM,  they usually refer to the user interface.

Thus depending upon the context, GTM can either mean the ‘container tag’ or the ‘user interface’.

Get the E-book (72 Pages)

Get the E-Book (62 Pages)

Google Tag Manager Container Tag

Google Tag Manager container tag is a two part tag.

What that means, it is made up of two parts.

The following first part of the GTM container tag is placed in the head section (<head>…..</head>) of all of the web pages on your website:

<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-TXAAA');</script>
<!-- End Google Tag Manager -->

The second part of the GTM container tag is placed immediately after the opening <body> tag of all of the web pages on your website:

<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-TXAAA"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->

If you already have a GTM account then you can see the GTM container code by following the steps below:

Step-1: Login to your GTM account: https://tagmanager.google.com/

Step-2: Click on the ‘Admin’ tab.

Step-3: Click on the ‘Install Google Tag Manager’ link:

You will now see your GTM container tag code:

The GTM Container ID

The part of the GTM container tag code which reads ‘GTM-TXAAA’, it is called the container ID.

This ID is used to uniquely identify each GTM container tag.

The other part of the code which reads ‘gtm.js‘ is the JavaScript library used by the container tag

Once the container tag code is added to your website, the Google Tag Manager is considered to be installed on your website.

Whenever we refer to GTM in the context of coding, like if someone says “GTM pulls the data from data layer”, we are actually referring to the container tag. 

In short, Google Tag Manager is a container tag.

Related Article: How to get Google Tag Manager Container ID?

What is a Google Tag Manager Account?

https://tagmanager.google.com/ is your GTM account.

What is a Google Account?

This is a google account: https://accounts.google.com/SignUp

If you do not have a google account then you can create one by using this link: https://accounts.google.com/SignUp

Note: If you use Gmail then you already have a google account.

How to Create a GTM Account?

You need a Google account in order to create a GTM account.

Step-1: If you already have a google account then navigate to this web page: https://tagmanager.google.com/ and then login using your Google Account login (username and password).

Step-2: Click on the ‘create account’ link on the home page:

Step-3: Name your new GTM account after your company name (in our case ‘ABC Inc’) and then select your country from the drop down list:

Step-4: Select the checkbox ‘Share data anonymously with Google and others’ (to enable benchmarking) and then click on the ‘continue’ button.

Step-5: Enter the name of your container after your website name and then select ‘Web’ (provided you want to use the GTM container on a website)

Step-6: Click on the ‘Create’ button.

Step-7: Read the Google Tag Manager Terms of Service Agreement and then click on the ‘Yes’ button:

Step-8: If you do business in the European Economic Area then you would first need to read and accept the Data Processing Terms as required by GDPR before you can accept the GTM Terms of Service Agreement.

You have now created new GTM account and container.

Step-6: You will now be shown the code for installing Google Tag Manager. Just click on the ‘ok’ button for now. Once you clicked on the ‘ok’ button, you will see the GTM user interface.

GTM Account and Container Tag

Each GTM account can have one or more container tags.

The rule of thumb is to create one container tag for each website.

So if you have got 3 different websites, then you would create 3 different container tags, one for each website.

But you would create these 3 container tags from a single GTM account.

Creating/Using Multiple GTM Accounts

You can create multiple GTM accounts from a single Google Account login.

The rule of thumb is to create one GTM account per company/organization.

You can either create a new GTM account from scratch or you can add an existing GTM account to your GTM account.

Marketing agencies generally ask their clients to add their existing GTM accounts to their GTM account.

Since you can create/add multiple GTM accounts from a single Google account, you don’t need to create, several Google accounts for managing multiple GTM accounts.

Visual Representation of the GTM Account Structure

Since majority of businesses out there have got only one company and one website, their GTM account structure will look like the one below:

GTM Accout Structure3

If you are a marketing agency which own/manage multiple GTM accounts then your GTM account structure will look like the one below:

GTM Accout Structure2

Now watch the following two short videos to improve your understanding of GTM account structure:

Google Tag Manager Implementation and Deployment Process

Google Tag Manager implementation and deployment process include following thirteen steps:

  1. Determine tracking requirements
  2. Do Tag Audit of your live website
  3. Create functional and technical designs of your tags
  4. Do tag Deployment Planning
  5. Do the Risk Assessment
  6. Create Project Scope document
  7. Get buy-in from IT
  8. Setup Google Tag Manager Account
  9. Install GTM container tag on the staging website
  10. Create, test and publish tags on your staging website
  11. Install GTM container tag on the live website
  12. Create, publish and test tags on the live website
  13. Do tag audit of your live website.

In order to learn more about each individual step, read this article: Google Tag Manager Implementation & deployment Guide

How to Give Someone Access to a Google Tag Manager Account

Whenever you give GTM account access to a person, you give that access either at the account level or at the container level.

The access given at the account level is called the ‘Account permissions‘.

The access given at the container level is called the ‘Container permissions‘.

To learn more about GTM users and permissions, read this article: How to give someone access to Google Tag Manager Account?

How to Export / Import Container in Google Tag Manager

Through the export container feature, you can share your GTM configurations (aka tags, triggers and variables) with any third party.

What that means, if you want to share your GTM configurations for video tracking with a third party or another website, you can do that via GTM export container feature.

Through the import container feature, you can set up dozens of tags, triggers and variables in a container tag in one go.

This can come handy, when you need to set up same/similar tags, triggers and variables over and over again for multiple websites.

Without using the import container feature, you would have to manually set up each tag and its corresponding triggers and variables, and that too over and over again for each website.

To learn more about the export and import container feature in GTM, read this article: Importing – Exporting Container Tag in Google Tag Manager

Introduction to GTM Tag Templates

A tag template makes it easy to deploy a tag (esp. third party non-google tags) on your website. 

GTM provides dozens of tag templates.

To see the list of all available tag templates, click on the ‘Add a new tag’ link  on the container ‘overview’ page:

Now click on ‘Tag Configuration’:

You can now see the list of all available GTM tag templates:

Note: If you want to create and use your own tag, you can do that via ‘Custom HTML Tag‘ or ‘Custom Image Tag’:

Introduction to Triggers


A ‘Trigger’ is a condition which must be met during run time for a tag to fire or not fire.

There are two types of triggers:

  1. Firing Triggers
  2. Blocking Triggers

To learn more about triggers, read this article: Beginners’ guide to Triggers and Variables in Google Tag Manager

Introduction to Variables


A variable is a storage location in the computer memory.

In the context of GTM, variable is a function which is called from within another tag, trigger or variable.

In GTM a variable is denoted by using the following syntax:

{{Variable Name}} 

There are two types of variables in GTM:

  1. Built-in variables
  2. User Defined variables

To learn more about variables, read this article: Beginners’ guide to Triggers and Variables in Google Tag Manager

Introduction to Folders in Google Tag Manager

Through folders you can organize tags, triggers and variables by project name, team name etc.

For example, you can group all of the tags, triggers and variables related to ‘video tracking‘ by creating a folder called ‘video tracking’ and then adding all of the related tags, triggers and variables to it: 

Note: You can rename or delete a folder and/or add/remove items from the folder at any time.

Pagination in Google Tag Manager

If your GTM container has got more than 50 tags then the tag list is paginated.

By default, only the list of 50 tags are displayed at a time on a page which speed up the user interface.

You can see the paginated list by clicking on the ‘Tags’ link on the left hand side navigation and then scroll down to the bottom of the page:

Click on the > button to go to the next page.

You can also click on the ‘Show Rows’ drop down menu and see all the tags listed on a single page:

If your GTM container has got more than 50 triggers then the trigger list is paginated.

By default, only the list of 50 triggers are displayed at a time on a page.

You can see the paginated list by clicking on the ‘Triggers’ link on the left hand side navigation and then scroll down to the bottom of the page:

Similarly, if your GTM container has got more than 50 variables then the variable list is paginated.

By default, only the list of 50 variables are displayed at a time on a page.

You can see the paginated list by clicking on the ‘Variables’ link on the left hand side navigation and then scroll down to the bottom of the page:

Search Feature in Google Tag Manager

In Google Tag Manager you can search for a particular tag, trigger or variable by using the inbuilt search box.

You can see this search box embedded on the left hand side in your GTM workspace:

Through this search box you can search for any tag, trigger or variable:

When you click on a search result, you are redirected to a particular tag/trigger/variable.

If you want to search only among tags then follow the steps below:

Step-1: Click on the ‘Tags’ link on the left hand side menu

Step-2: Click on the ‘Magnifying glass located on the right and then enter your search term:

Similarly, you can perform a search among triggers and variables.

Introduction to Data Layers in Google Tag Manager

In the context of GTM, a data layer is a JavaScript array which is used to collect and store data from a website and then send that data to the GTM container tag.

Google recommends to use data layers, for retrieving run time information.

Your web developer can set up data layer for you.

This data layer contains all the information you want to send to the container tag.

In order to get the most out of GTM, you need to understand and use data layers.

I have explained data layers in great detail, in the article: Google Tag Manager Data Layer explained like never before.

 


Frequently Asked Questions (FAQ) about Google Tag Manager

Q. Is Google Tag Manager easy to use for a non-coder? 

Yes but only to a very limited extent.

If you want to considerably modify the way, a tag is fired or should behave, or if you want to implement advanced tracking like: scroll trackingecommerce tracking or enhanced ecommerce tracking then you need to have adequate knowledge of: HTML, DOM and JavaScript.

If you can not traverse a DOM, you won’t be able to get the best out of GTM.

Many non-coders start using GTM on Google’s recommendation but then they quickly get lost during the tags’ setup and configuration.

Once they can’t figure out, what is going wrong, they have no choice but to delegate the set up to a third party GTM expert/agency.

Q. Is Google Tag Manager easy to use for a coder?

Yes but only to an extent.

Though coders/developers have adequate knowledge of: HTML, DOM and JavaScript, they are still not familiar with the Google Analytics Developers environment.

This makes it difficult for them to capture GA data with or without GTM.

Q How do I become a GTM expert?

In order to become a GTM expert, you would need to develop very good knowledge of:

  1. HTML, DOM and JavaScript
  2. Google Analytics Developers environment.
  3. DOM Scraping
  4. At least working knowledge of regular expressions
  5. Working knowledge of a server side language (like PHP) is a bonus.

Q Will Google Tag Manager make me independent from the IT/Web developer?

Yes but only to an extent.

Even when you have got adequate knowledge of HTML, DOM and JavaScript, you would still need the help of client’s web developers/IT.

This is because, if you are not familiar with the server side language used by your client and/or the client’s development environment or database, then you will need the help of client’s IT/web developer, to add server side code to your data layers or to query their database for you.

Without adding sever side code to GTM data layers, you can’t implement many of the sophisticated trackings like ‘enhanced ecommerce tracking’ in GA.

The best practice is, to always involve your web developer / IT (now matter how confident you feel about your tags setup) during tag planning and deployment, as they understand their development environment better than you.

Q Can the use of Google Tag Manager create serious tracking/technical issues on my website?

Yes.

If you are deploying all of the marketing and analytics tags via the container tag and the container breaks during a website/code update, then all of your website tracking, can stop working immediately.

If you deploy a tag which conflicts with the website code, it can very easily break/modify certain website functionality.

Similarly, if you leave the tags deployed by GTM, hard coded on your website or you deploy the same tags through other tag management solutions, then this can inflate your analytics data.

So you need to be very confident, what you are doing with GTM.

In the wrong hands, GTM can be a dangerous tool.

Q Can I use same container tag on multiple websites?

Yes.

However the best practice is, not to do that, as it can create tracking issues.

Q Can I deploy GTM container tag code through another TMS (Tag Management Solution)?

Yes.

But it can prevent GTM from working correctly.

The rule of thumb is, not to use multiple TMS.

Q Are there any tags which can’t be deployed via GTM?

Yes.

GTM can not be used to deploy: synchronous tags, two part tags, tags that are associated with in-page structure or tags which are not compatible with GTM:

  • Synchronous tags – these tags block rendering of other web page elements when they are executed.
  • Tags associated with in-page structure – like social sharing widgets
  • Two parts tags – Tags with part of the snippet in the header and the other part in footer.
  • Tags not compatible with GTM – For example ‘Facebook JavaScript SDK‘ tag can not be deployed via GTM.

Q Do I have to migrate all of my tags to Google Tag Manager?

No.

However Google recommends to migrate all the tags which are supported by GTM.

Q. Does GTM work, even if you migrate only a subset of tags to Google Tag Manager?

Yes.

Q Does GTM collect any data?

No.

GTM itself does not collect any data.

However the tags it fires, may collect data.

Q What is the difference between Google Tag Manager and Google Analytics?

GTM is a tag management tool. Whereas Google Analytics is a website/mobile app tracking tool.

However this is not the only difference. There are many more.

Read this article for more details: Google Tag Manager (GTM) vs Google Analytics (GA) – 15 key differences

Q Can I use Google Tag Manager even when I don’t use Google Analytics?

Yes.

GTM is a tag management solution and can be used to deploy non-google tags.

Q How I can deploy non-google tags via GTM?

Through custom HTML tags or 3rd party tag templates.

Q Does GTM work on mobile websites and mobile apps?

Yes.

Q Will the use of GTM, slow down my website?

No.

Since GTM fire tags asynchronously, it can actually improve the website speed.

However there is one caveat here.

If your container tag is very large (contains lot of tags, triggers and variables) then it can negatively effect the website speed.

So if you are not using a particular tag, trigger or variable and you have no plan to use it in the future then remove it from the container.

Q Can I use Google tag manager in parallel with hard coded tags?

Yes.

If complete migration of all of your tags in not possible.

However,you need to make sure that you don’t do double tagging i.e. deploy same tag twice, once via GTM and once without GTM.

Q Will GTM work, if I deploy it, on only a part of my website?

Yes.

But then it will work, only on those web pages which contain the container tag.

Q Which type of tags are most likely to break my website functionality?

Custom HTML tags. Be very careful with them.

Use tag templates wherever possible esp. if you are brand new to GTM.

Q GTM is protocol relative. What does that mean?

It means it will work on both secure (https) and nonsecure (http) pages alike.

Q What is Google Tag Manager V2 (or GTM V2)?

It is the second and better version of Google Tag Manager. To access GTM V2, navigate to: https://tagmanager.google.com/

Q What is a rule in GTM?

GTM trigger was formerly known as rule.

Q What is a macro in GTM?

GTM variable was formerly known as macro.

Q What is the use of GTM API?

Through GTM API you can programmatically manage: accounts, containers, permissions, variables, tags and triggers.

Q How and where to get Google Tag Manager Help?

Before you ask for help from someone, do a quick search on Google to see whether your question has already been answered.

There is almost always a high probability that someone faced the same problem before you and got help.

If Google search does not help then the next step is to check out the Google Tag Manager Help Center.

If you are a developer then take a look at the official GTM Developer Guide.

If these resource do not help then post your question on a forum.

However before you post a question, make sure that your question clearly describe the way you encountered the problem.

This is required, so that your problem can be easily replicated by the people who are ready to help you.

If you just state your problem but do not disclose, how you encountered it (preferably step by step) then it would be very difficult for someone to help you.

Include screenshots, provide website URLs whenever you can.

The more clearly you can describe your problem, the better is the chance that someone will be able to help you.

Join the GTM Community on Google+

It has got more than 11k members and is probably the best place to ask any GTM question.

The The Official Google Tag Manager Forum and Stack Overflow are other great places to ask any questions related to Google Tag Manager.

If these online forms do not help either then contact us for paid assistance.

Get the E-book (72 Pages)

Get the E-Book (62 Pages)

 


Resources for Getting Started with Google Tag Manager


 

Read the following articles one by one, in the order in which they are mentioned:

#1 Google Tag Manager Data Layer explained like never before

To get the most out of GTM, you need to know and use data layers.

This article will teach you to create simple and complex data layers within few minutes. Always remember, GTM works best when used with data layers.

#2 Understanding Triggers and Variables in Google Tag Manager

In order to use GTM, you need to get familiar with the usage of triggers and variables.

This article is going to help you with that.

#3 Google Tag Manager Implementation Guide

Go through this article before you migrate all of your hardcoded tags to GTM.

If you don’t then there is a high probability that you may loose considerable amount of tracking data during migration esp. if your website is big and complex.

#4 Beginners guide to JavaScript for Google Analytics

Google Analytics itself is a JavaScript library and there is heavy use of JavaScript in GTM.

So it is important that you understand what JavaScript is and how it can be used to collect data via GTM.

#5 Introduction to Google Analytics JavaScript Library – Analytics.js

Analytics.js is the engine which power Google Analytics.

Whenever we refer to GA in the context of coding, we are actually referring to the analytics.js JavaScript library.

The first step towards understanding the Google Analytics Developers environment, is to understand the analytics.js JavaScript library.

#6 Introduction to Google Analytics Commands

In order to set up / troubleshoot any GA/GTM implementation, whether it is ecommerce tracking, cross domain tracking, event tracking or enhanced ecommerce tracking, you need to understand how the ga() command queue function works.

#7 Page Tracking in Google Analytics

Through page tracking you can measure the number of times a page was shown to your website users in GA.

This can be done by sending a pageview hit, each time a page is shown.

Implementing Page tracking is another step in understanding the Google Analytics Developers environment.

#8 Advanced Google Analytics Tracking – Introduction to DOM

To get the most out of GTM, you need to know what DOM is and how it can be traversed.

Without adequate knowledge of DOM, you would have hard time implementing any tracking via GTM.

#9 Regular Expression Guide for Google Analytics and Google Tag Manager

Regular expressions are frequently used in setting up complex goals and filters in GTM.

Without the use of regex, you will have hard time creating useful triggers in GTM.

#10 Understanding Google Analytics Diagnostic messages and notifications

Google Analytics diagnostic is a feature of Google Analytics through which you can identify and understand implementation issues.

When you are setting up GTM, to deploy various tags on your website, this diagnostic feature will help you a lot in debugging set ups (like ecommerce tracking).

#11 Complete Guide to Google Tag Assistant

Google tag assistant is a chrome extension through which you can troubleshoot the installation of various google tags on a web page.

It is a must have tool for GTM debugging.

#12 Guide to Google Tag Assistant Recordings

Google tag assistant recording is one of the most useful feature of Tag Assistant through which you can see the tags and events which were fired during say checkout process.

You can record tags, events and interactions for any set of pages.

#13 Google Tag Manager (GTM) vs Google Analytics (GA) – 15 key differences

This article outline the main differences between Google Tag Manager (also known as ‘GTM’) and Google Analytics (also known as ‘GA’):

#14 How to give someone access to Google Tag Manager Account?

Whenever you give GTM account access to a person, you give that access either at the account level or at the container level.

The access given at the account level is called the ‘Account permissions’.

The access given at the container level is called the ‘Container permissions’.

#15 How to get Google Tag Manager Container ID?

Learn to get Google Tag Manager (GTM) Container ID through this easy to understand step by step guide.

The container ID is used to uniquely identify each GTM container tag.

 


Advanced Google Tag Manager Resources


#1 Implementing E-Commerce Tracking via Google Tag Manager

Learn to Implement E-Commerce Tracking through Google Tag Manager via this easy to understand step by step guide.

#2 Google Tag Manager Workspaces

Learn all about Google Tag Manager Workspaces through this easy to understand guide.

A workspace is a container draft:

When you create a new workspace in GTM, you are infact creating a new container draft.

So creating 2 new workspaces means, creating 2 new container drafts.

Each container draft remains separate from other drafts.

#3 Tracking Virtual Pageviews in Google Tag Manager – Complete Guide

Learn to track virtual pageviews in Google Tag Manager, through this easy to understand, step by step guide.

Virtual pageview is that pageview hit, which you send to Google Analytics, without loading a web page in your web browser.

Any user interaction which is equivalent to a page being viewed, can be tracked via virtual pageviews.

One advantage of virtual pageviews over events is that, when you set up goals in GA, you can use virtual pageviews as funnel steps in Google Analytics.

You can’t use tracked events as funnel steps while setting up goals in GA.

#4 Cross device tracking with User ID in Google Tag Manager

Learn to implement cross device tracking with User ID in Google Tag Manager through this easy step by step guide:

user id data layer variable

User id is a unique set of alphanumeric characters (like 35464645fffs) assigned to a user so that he/she can be identified across devices/ browsers and over the course of multiple sessions.

#5 Setting up Dynamic Remarketing via Google Tag Manager

Learn to set up dynamic remarketing in Google Analytics and Google Adwords via Google Tag Manager:

data layer variables1

Remarketing is a technique which is used to re-target people who left your website and/or mobile app without completing a goal conversion (like making a purchase).

The people who are re-targeted are known as remarketing audience.

This audience is shown one or more targeted ads which are based on their past browsing behavior.

In the case of dynamic remarketing, Google automatically create re-targeted ads for your website visitors which are based on the actual product (or related products) or services they viewed on your website.

#6 Guide to Event Tracking via Google Tag Manager

Through this article you will learning the following:

  1. Tracking Clicks on a link via Google Tag Manager
  2. Tracking clicks on an image link via Google Tag Manager
  3. Tracking clicks on a button via Google Tag Manager
  4. Tracking clicks on the button which is embedded across a website
  5. Tracking form submissions
  6. Tracking Form Fields
  7. Video Tracking via Google Tag Manager
  8. Scroll Tracking via Google Tag Manager
  9. Tracking Clicks on external links across a website (Exit Tracking)

#7 Cross domain tracking in Google Tag Manager

Learn to implement Cross domain tracking in Google Tag Manager between two or more primary domains and its sub domains:

configuring UA tag in gtm

Google Analytics can not track across multiple domains, sub domains or top level domains by default.

This is because Google Analytics uses first party cookies which can be read by only that domain (website) which issued it.

#8 Implementing Scroll Tracking via Google Tag Manager

Learn to Implement Scroll Tracking through Google Tag Manager via easy to understand step by step guide:

rob script

Scroll tracking is one of the methods of measuring how people are consuming your website contents.

People who actually read your article are most likely to scroll your article page and by measuring the percentage of scroll, you can get a good idea of content consumption.

If majority of people do not scroll to the bottom of your articles then something may be wrong with your contents.

#9 Adjusting Bounce Rate via Google Tag Manager

Learn to adjust bounce rate in Google and Universal Analytics via Google Tag Manager:

custom html tag

Bounce rate is the percentage of single page visits (or web sessions).

It is the percentage of visits in which a person leaves your website from the landing page without browsing any further.

Google analytics calculates and report the bounce rate of a web page and bounce rate of a website.

We need to adjust bounce rate so that you can see true bounce rate metric in our Google Analytics report.

#10 Why you may no longer need Google Tag Manager

Understand the limitations of Google Tag Manager through this article:

As your need for integrating website data with various data sources increases and become more complex, you quickly realize, how hard it can be to create and maintain each integration in GTM.

In GTM we create integration with each data source via ETL (extract, transform, load).

#11 How to install and use Google Tag Manager in Segment.com

Learn to install and use Google Tag Manager in Segment.com:

‘Segment.com’ (formerly known as ‘segment.io) is a tool used to route/send data between multiple data sources.

The role of ‘segment.com’ is to ‘Extract’, ‘Transform’ and ‘Load’ data between different data sources.

It act as a hub between originating and destination data sources.

Both ‘segment’ and ‘GTM’ are primarily designed to be used by developers. 

However unlike GTM, ‘segment’ is much more non-developer friendly as it has the ability to automate many ETL functions.

#12 Google Tag Manager Content Grouping Setup Guide

Through this article you will learn to set up content grouping in Google Analytics via Google Tag Manager:

In the context of Google Analytics, a ‘Content grouping’ is a rule based grouping of related content groups.

It is made up of one or more content groups.

For example, if you sell clothes for both men and women on your website then all the web pages which sell men clothes can belong to ‘Men’ content grouping.

Similarly, all the web pages which sell women clothes can belong to ‘Women’ content grouping.

#13 Google Tag Manager WordPress Installation Guide

Learn to correctly install Google Tag Manager on your WordPress Website through this easy to understand step by step guide:

#14 Google Analytics Settings Variable in Google Tag Manager Explained

Through this article you will learn to create and use the new ‘Google Analytics Settings’ variable in Google Tag Manager:

Manually updating each and every ‘Universal Analytics’ tag to make sure all such tags have got same basic configuration options is time consuming and not practical esp. if you have got dozens or even hundreds of Universal Analytics tags.

Here the ‘Google Analytics Settings’ variable come handy.

Through this variable you can set, change and apply any or all of the configuration options under ‘More Settings’ (like ‘Fields to Set’, ‘Custom Dimensions’, ‘Custom Metrics’, ‘Content Groups’, ‘Ecommerce’ etc) from one central location to all tags of type ‘Universal Analytics’:

#15 Learn to install Google Tag Manager on your Shopify Store

Learn to install GTM on your shopify store through this easy to understand step by step guide:

If you are into ecommerce, chances are, you have heard of ‘Shopify’.

It is one of the most popular, ready made shopping cart solutions in the world.

Hundreds of thousands of websites use ‘Shopify’.

Shopify directly integrate with Google Analytics.

The set up is pretty simple.

But when it comes to Google Tag Manager, there is no direct integration.

#16 Learn to correctly setup Google Analytics for Shopify Store while using Google Tag Manager

Are you using Google Tag Manager or do you want to use GTM, for your Shopify Store?

If that is the case then do not deploy the Google Analytics tag via Google Tag Manager.

If you used GTM to install Google Analytics on your Shopify store (which you technically can) then your cross domain tracking won’t work:

So do not use GTM to deploy Google Analytics on your Shopify Store.

#17 Scroll Tracking via Scroll Depth Trigger in Google Tag Manager

Learn to use the new Scroll depth trigger in Google Tag Manager to track, how far website visitors scroll contents on your website.

The term which denotes, how far website visitors scroll contents on your website is called the ‘Scroll Depth’.

This Scroll depth can be vertical or horizontal depending upon the type of scrolling available on your website.

The tracking method which is used to measure ‘Scroll Depth’ is called ‘Scroll Depth Tracking’ or ‘Scroll Tracking’.

#18 Video Tracking via YouTube Video Trigger In Google Tag Manager

Learn to use the new YouTube Video trigger in Google Tag Manager…to track YouTube Videos embedded on a webpage:

The tracking method which is used to track/capture the various player states of an embedded video is called ‘video tracking’.

A player state is a specific user interaction with a video.

Following are the example of various player states which can be captured for YouTube videos via GTM:

  1. Start
  2. Pause
  3. Seek
  4. Bufferring
  5. Progress
  6. Complete

#19 Guide to Google Tag Manager Debug Console

Through Google Tag Manager preview and debug console window, you can make sure that your tags, triggers, variables and data layers work as expected.

By default, what you actually preview and debug is the deployment of the current container draft on your website.

You preview and debug the container draft on your website, as if it is currently deployed.

When you enable the preview mode, the GTM preview and debug console window appear at the bottom of the page:

#20 How to send Client ID to Google Analytics via Google Tag Manager

Learn to send Client ID to Google Analytics via Google Tag Manager through step by step guide:

Google Analytics identify a user as unique through a combination of unique random number and the first time stamp (i.e. the time of first visit), called the ‘Client ID’.

Client ID is created and assigned by Google Analytics cookie _ga.

#21 Secret to Setup Facebook Pixel Tracking Correctly in Google Tag Manager

Do you know, most likely your Facebook Pixel tracking in Google Tag Manager is not set up correctly and it is costing you money?

In this article, I will show you, how to setup Facebook Pixel Tracking Correctly when using Google Tag Manager.

#22 Importing – Exporting Container files in Google Tag Manager

Complete guide to importing and exporting containers in Google Tag Manager.

Through the export container feature, you can share your GTM configurations (aka tags, triggers and variables) with any third party:

What that means, if you want to share your GTM configurations for video tracking with a third party or another website, you can do that via GTM export container feature.

If you want to share the GTM configurations of your entire container with a third party or another website, you can do that via GTM export container feature.

If you want to share a particular container version or workspace, you can do that via GTM export container feature.

The GTM export container feature is basically equivalent to downloading a particular container version or workspace.

#23 How to turn on IP Anonymization in Google Analytics and Google Tag Manager

Learn to turn on IP Anonymization in Google Analytics and Google Tag Manager through this step by step guide:

If your privacy policy or local privacy laws prevent the storage of full IP addresses then you can use the IP anonymization feature to anonymize/mask website visitors IPs.

This will help you in complying with GDPR (General Data Protection Regulation).

When you anonymize visitor IP, the last 3 digits from your website visitor’s IP address are automatically dropped / deleted.

In other words, the IP anonymization feature sets the last octet of IPv4 user IP addresses and the last 80 bits of IPv6 addresses to zeros.

 


Google Tag Manager Tools

Code Editor for GTM – chrome extension for getting full code editor within the GTM interface.

Data Slayer – chrome extension for debugging GTM.

GTM Sonar – chrome extension to debug page template to check whether it works with GTM auto event listeners.

Google Tag Manager Help Center – information on setting up and using Google Tag Manager

Google Tag Manager for Web Tracking – developers guide on setting up Google Tag Manager

Tag Manager Injector – chrome extension for injecting GTM container tags into a webpage. comes handy for testing.

Free AJAX Event Listener for Google Tag Manager

Other article you will find useful: Implementing rollup reporting in Google Analytics 

Do you want to Learn Web Analytics in 4 Weeks?

  • Learn and Master Web Analytics, Conversion Optimization & Google Analytics from Industry Expert in 4 weeks.
  • Lifetime access to the course + Lifelong FREE course updates.
  • New study material added every few months (lifelong learning).
  • Up to date training material.
  • Most exhaustive course on Google Analytics on the internet.
  • Hundreds of Assessments to test your learning.
  • Your 24/7, 365 days a year reference source.
  • Learn at your own pace and from any place.
  • Risk Free with 30 days 100% Money Back Guarantee.

Take your Analytics knowledge to the next level. Checkout my Best Selling Books on Amazon

Maths and Stats for Web Analytics and Conversion Optimization
This expert guide will teach you how to leverage the knowledge of maths and statistics in order to accurately interpret data and take actions, which can quickly improve the bottom-line of your online business.

Master the Essentials of Email Marketing Analytics
This book focuses solely on the ‘analytics’ that power your email marketing optimization program and will help you dramatically reduce your cost per acquisition and increase marketing ROI by tracking the performance of the various KPIs and metrics used for email marketing.

Attribution Modelling in Google Analytics and Beyond
Attribution modelling is the process of determining the most effective marketing channels for investment. This book has been written to help you implement attribution modelling. It will teach you how to leverage the knowledge of attribution modelling in order to allocate marketing budget and understand buying behaviour.

Himanshu Sharma

Certified web analyst and founder of OptimizeSmart.com

My name is Himanshu Sharma and I help businesses find and fix their Google Analytics and conversion issues. If you have any questions or comments please contact me.

  • Over eleven years' experience in SEO, PPC and web analytics
  • Google Analytics certified
  • Google AdWords certified
  • Nominated for Digital Analytics Association Award for Excellence
  • Bachelors degree in Internet Science
  • Founder of OptimizeSmart.com and EventEducation.com

I am also the author of three books:

error: Alert: Content is protected !!