What is GTM?
GTM is for managing Google Analytics, advertising and other tracking tags across your website, multiple websites and mobile apps.
Google Tag Manager is a Tag Management System and free solution introduced in Oct 2012.
Tag Management Systems aim to simplify the deployment and maintenance of JavaScript tags.
TMS is designed to help manage the lifecycle of e-marketing tags, which are used to integrate third party software into digital properties.
Tags are tiny bits of website code that lets you to measure traffic and visitor behavior.
How it Works?
GTM replace the multiple tags with a single Container tag and afterwards arrange and “fire” individual tags as appropriate based on business rules.
How to configure GTM?
- Create a Google Tag Manager account
- Create a container for your site in the account
- Add the container snippet to your site
Add an account and create a container
Create a Tag for Button Click Events
Create a Trigger for Button click
Create a Variable
Default Built in Variable:
- Click Classes
- Click Element
- Click ID
- Click Target
- Page Path
- Referrer
GTM Snippet:
Paste this code as high in the <head> of the page as possible:
<!– 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-MN3XL7′);</script>
<!– End Google Tag Manager –>
Additionally, paste this code immediately after the opening <body> tag:
<!– Google Tag Manager (noscript) –>
<noscript><iframe src=”https://www.googletagmanager.com/ns.html?id=GTM-MN3XL7″
height=”0″ width=”0″ style=”display:none;visibility:hidden”></iframe></noscript>
<!– End Google Tag Manager (noscript) –>
Pros:
- Improves the quality of data
- Increases business growth
- Simplifies the tracking info using tags
Cons:
- Incorrect and duplicate tags make data inconsistent and loss
Google Tag Manager consists of these four main parts:
Container: A container is comprised of a set of tags, triggers and variables
Tag: A snippet of code (usually JavaScript) added to a page.
Triggers: Defines when and where tags are executed.
Variables: Used to receive or store information to be used by tags and triggers.
How to track GTM?
- Add a “Google Tag Assistant” extension in your chrome browser
- Click the “Enable” button to view the tracking from the browser
- Refresh the page
- Now you could see the fired tags will be available in extension