Marketing

What is Google Tag Manager: Setting Up Google Analytics & Custom Tracking With GTM

What is Google Tag Manager?

Google Tag Manager is a single code that can be placed on a website one time, ideally prior to the launch of your website, that will allow all of your tracking codes and scripts to be managed at any time from the external Google Tag Manager interface, which pushes those updates to the site without the need for ever touching the site’s code.

Tag Manager Uses

With a little creativity, there are endless uses for Google Tag Manager. The customizations available will allow you to setup tracking for just about anything, but a couple basic examples of what is possible include:

  • Installing and updating Google Analytics
  • Implementing Google Analytics event tracking
    • Form submissions
    • PDF downloads
    • External link clicks
    • Phone number clicks
  • Implementing Google Analytics custom dimensions
    • Logged in vs. logged out users
    • Specific plans or levels of subscriptions
    • Groupings of content (by subject, author, etc.)
  • Installing AdWords remarketing and conversion tracking tags
  • Tracking activity/analytics across multiple domains

Have a favorite GTM customization? Let us know in the comments!

Introductory GTM Terminology

Before getting started with Google Tag Manager, there is some basic terminology you should be familiar with to make sure your account is structured in the most efficient and user-friendly way possible.

Accounts

An account is an over-arching level of organization within Google Tag Manager. Generally speaking, you will only need one account per company. All of the tags for each of a company’s websites can be managed from this single account.

Containers

When you first create your Google Tag Manager account, you will be prompted to create your first container as well. A container will house all of the tags for any given website. It is a good practice to name your container after the website that it is for.

A container snippet (the Tag Manager code) will be provided for each container. You will want to copy and paste this snippet following the opening body  tag on every page of your site. You should make sure to remove all of your Google Analytics, AdWords Conversion Tracking, and additional tags from your site when adding the container snippet if/when you add those through Google Tag Manager.

Tags

You will create a tag for each snippet of code that you would traditionally add to your website. This includes Google Analytics, AdWords conversion tracking, and remarketing scripts as well as custom events, form submission tracking, and any other custom codes on your website.

Rules

A rule defines when a tag is fired. By default, each container has a rule for “All Pages.” This is what you would use for any site-wide code, such as Google Analytics. A tag will not fire unless a rule is added to it. Rules can be created based on certain pages or interactions with a page, such as a link click.

Macros

Macros allow for dynamic interaction between a website, tags, and rules. Some macros are predefined, such as “url” which will call the URL of the current page. Custom macros can also be defined based on website content or a user’s interaction with a website.

GTM Examples

Google Analytics

Probably the first code you will want to set up with Google Tag Manager is Google Analytics. Here are the steps for doing so:

  • Go to http://www.google.com/tagmanager and click Sign Up
  • Select “New Account” and follow the setup process:
    • Use your organization’s name for the account name and your domain for your container name
    • Make sure to set the appropriate time zone for your organization

      Create Tag Manager Account

  • Add the tag manager code to all of the pages on your website

    Install Google Tag Manager

Next…

  • Find the UA-XXXXXX-X code for your existing Google Analytics account or create a new Google Analytics account if you do not currently have one

    Find Google Analytics Code

  • From the main GTM menu, select New > Tag (red button)

    Create Tag Manager Tag

  • Name your tag something like “Google Analytics – Organization Name”
  • Add your analytics tracking ID
  • Make sure “Page View” is selected for Track Type
  • Make sure to specify a Firing Rule of all pages

    Installing Google Analytics with Tag Manager

  • Once you save the Google Analytics tag, you will need to publish it from the Tag Manager Dashboard. This will create a new “version” in the tag manager

    Publish Tag Manager Tag

  • You will also need to go into your website and make sure any existing Google Analytics code has been removed
  • Finally, use real-time analytics to test and make sure it is tracking properly

If you want to share access to your GTM account…

  • Go to your profile from the maine account list and select the “Users” tab
  • Add the email addresses you want to have access to your GTM account as users

Event Tracking for External Links

Google Tag Manager can be a huge time saver when it comes to setting up event tracking. Event tracking for external links is particularly useful in tracking clicks between domains for organizations who have multiple websites. It is possible to set up event tracking manually, but you would have to go through every link on your site that you want to track and add some code to each individually, which isn’t very practical. With GTM, you can set up a simple tag that will automatically track all of your external links in just a couple of steps.

  1. Add a tag of type Event Listener → Link Click Listener. You can name it “Link Click Listener”. Add a single firing rule of “All pages”.

    Create Link Click Listener Tag

  2. Add a rule for the outgoing links to the client’s second domain. For example, create a rule named “Clicks to B.com” and enter the following conditions:

    Create Tag Manager Rule

    {{event}} equals gtm.linkClick
    {{element url}} contains B.com

    Event Click Rule

  3. Add an Analytics event tracking tag (i.e. Tag Type of Google Analytics or Universal Analytics; Track Type of Event) and name it after the domain you are tracking. Add the rule you created in the previous step as the firing rule. Enter a Category, Action, and and Label for the event.

    Example:
    Category – Clicks to B.com
    Action – Referring page: {{URL}}
    Label – External link clicked: {{element URL}}

    Event Click Tag

  4. Save a version of the container and publish it.

    Publish Tag

Form Submissions

The final example for this post is tracking form submissions. With Google Tag Manger, you can set up automated form submission tracking similarly to how you would set up link click tracking, but with a form submit listener rather than a link click listener.

  1. Add a tag of type Event Listener → Form Submit Listener. You can name it “Form Submit Listener”. Add a single firing rule of “All pages”, or, for the specific page(s) on which you want to listen for form submissions.

    Tag Manager Form Submit Listener

  2. Add a rule (named “Form Submit” for example) with the following condition:

    {{event}} equals gtm.formSubmit

    Form Submit Rule

  3. Add an Analytics event tracking tag (i.e. Tag Type of Google Analytics or Universal Analytics; Track Type of Event). Add the rule you created in the previous step as the firing rule (for example, “Form Submit”). Enter a Category, Action, and Label for the event. For example, you might use the following:

    Category “Forms”
    Action “Submit”
    Label “Lead Gen”

    Form Submit Tag

  4. Save a version of the container and publish it.

    Publish Form Submission Tracking

Is there anything you’d like to know how to track? Let us know and you might find a tutorial here on the blog. Have a favorite Google Analytics or Tag Manger customization? We’d love to hear about it!

Executive's Guide to Inbound Marketing

All of the tools you'll need to run successful inbound marketing campaigns.

Leave a Reply