Google Tag Manager “How to” Guide for Analytics

Google Tag Manager (GTM) is a free Google tool that helps implement Google Analytics tags easily onto your website. Because GTM works with a container code snippet, analysts need very little help from developers. No more nagging developers to handle website tickets! Developers also like GTM because there is less code, creating fewer opportunities for bugs and errors.

To get started, create a GTM account at Then have a developer place the GTM container code snippet immediately after the opening <body> tag of your site.

image 1

Have the developer also place the dataLayer object right before the GTM snippet. If needed, Google has great resources for developers to understand the dataLayer.

image 2

In the container code snippet, the GTM unique ID (GTM-XXXX) ties to the GTM account you just created. Within the GTM user interface, your tags will tie to your Google Analytics tracking ID. GTM can also implement tags needed for other tools such as Google AdWords, Adometry, AdRoll, comScore and many others. Although for this blog post we’ll cover only Google Analytics implementation using GTM.

GTM is built upon four concepts: tags, triggers, variables and the dataLayer.


Tags include the basic page view, event, transaction, social, timing, decorate link, decorate form and cross-domain tracking tags. If you need base Google Analytics with no advanced tagging, simply implement the page view tag with an all pages firing rule. The page view tag automatically gives all base analytics tracking.

image 3


Triggers tell the tag when to execute. Without a trigger, no tags will fire or send data. Triggers could be set to a page view hit, a click on a specified HTML element, a form submit, timer or other actions. You can also set exceptions (or blockers) for triggers, telling triggers when NOT to fire.

image 4


Variables are used to store values used by tags and triggers. Variables (previously called Macros) are always found within {{curly brackets}} and are used to dynamically populate a variable. For example, use the variable {{click URL}} as an event label, and the event label would dynamically populate with the destination URL of a user’s click. Variables can also be time savers, as in the case of using a constant variable to remember a Google Analytics tracking ID. For more information on variables, take a look at Simo Ahava’s helpful blog post.

image 5

The dataLayer

The dataLayer is an optional JavaScript array implemented above the GTM container snippet. Although the dataLayer isn’t technically necessary, GTM works most powerfully with it. A developer can help you store important information in the dataLayer, such as eCommerce information (product skew or product price) or meta-data information (content tags or content categories). GTM will push values automatically into the dataLayer (i.e., event: “gtm.js”), however, you can choose to store information valuable for your reporting that can then be retrieved with a dataLayer variable.

image 6

As you set up your tags, triggers, variables and dataLayer, frequently use preview mode to check your tracking. Preview mode lets you see the site as if the code was already deployed. In preview mode, look to see (1) events firing, (2) data pushed to the dataLayer and (3) detailed event/tag information. Each time you make a GTM change, click Preview Mode again to see the changes reflected in the debugging mode.

While the learning curve for GTM can be steep, take time to learn the basics as well as test yourself with more advanced tagging. Learn how to track users hovering over an image or how many users abandon your webpage form. GTM will be rewarding as you can function more independently, requiring less time from developers.

By Sarah Ingle

Keep reading in Analytics