For marketers
who love technology

How to use Google Tag Manager

An analytics tag is a small piece of javascript code to capture events from a website or a mobile app and pass it to another application, such as Google Analytics.

Tags are useful to people that are a little bit closer to the technical side of digital marketing than pure marketers, as tag implementation often requires a good technical understanding of web technologies and javascript.

Why are tags useful in Google Tag Manager?

You need to use tags for measuring the KPIs that are not supported by default by your analytics engine (most probably Google Analytics).

  • Example: if you use an affiliate program such as amazon affiliates, you want to track the clicks on outbound links to 
    • Bad news: google analytics does not track outbound clicks... 
    • Good news: you can use google tag manager to track them!
  • Another example: if you have an e-commerce portal, you are tempted to cry every time a customer leaves the website before validating her shopping cart. 
    • Good news,  remarketing tags enable you to target specifically these users in your marketing campaigns.
    • Another example: you can use a custom tag to push the cart content to your analytics engine before the payment operation, to analyze what cart items lead to high abandonment rates.

How can I implement tags with Google Tag Manager for my website or mobile app?

If you are not at ease with implementing GTM yourself, you can get it done for 15$ on Fiverr. Why would you scratch your head instead of paying a pro?

Defining a tag implementation plan

  1. Start with the basics: define a digital marketing and measurement plan, by following the steps below:
    1. Document the business goals,
    2. the targeted audience,
    3. the selected channels,
    4. the call-to-actions linked to the business goals,
    5. the KPIs linked to the call to actions and business goals to track channel performance: metrics and dimensions,
    6. and finally, SMART goals on measured KPIs.
  2. You can now define your tag implementation plan. Google provide a great example reproduce below:

Code example to configure the actual tags and enable Google Tag Manager(GTM)

The trigger code for firing the tags can be integrated into the onClick events of your links for example (from Google documentation):
<a href="#" name="button1" 
onclick="dataLayer.push({'event': 'button1-click'});" >Button 1</a>

To integrate the Google Tag Manager features on your website, you need to add a script at the top of all your pages withing the head section of the html code. This code is called the container snippet. It is provided in the admin interface of Google Tag Manager, and looks like this:

<!-- Google Tag Manager -->
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
<!-- End Google Tag Manager -->

The tags can include a lot of pre-defined fields of information but also variables from your website page. To enable the sending of custom variables from you page, you need to activate what Google Tag Manager calls the data layer. This is a great feature, because you can then
  • build triggers based on the specific information of your website, and 
  • push whatever information is relevant for your site, to your analytics engine. 
To enable the data layer, you just add the following code before the container snippet.
  dataLayer = [];

You can also already set static variables for the specific page where you are integrating the javascript snippet:
  dataLayer = [{
    'pageCategory': 'signup',
    'visitorType': 'high-value'
This is a super short introduction: have a look to the google tag manager quick start page for more!

You should install the Google Tag Assistant extension for Chrome. It will help you debug your tag implementation.

Where can I learn to use Google Tag Manager?

Google academy includes several great video tutorials on Google Tag Manger! See below:

The concepts behind Google Tag Manager

  • Each tag is associated with a trigger: the conditions that, well... Trigger the sending of information to the Analytics platform. 
    • A trigger is a logical expression: if "variable x operator x value" then execute the trigger. 
    • For instance, the trigger for a tag can be "PagePath begins with 'thankyou'".
    • There are a few types of triggers, that you can use with Google Tag Manager:
      • Pageview (web)
      • Clicks (web)
      • Form submission (web)
      • History change (web)
      • JavaScript error (web)
      • Timer (web)
      • Custom events (web & mobile)
    • The custom triggers are often added as onclick events:
      • Example from Google documentation:
        <a href="#" name="button1" 
        onclick="dataLayer.push({'event': 'button1-click'});" >Button 1</a>
I hope you like this post. If you read through it, congrats: it gives you a significant introduction to GTM features. And do not forget: sharing is caring. 

Any Tweets, LinkedIn, and Facebook shares are highly appreciated. Thanks!


About Gilles


  1. Digital marketing is the leading marketing strategy in present days. To hire the best marketing agencies for digital marketing, you can visit this link-Digital Marketing Agency.