Historically, whenever SEO or PPC needed some code adding to a website, whether to add a new platform or to start tracking visitor behaviour, they’d need to get the web development team involved. Now, Google Tag Manager allows many website changes to be made easily by SEO and PPC experts.
- What does Google Tag Manager do?
- How do I start using Google Tag Manager?
- How do I add a Tag?
- How do I add a custom Tag?
- How does Google Tag Manager work?
- How do I track link clicks in Google Analytics using GTM?
- Create a link click Trigger
- Create a Google Analytics event tracking Tag
- Trigger the Tag
- Publish the container
- How do I track a contact form submission?
- What else can I track with GTM?
What does Google Tag Manager do?
Google Tag Manager, or GTM for short, allows tags, which are snippets of code, to be added to a website without editing website source code. Common tags include Google Analytics tracking code and structured data. All changes are tracked, version controlled and can be previewed.
How do I start using Google Tag Manager?
To start using Google Tag Manager, sign in to Tag Manager using your Google account, then create an Account and container for your website by entering its web address and agreeing to Google’s terms and conditions. The container will hold all of your tags and control when to use each one.
Once you’ve created the container, add the Google Tag Manager snippet to your website’s source code. This is the only code change you’ll need to make to start using GTM. If your website is running a Content Management System, a plugin can usually add this snippet for you. We recommend this plugin for WordPress, where all you’ll need to supply is your container ID, which will be in the form GTM-XXXXXX.
Once you have a container set up and the container snippet added to your website, you’re ready to start using Tag Manager.
How do I add a Tag?
To add a Tag to your GTM container, select ‘Tags’ and then the ‘NEW’ button. You’ll need to Select a Tag and choose when it will be triggered. There are many predefined tags to choose from. It is likely that the Tag you are trying to add has already been integrated into GTM.
For example, to add Google Analytics page tracking to your container, click ‘Universal Analytics’, set your ‘Track Type’ to ‘Pageview’ and ensure that your Google Analytics settings variable is set up to include your Google Analytics Tracking ID, which will be in the form UA-XXXXX-XX. As you’ll be tracking all page views, set ‘Triggering’ to ‘All Pages’. This will ensure that your Google Analytics tag appears on every page of your site. To add the tag, click Save.
Once you’ve added a tag to your container, click ‘SUBMIT’ in the top right corner of the page. After summarising your container changes, you can click ‘PUBLISH’ to make your container live on your website.
How do I add a custom Tag?
Not all services have tags built into Tag Manager. To remedy this, GTM allows the addition of ‘Custom HTML’ tags. For example, to install a Call Tracks snippet, add a new tab of type ‘Custom HTML’ and paste the Call Tracks snippet into the tag. Similarly, to add structured data, paste your structured data code snippet into a ‘Custom HTML’ Tag. Don’t forget to validate the code snippet, include
<script type="application/ld+json"> at the start and include
</script> at the end of your structured data Tag.
How does Google Tag Manager work?
Google Tag Manager works using 4 concepts: Triggers, Events, Tags and Variables.
Triggers control when particular tags are executed. The most common Trigger is ‘All Pages’. If a Tag is triggered by ‘All Pages’, the tag will executed when any page of your website is loaded. Other triggers might be a click on a particular link, or the submission of a contact form.
Events cause triggers to fire. For example, any ‘Page View’ Event causes the ‘All Pages’ trigger to fire. It is possible to add custom Events.
Tags, once triggered, are snippets of code executed on your website.
Variables are additional properties of Tags and Events, which we’ll need to interact with when adding more advanced functionality in Google Tag Manager.
How do I track link clicks in Google Analytics using GTM?
Allowing marketing professionals to track behaviour without coding is a key selling point of GTM for Impression. To illustrate how GTM can facilitate link tracking in Google Analytics, we’ll walk through tracking clicks of the ‘contact our team’ links in the Impression website footer.
To track clicks of the ‘Contact our team’ links is a simple process: create a Trigger for the link clicks, create a tag that sends an Event to Google Analytics and set the Tag to execute based on the Trigger.
Create a link click Trigger
As illustrated in the screenshot above, the links we’re trying to track have a class called
contact. To allow link targetting by class, click ‘CONFIGURE’ in the Variables section of GTM and tick the ‘Click Classes’ option. To track clicks by other variables, such as ID, link text, or destination URL, ensure the relevant variables are enabled. To create a Trigger based on the
contact link class, click ‘NEW’ in the Triggers section of GTM. The trigger type will need to be a ‘Click’ on ‘Just Links’. After selecting that ‘This trigger fires on Some Link Clicks‘, you can set the ‘Click Classes’ to ‘equals‘ and enter
contact in the text field. It’s a good idea to give your new Trigger a descriptive name, then save it. If you’re struggling to target a particular link with a Trigger, ask your web development team for help.
Create a Google Analytics event tracking Tag
Next, create a new Tag in the Tags section of GTM. Select the type Universal Analytics, and set the ‘Track Type’ to Event. You’ll then be presented with options to enter the event details that will be sent to Google Analytics when the Tag is executed. Ensure you have set the Tag to the correct Google Analytics settings variable – the one containing the correct Google Analytics tracking ID. Most websites will only need one Google Analytics settings variable, and the same one can be used for both page tracking and event tracking.
Trigger the Tag
Set the Trigger for the Google Analytics event tracking Tag to your new Trigger and save the Tag. Your Tag is now complete. Once your container is published, Google Analytics will receive an event each time one of the tracked links is clicked. From these events, you may wish to set up goals or conversion funnels in Google Analytics.
Publish the container
Once you’ve made changes to your container, you can publish your container using the ‘SUBMIT’ button. Upon clicking ‘SUBMIT’, you’ll be asked to create a version of your container before you publish it. This means, should you make a mistake, or need to roll back to a previous version, you can do so easily. Once you click ‘PUBLISH’, your changes will become live on your website. Next to the ‘SUBMIT’ button, GTM offers a preview feature. If you enable preview mode by clicking the ‘Preview’ button, then visit your site, you’ll be able to test unpublished changes to your container. You should always test container changes before publishing them.
How do I track a contact form submission?
Tracking a contact form submission is often trickier than tracking a simple link click. Although GTM offers a custom Trigger type for form submissions, ensuring that the form was validly submitted using this method is a fairly tedious process. To effectively and efficiently track form submissions, we need to use Events. We can create Triggers based on custom Events, then create a tag which tells GTM that an event has happened via the dataLayer. Some forms support this out of the box. Aaron wrote an article detailing how Contact Form 7, a WordPress plugin, supports this. Instead of interacting with code, if your form submits to a thank you page, you could create a ‘Page View’ Trigger that only fires where the ‘Page Path’ equals the path of your thank you page, then a Google Analytics event tag triggered by that Trigger.
What else can I track with GTM?
Moving on from links clicks and form submissions, GTM allows you to track e-commerce activity and any other event imaginable. As Events in GTM can be shared across all Tags, multiple Tags can be triggered by a single Trigger. This becomes even more useful if your business uses multiple monitoring platforms and additional services.