If you use Google Analytics (GA) then it’s probably time to start taking advantage of the many benefits Google Tag Manager (GTM) has to offer.
GTM is Google’s free-to-use tag management system that, conveniently, also integrates the company’s other digital tools, such as AdWords, DoubleClick and Trusted Stores. We’ve been eulogising, both internally and to clients, about the benefits of having a tag management system (and in particular GTM) for ages now, so I wanted to share an introductory guide for those of you who aren’t familiar with the system.
So what is a Tag Management System? Simply put, tags are snippets of code that sit within either the <head> or <body> elements of a web page which enable tracking, analysis and reporting.
Tag management software is a way for marketers and developers to apply these snippets of code to their website via a user-friendly interface, meaning you don’t have to ask your web developer to do it for you.
Tag management systems enable several tags, including for third-party properties such as AdRoll, to be inserted into one all-encompassing container. Where previously you had several code snippets, these are replaced by the tag management code.
GTM enables webmasters to give specific permissions to certain users so that they can access different sections of the system. For marketers, it allows them to decide when tags should be ‘fired’, dependent on certain conditions (triggers) defined by the user.
For example, if you’re using Google Analytics you would usually wish to fire the tag on all pages across your website because you’ll want to be able to analyse traffic data for all of your pages. You may also wish to set up event tracking within Analytics, such as external link clicks or form submissions. You can tailor your events to only record when the appropriate triggers are met.
If you’re not a web developer, the idea of delving into your website’s HTML and playing with the code might seem like a very daunting prospect indeed.
Tag management allows you to implement tracking and analysis code snippets easily onto your website, without having to worry about possessing coding skills or bothering your IT guy. All you need to do is add the tag into your management dashboard and it will appear on the pages you designate.
By using this process you can improve the efficiency of your organisation and rely a lot less on your developer, instead making website changes yourself (there is a small caveat to this, but more on that later).
Additionally, event tracking within Google Analytics was only previously possible with the help of a webmaster or developer, but with the help of GTM marketers can take control over this process.
GTM’s structure has accounts at the highest level, and containers within those accounts. You then set up tags, triggers (formerly known as rules) and variables (formerly known as macros) within each of those containers. GTM’s hierarchical structure is shown below:
Accounts can include a company or organisation, with lots of websites (such as a restaurant chain with different websites for each restaurant), or a small local company (like a local store) with only one site. Containers hold all the tags relating to one website or mobile application. For the purposes of this guide, we’ll focus on one website installation, but you can see an example GTM account structure below:
Over the years GTM has become an increasingly important part of our marketing efforts here at Klood Digital. As a result, I’ve written a few articles on the subject, as well as an article for Advanced Web Ranking on how to track a user’s scroll depth on your website.
In two of those articles I’ve explained how, instead of inserting your Google Analytics property ID every time, you can use a variable that will populate it instead. That way you only have to put your property ID in once and GTM will insert it on your behalf. Using this method, you can also dynamically change the ID based on certain inputs, such as your website’s hostname (more commonly referred to as the domain name).
Firstly, head over to Google Tag Manager and sign in at the top right hand corner.
If it’s the first time you’re signing up with your email address, follow the instructions and enter your account name (usually the name of your organisation):
You then enter your domain name into the ‘Container name’ field and choose where to use your container - on the desktop version of the website, on iOS and/or Android:
Click ‘Create’ and you’ll be presented with a screen asking you to add the container code onto every page of your website, as well as the code itself:
This code can be added in using your content management system (CMS) by editing one of the template files. Make sure the GTM code snippet is inserted immediately after the opening <body> tag, and that any old instances of Google Analytics codes are removed to avoid double counting users.
This stage should be the only time when you might require the help of a developer or webmaster. This might not always be the case, as you may need assistance tackling ID or class issues relating to event tracking.
Now that you’ve added the container tag to your web pages, it’s time to create your first tag, and this will typically be the Google Analytics snippet. From the GTM dashboard, click on ‘Add a new tag’:
You then have to select which property you wish to create a tag for. For this example we want to select Google Analytics:
After choosing Google Analytics you will need to name your tag - something simple like ‘Google Analytics’ will suffice - however naming conventions are quite important should you start to implement more complex installations later down the line. You can refer to Google’s help documentation to help you determine your own architecture. You should then choose a tag type:
‘Universal Analytics’ (UA) is chosen by default, but depending on the version of GA you use, you may need to select ‘Classic Google Analytics’. However, you should probably see this as an opportunity to upgrade to UA to take advantage of the benefits of doing so.
You will then need to enter your GA tracking ID, which can be found by going to your Analytics dashboard.
Copy and paste the tracking ID into the field below:
You can also set up your own variable within GTM that dynamically pulls in the GA property ID into your container, to save you the hassle of copying and pasting the code each time.
You shouldn’t need to access any of the advanced features at this time, but you will have to set a firing trigger.
Firing triggers detail when the tag will become live and in this case, you should set the tag to fire on all pages because you want GA to be tracking on every page on your site:
By clicking on ‘Create Tag’ you will save it, but it won’t be live yet.
It’s very important to preview your tags before setting them live to see if they are firing when they’re supposed to.
When preview mode is enabled, you should see the below in your GTM dashboard:
In order to use preview mode, visit the URL of your website, and you should see a pane at the bottom of your browser window:
Once you know that all your tags are firing, all you need to do is click publish. To double check that it’s working first, head over to the Real-Time report in GA to check that your visits are being recorded. Unless you have your IP filtered out of the view you are reviewing, you should see live statistics of what page you’re looking at. If you make any changes in GTM, you will need to refresh preview mode in order to see them on the site, so please bear that in mind.
Once you’re satisfied your Google Analytics tag is firing correctly, click the Publish button on your GTM console.
Fortunately, GTM includes version control to ensure you can’t accidently overwrite your tags, allowing you to return to a previous version if you do make any errors.
Universal Analytics has been out of beta for a couple of years now, so if you haven't upgraded to Google's most recent iteration of Google Analytics, you should consider using GTM to complete the implementation - and the above guide can assist with this. It’s worth noting that GTM has a new user interface (UI), but first, let’s cover off what tags are.
Tags also enable you to measure the impact of advertising on your site, use remarketing and retargeting, and much more. But why should you use a tag management system?
Tagging can get pretty complex. Larger websites in particular can have lots of tags or code snippets that need to be added, require updating regularly or have complex installations, but it’s not just the complexity involved, and there are several other reasons why you should use a tool to manage all your tags - and in particular GTM.
Tag management systems are not a new invention - they've been around for a few years now - but most of them charge a fee for the use of the product. Google's is free, which makes it very appealing. It's very similar to Microsoft's tactics during the ‘Browser Wars’ of the mid-90s. Give something away for free and leave the competition redundant.
Seasoned computer users will know how well that turned out for Microsoft, but Google won't make that mistake. If there's one thing they won't do, it's get lazy with their product. I believe they are acutely aware that marketers and business owners need a way of easily managing and updating their tags/code snippets without touching the code.
The iteration released by Google nearly two years ago is testament to that, refining the terminology so that ‘technophobes’ can understand the semantics. But the fact that it’s free and future proof isn't the only reason why GTM is the best thing since sliced bread (slight exaggeration).
Within reason, GTM enables you to insert a piece of code once, without ever having to bother your web developer. This is perfect for teams with an external web developer because you are not repeatedly asking that developer to make changes. For in-house teams it also means your developer can focus on improving the website, as opposed to making changes to benefit your data, thus streamlining the process.
It also means that if you need to update any of your tags (remember what I said earlier about upgrading from Classic Analytics to Universal Analytics), you can do this yourself by updating the tag in the GTM dashboard.
Google is well aware that the majority of websites use a similar selection of tags. This isn't just limited to Google Analytics or AdWords Conversion Pixels - it also includes other tags used for remarketing purposes such as:
This is perfect for marketers who aren't familiar with code. The GTM snippet is inserted once on all pages, and all tags are inserted into pages that the rules (now known as ‘triggers’) associate with the designated tag. What’s more, Google announced support for a wide range of new tags, including HotJar and Bing Ads.
GTM also contains an option to test your tags before you publish them.
Data accuracy is becoming increasingly important (and increasingly difficult given the web spam issue), so being able to try out your implementation to ensure your tags are firing correctly is hugely important. This ensures it never affects your live data.
It’s best to review Google’s help docs on this subject, but it’s pretty easy to get to grips with.
Whilst the debug mode is great, sometimes errors do occur that may be beyond your control (think of that pesky web developer who changes the code without consulting the marketer/analytics expert). GTM is prepared for such occurrences and utilises version control, enabling you to rollback to previous versions and keep everything really organised. It can also help you implement similar installations on new GTM containers as it lists all the tags that you have implemented in that particular version.
A (relatively) new feature in GTM is environments.
Environments enable you to control your tag manager installation across live/production websites or apps, and their development/staging counterparts.
Similar to both debugging and version control, this tag manager feature enables you to publish your tags to different environments, for example a testing server, so you don’t affect or change your live version when publishing. You can then share preview modes with others to further test your installation - incredibly useful for those more complex installations.
In a similar vein to Google Analytics, the application allows you to have control over who can access your setup and how much they are allowed to do within GTM. These permissions start at the ‘view only’ level, and then you can enable ‘Edit’, ‘Delete’ or ‘Publish’ permissions on a per container basis.
Within accounts (comparable to an account in Google Analytics) you can then set either ‘View only’ access, or ‘View, edit and manage’ access.
How can a tag management system improve user experience? Well, it can do this both directly and indirectly. Its direct impact is improving site speed.
Say you have several tags on your website. This results in more code to load, and potentially a slower page load time. You could even have tags on your site that are old and no longer in use.
Tag management systems only load the tag container snippet, and all the tags are housed within the snippet. You can then manage your tags all from one location (the dashboard) and speed up your site.
There are caveats to this - too many tag snippets can cause load time issues, for example - but generally, GTM should improve site speed performance.
The indirect effect on user experience comes from further implementation, which I’ll explain below.
The term ‘auto’ is, in truth, a bit of a stretch. There is still some setup required, but it is relatively straightforward to do. I won’t cover that tutorial here, but the basic events that you can track are based on:
You can also create custom events that record things such as scroll depth.
Why is this important? Well, fundamentally it enables you to gain insight into what actions users undertake on your website. Are they clicking on certain links? Are they engaging with the content? Are they completing form submissions? You can then use these events to create goals specific to your business in Google Analytics.
I (still) think Tag Manager could well be one of Google’s next big pushes. With recent developments around the launch of their range of free analytics-related products, such as Google Optimise, the installation of these tags will become even more important. After some of their experiments that have not performed so well (the death of Google Authorship in search results springs to mind), I believe GTM to be a winner.
People need analytics. People need data. People need tools that can save them time or streamline the little resource that they have. That’s why GTM works so well. It’s not the perfect tool just yet, but they will keep improving things.
One of the main selling points of tag management systems is the ability to allow those less (or unfamiliar) with coding to deploy code snippets on websites or mobile apps. Most of the time, these tags are third-party tools that allow reporting, analysis and tracking. The problem is that marketers often have to get in touch with their web development or IT team to install these code snippets. With tag management, this can (usually!) all be done by someone who has little experience with HTML.
GTM has a number of different components that we need to get our head around before diving in. These are tags, triggers, variables and the data layer. I’ve given some definitions of these below:
Now we have a good understanding of the main components of GTM, I’ll talk about the problem that many marketing, analytics and web professionals face.
Data accuracy is a real pain in the back side. In theory, it should be pretty simple, but with so many people potentially influencing websites it’s easy for you data to become muddled.
From blocking spam, through to payment gateway referrals and AdWords data discrepancies, there’s lots of opportunities to get your data mixed up. The issue that this implementation solves is that of your development or staging URLs sessions becoming mixed in with your live website’s data.
During the development process of a website you should look to start implementing your GA implementation on the staging version of your website. This enables you to instruct different GA IDs to load depending on whether it’s the live or staging version of your website.
Before you begin, it’s important to ensure you’ve created a separate GA property ID for all the staging or development environments. If you’ve not done this then you’ll have to come back to GA in order to action this later on in the tutorial.
This solution creates a variable using a lookup table. Similar to the LOOKUP function in Microsoft Excel, we specify what we want Tag Manager to find, and it then delivers an output depending on what it can locate. In order to action this, head over to the ‘Variables’ section within GTM:
Ensure ‘Page Hostname’ is checked:
Click ‘New’ towards the bottom of the page:
Choose ‘Lookup Table’ from the options:
Choose ‘’ from the ‘Input Variable’ options:
Click ‘+ Add Row’:
You can then add your hostnames into the appropriate input row and your GA property IDs into the applicable output row:
After that’s complete, ensure you give the variable an appropriate name such as ‘Dynamic GA Property ID’. You can then click ‘Create Variable’ to save your progress.
You can then go back over your previous tags, and replace the static property ID you previously used, with the dynamic one you have just generated:
Make sure you delete the old characters that were in the text entry box, otherwise you’ll find more information than you require populating the field - causing likely bugs with your installation.
That’s all there is to it! Of course you should do your due diligence and use preview mode to test things are working as you expected them to, but there should be no further implementation required.
There is another way that you can ensure data accuracy by using ‘Environments’, whereby you publish your version of Tag Manager to different containers, but we’ll save that for another tutorial.
If you’ve been using the LinkedIn advertising platform you will have been able to see how many impressions those ads have had, the number of clicks, how much you’ve spent per click as well as a number of other important metrics for identifying how well those ads are Performing.
That’s all well and good, but what LinkedIn’s Campaign Planner doesn’t tell you is whether or not those clicks are converting once they arrive at your website.
This is where conversion tracking comes in.
First of all, open up LinkedIn Campaign Manager and navigate to ‘Conversion Tracking’ in the top right-hand corner.
If this is the first time you’re accessing LinkedIn’s conversion tracking you will first have to enter the domain you wish to set tracking up for.
You will then be presented with the following screen, asking you to install the insight tag.
However for the purposes of this guide, we'll come back to this and instead click 'Next' to progress to step two, where you create your first conversion.
You now have to define the new conversion you wish to track. This includes:
Once you’ve set up this conversion, let's add that LinkedIn tracking pixel to your website. First, open up your GTM dashboard and select ‘Add a New Tag’.
Give your new tag a name, and then select ‘Tag Configuration’.
Now, select the ‘LinkedIn Insight’ tag type from the list. You can find it using the search function in the top right-hand corner.
When you select the ‘LinkedIn Insight’ tag you’ll need to input the ‘Partner ID’. This is what identifies your LinkedIn account to GTM. To find it, switch back to LinkedIn Campaign Manager and click ‘View insight tag’ in the right-hand corner of the conversion tracking page.
You will then be presented with the insights tag that we saw earlier. Without GTM you would need to copy and paste it onto every page you wished to fire the trigger on. However for our purposes we only need to extract the partner ID:
Copy this ID and paste it into the relevant field.
You now need to set up the trigger for this particular tag.
After you’ve clicked on the ‘Triggering’ box you’ll have the choice between selecting from the list of your previously made triggers and creating a new one. Let’s assume you want to create a new trigger for this tag. First, click on the plus icon in the top right-hand corner and then click on ‘Trigger Configuration’.
Now, choose your trigger type from the list.
For this example, let’s choose ‘Page View’ as our trigger.
You can now choose between the trigger firing on all page views or only some of them. If you choose to only fire the trigger on some page views, you can define the conditions based on these variables:
Finally, save the trigger and then the tag. This will add the new tag onto your website.
To test that the tag has been applied, click ‘Preview’ in the GTM dashboard. This will enable preview mode.
In a new tab, navigate to the website you’ve set the tag up on and at the bottom of the screen there should be a pane that shows which tags are firing.
You should see the name of your new tag in this pane. If it’s not appearing, go back over this article and make sure you’ve set up the tag and trigger correctly.
That should be it. Unfortunately, LinkedIn doesn’t have the ability to filter our conversions by IP address yet so you don’t get internal traffic, so try not to visit your ‘thank you’ URL more than once as a test.
"Klood are passionate about HubSpot and this shows in their support work for the software which is creative and shows great expertise.
They always go the extra mile in trying to solve problems and remained resolutely cheerful and positive through what was a challenging integration with our existing set-up. I'd definitely recommend their services."
Sam Clarke Experience Travel Group
"Klood Digital have given our marketing a new lease of life, transforming our old fashioned methods of driving new traffic and generating new leads with a much more informed and strategic approach.
I highly recommend Klood for those organisations who are looking for a fully integrated HubSpot agency who are inbound specialists and can support with the overall strategy."
Emma Murray Palmer Capital