Website analytics provide the statistical data for you to interpret the performance of your online business, establishing bench marks, and measurement of campaigns or work performed to improve the visibility, engagement and conversions for your online website.

Google Tag Manager (GTM) makes it quick and easy to deploy and update measurement tags, including Google Analytics, on your websites and mobile apps without the need of major code changes and app releases by your website developers. Google Tag Manager has now revolutionised the way website designers and marketers implement scripts and tags onto websites.

Use Google Tag Manager to manage tags (such as tracking and marketing optimisation JavaScript tags) onto your website. Without editing your site code, you use the Google Tag Manager user interface to add and update Google AdWords, Google Analytics, Floodlight, and non-Google tags such as Facebook, Twitter or LinkedIn tracking pixels. This reduces errors and allows you to deploy tracking tags on to your website quickly and efficiently.

For Google Android or iOS mobile apps you can use Google Tag Manager to manage the app analytics and advertising tools in your apps without having to rebuild and resubmit the applications’ binaries to the app marketplaces.

Google Tag Manager is a free tool provided by Google, that eliminates tedious code-editing tasks for your website. The easy-to-use web interface lets your marketing colleagues add and update their own website tags—including javascript code snippets for conversion tracking, site analytics, remarketing and more. They can do it all without bothering the website development team.

Benefits of Google Tag Manager

  • IT-friendly – Google Tag Manager has lots features to set your mind at ease—like user permissions, automated error checking, the Debug Console, and asynchronous technology.
  • Quick and easy – Users add or change tags whenever they want, to keep websites running smoothly and quickly. Tags are managed with an easy-to-use web interface, so there’s no need to write or rewrite site code following implementation.
  • Verified tags & templates – Google Tag Manager makes it easy to verify that new tags are working properly. Built-in tag templates and automatic error checking also prevent tags with improper formatting from even being deployed on your website.
  • Swift loading – Google Tag Manager replaces all your measurement and marketing tags with a single, asynchronously loading tag—so your tags can fire faster without conflict.
  • Multi-platform – Google Tag Manager works for mobile sites, and other platforms.

Let marketers add tags to your website? Absolutely. There’s no need to worry about Google Tag Manager disrupting your site. Google has built in a tag Preview Mode and error-recovery features like version history to make sure that no one will deploy a tag that could break the website. Plus, they have included user permission controls to grant and manage different levels of access.

How to get started with Google Tag Manager

The Google Tag Manager container snippet is a small piece of JavaScript and non-JavaScript code that you paste into your pages. It enables Tag Manager to fire tags by inserting gtm.js into the page (or through the use of an iframe when JavaScript isn’t available).

To implement Google Tag Manager on your website:

  1. Copy the following JavaScript and paste it as close to the opening <head>tag as possible on every page of your website, replacing GTM-XXXX with your container ID:
    <!-- 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-XXXX');</script>
    <!-- End Google Tag Manager -->
  2. Copy the following snippet and paste it immediately after the opening <body>tag on every page of your website, replacing GTM-XXXX with your container ID:
    <!-- Google Tag Manager (noscript) -->
    <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXX"
    height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
    <!-- End Google Tag Manager (noscript) -->

Many tag management operations can be achieved by just doing the basic code installation, but if you’d like to have finer control over tag events or data, you may want to use some customisation using the asynchronous methods.

Note: The Google Tag Manager snippet must be placed directly in the page that you intend on tracking. Placing it in a hidden iframe or deploying it within another tag management system will prevent certain tags from accurately tracking the parent page.

Multiple Domains

While you can use the same container for multiple websites it’s recommended that each separate web property that you manage be deployed with its own container. This separation will prevent changes specific to one website from having undesired effects on other websites using the same container. In some situations, however, when multiple TLDs (Top Level Domains) or subdomains are considered to be members of the same website, it may be beneficial to manage their tags through the same Google Tag Manager container.

When choosing to use a single container across multiple domains, it’s important to carefully configure your tags and triggers within Google Tag Manager. Using the default “All Pages” trigger in Google Tag Manager (i.e. $url matches RegEx .*) will fire tags on all pages of all domains on which your container snippet is deployed. Since some tags have configurations or purposes specific to the domain on which they’re deployed, you may need to create custom triggers (or even remove the “All Pages” trigger) to fire tags on all pages of one or each domain individually.

For example, you may choose to deploy your Google Analytics tracking code through GTM with configurations to support GA tracking across multiple domains or subdomains.

In such a case, you would add a line of code to your GA tracking code to manually set the first-party domain on which to set the GA cookies (e.g. on www.example-petstore.com and dogs.example-petstore.com, you might set the cookies to the common domain, .example-petstore.com). However, on the secondary site, www.my-example-blogsite.com, you might set the cookies to .my-example-blogsite.com. Therefore, you would want one of two GA tracking code tags (one set to .example-petstore.com, and one set to .my-example-blogsite.com) to fire on each of the two domains. If both domains were sharing a common GTM container, using the default “All Pages” trigger in Google Tag Manager, would cause each tag to fire on all pages of both domains.

Improve the accuracy of website traffic data

Marketers often need to identify and isolate various types of traffic in Google Analytics dashboards and reports. For example, many companies want to eliminate spam or internal (employee) traffic and visits from partners. Typically, they do this by using excluding filters in Google Analytics.

Google Analytics limits the number of filters to 100. If you have a large number of internal IPs you wish to exclude, I recommend that you use GTM to implement blocking triggers. Blocking triggers are built with a custom variable and a custom event trigger.

Keep in mind that if you use a blocking trigger, these traffic types will be excluded from any or all Google Analytics views — including the unfiltered view.

Implement structured data

Structured data is a key way to improve organic search results, but it can be difficult for marketers to implement — especially if you need to rely on technical resources. Google Tag Manager makes it easy for non-developers to implement structured data on any page of a website.

Import marketing automation parameters

Most companies use marketing automation software to capture lead data and track leads through the sales funnel. With Google Tag Manager, you can easily implement lead-tracking parameters and marry this data with Google Analytics information.

With the built-in variable of first-party cookie, Google Tag Manager can pass lead ID number, along with other parameters, into Google Analytics.

Google Analytics events

Google Tag Manager only fires tags in response to events. This article explains how to use auto-event tracking to generate Google Analytics tags that are triggered…

  • in response to clicks on links,
  • in response to a click on any type of element,
  • at timed intervals,
  • and when a form is submitted.

If auto-event tracking does not meet the needs of your scenario, you can manually trigger events from your code.

Note on Google Tag Manager variables: A value in a trigger or tag is a Tag Manager variable when they are wrapped in double brackets. For example: “Label: {{Click Text}}” denotes a variable as the value of the label field. “Label: Buy” denotes plain text entered by the user as the value of the label field.

Note on the difference between Google Analytics events and Google Tag Manager events: Analytics events are hits sent as the result of Analytics tags fired from Tag Manager. Tag Manager browser events are user interactions with web page elements (“DOM elements”) that are registered by the browser and pushed into the Tag Manager data layer so that they may be used to set up triggers.

Clicks on links

For the purposes of this discussion, imagine that every page on your site has a navigation menu that allows you to go to the “Buy” page, the “About” page, or the “Contact” page, depending upon which navigation item is selected. The “Buy” selection links to “http://example.com/buy.html”. “About” links to “http://example.com/about.html”. “Contact” links to “http://example.com/contact.html”.

The goal is to generate a Google Analytics event each time someone clicks one of these navigation items, so that they can be tracked individually. There are two methods for how to set this up shown here: One that uses separate triggers and tags for each type of link, and one that uses a regular expression to combine all click tracking into one single trigger and tag.

Set up click tracking using separate triggers and tags

  1. Add a basic Google Analytics page tracking tag if you don’t already have one. This tag must fire on all pages.
  2. Enable Tag Manager to capture clicked URL values. Navigate to ‘Variables’ on the left-hand navigation and check the box next to the ‘Click URL’ built-in variable.
  3. Create triggers to track link clicks for buy.html, contact.html, and about.html:
    1. Navigate to ‘Triggers’ on the left-hand navigation and create a new Trigger with the following settings:
      • Type: Click
      • Targets: Just Links
      • Wait for tags: Check
      • Max wait time: (use the default value of 2000ms)
      • Check Validation: Uncheck
      • Enable When: Click URL contains buy.html
      • Fire On: All Clicks
      • Save Trigger as “Buy Clicks”
    2. Repeat these steps for “contact.html” and “about.html”
  4. For each link, add a new Google Analytics event tracking tag and set the firing conditions to the corresponding triggers configured above. For example:
    1. Start by creating a tag to track clicks on the Buy links. Navigate to ‘Tags’ on the left-hand navigation and create a new tag with the following settings:
      • Tag: Universal Analytics
      • Triggers: Click
      • Name: Buy Clicks
      • Tag Name: UA – Event – Buy Link
      • Tag type: Universal Analytics
      • Track Type: Event
      • Category: Nav
      • Action: Select
      • Label: Buy

      NOTE: The Label value should correspond to the particular link being clicked (e.g. Buy for buy.html, Contact for contact.html, and About for about.html).

    2. Save the tag as “Nav Clicks”.
    3. Repeat for the Contact and About links.
  5. Publish

Set up click tracking using a single tag

  1. Add a basic Google Analytics page tracking tag if you don’t already have one. This tag must fire on all pages.
  2. Enable Tag Manager to capture clicked URL values. Navigate to ‘Variables’ on the left-hand navigation and check the box next to the ‘Click URL’ built-in variable.
  3. Create one trigger for link clicks for buy.html, contact.html, and about.html.
    1. Navigate to ‘Triggers’ on the left-hand navigation and create a new Trigger with the following settings:
      • Type: Click
      • Targets: Just Clicks
      • Wait for tags: Check
      • Max wait time: [enter appropriate time here, e.g. 2000ms]
      • Check Validation: Uncheck
      • Enable When: ‘Click URL’ matches RegEx contact\.html|buy\.html|about\.html
      • Fire On: All Clicks
    2. Save trigger as “GA – Trigger – Nav Clicks”
  4. Create a new Tag to handle all navigation clicks:
    1. Navigate to ‘Tags’ on the left-hand navigation
      • Product: Google Analytics
      • Tag Type: Universal Analytics
      • Enter Tracking ID
      • Track Type: Event
      • Category: Nav
      • Action: Click
      • Label: {{Click URL}}
      • Apply the trigger “GA – Trigger – Nav Clicks” to the tag
    2. Save the new tag as “GA – Event Tag – Nav Clicks”
  5. Publish.

Clicks on any specified element type

Imagine that your webpage contains elements that users might click which are not traditional links. This could be an image, a <div> element, or any other item on the page accessible by the DOM. This technique will generate a Google Analytics event each time someone clicks on one of these elements. For this example, we will assume clicks on an image with a class of Gallery_Image:

  1. Add a basic Google Analytics page tracking tag if you don’t already have one. This tag must fire on all pages.
  2. Enable Tag Manager to capture the class of a given element.
    1. Click “Variables” in the left navigation.
    2. Under “Built-In Variables”, click “Configure”.
    3. Check “Click Classes”.
  3. Create a new Trigger:
    1. Navigate to ‘Triggers’ on the left-hand navigation and create a new Trigger with the following settings:
      • Type: Click
      • Targets: All Elements
      • Fire On: Some Clicks
      • Click Class contains Gallery_Image.
    2. Save the trigger as ‘GA – Trigger – Gallery Image Click’
  4. Create a new Tag:
    1. Navigate to ‘Tags’ on the left-hand navigation
      • Tag: Universal Analytics
      • Enter Tracking ID
      • Category: Image Gallery
      • Action: Click
      • Label: {{Click ID}}
      • Apply the trigger ‘GA – Trigger – Gallery Image Click’ to the tag
    2. Save the tag as ‘GA – Event Tag – Gallery Image Click’
  5. Publish.

Timed intervals

Note on implementing timed intervals: Timed interval tracking may influence your bounce rate calculations in Analytics, possibly resulting in a lower bounce rate.

Tracking timed intervals can be used used when you have a page where users might spend a significant amount of time without triggering any events, such as a page with embedded video, and you would like to track how long users are on the page. Additionally, given that Google Analytics sessions timeout after 30 minutes by default, you may wish to implement a ‘keepalive event’ to ensure that activity is sent every 25 minutes. For this purpose, you may use a GTM Timer:

  1. Add a basic Google Analytics page tracking tag if you don’t already have one. This tag must fire on all pages.
  2. Create a Timer Trigger:
    1. Navigate to ‘Triggers’ on the left-hand navigation and create a new Trigger with the following settings:
      • Type: Timer
      • Enable When: URL matches RegEx .*
      • Event Name: gtm.timer
      • Interval: 1500000
      • Limit: 5
    2. Save the Trigger as “GA – Trigger – Session Timer”
  3. Create a session timer tag:
    1. Navigate to ‘Tags’ on the left-hand navigation and create a new tag with the following settings:
      • Tag: Universal Analytics
      • Enter Tracking ID
      • Track Type: Timing
      • Apply the trigger “GA – Trigger – Session Timer” to the tag
    2. Save the tag as “GA – Timer Tag – Session Timer”
  4. Publish.

Form submits

This technique will cause a tag to fire every time a form is submitted. For this example, we want to record all submissions of a form with the Element ID My_Form:

  1. Add a basic page tracking tag (e.g. Tag Type of Google Analytics or Universal Analytics; Track Type of Page View) if you don’t already have one. This tag must fire on all pages.
  2. Enable Tag Manager to capture form IDs. Navigate to ‘Variables’ on the left-hand navigation and check the ‘Form ID’ built-in variable.
  3. Create a form submit trigger:
    1. Navigate to ‘Triggers’ on the left-hand navigation
    2. Create a new Trigger with the following values:
      • Type: Form Submission
      • Wait for Tags: unchecked
      • Check Validation: unchecked
      • Fire On: Some Forms
      • Form ID contains My_Form

      NOTE: The Form ID built-in variable must be enabled before it will show up as a Fire On option.

    3. Save the trigger as “GA – Trigger – My Form Submits”
  4. Navigate to ‘Tags’ on the left-hand navigation
    1. Create a new Tag
      • Product: Google Analytics
      • Tag Type: Universal Analytics
      • Enter Tracking ID
      • Category: Forms
      • Action: Submit
      • Label: Lead Gen – {{Form ID}}
      • Apply the “GA – Trigger – My Form Submits” trigger to the tag
    2. Save the tag as “GA – Form Submit Tag – My Forms”
  5. Publish.

Toby Creative – Branding & Marketing in Perth, WA is a Google Partner Agency and Local Perth SEO Company. We provide Google Tag Manager, Google Analytics, Google Adwords and Google My Business support to local Perth businesses. Contact us on (08) 9386 3444 or fill in our contact form to book a no obligation free initial consultation at your location so that we can discuss your specific marketing requirements.

1 Comment
  • Matt Lynch - November 3, 2017 at 6:26 am

    Google Tag Manager eliminates the hassle of hard coding tags, so that businesses and marketing teams can move faster. It makes advanced tracking requirements a breeze and can actually boost the website speed by reducing tracking code. It is a sensible centralisation strategy for businesses to manage their website analytics.

Leave A Comment

Thanks for visiting Toby Creative the Perth Marketing Agency

Call (08) 9386 3444 to book your no-obligation, free marketing consultation today!

We make it convenient and come to your location – so we can discuss your marketing requirements and get to know your business. We take the time to listen, researching you and your competitors to find out where your business is currently positioned. Then we provide effective and affordable marketing solutions to build your brand, drive targeted traffic, increase sales and improve conversions. Why not find out more by enquiring today.