In this guide, you will learn how to install Google Tag Manager on WordPress. In addition, we will go through the basics of Google Tag Manager, and why to use it.
🛡️ You are reading “Google Tag Manager for WordPress: A Game of Growth (Chapter 6)” – a series of articles on growth marketing. To read the first chapter of this series, go here 👉 Fundamentals of Growth Marketing: A Game of Growth (Chapter 1)
What is Google Tag Manager?
Google Tag Manager is a free online tag management system by Google to install and manage various tags on your website or mobile app. Tags are snippets (or a segment) of code which are added to a website or a mobile app to collect data and send it to third parties.
Google Tag Manager allows you to contain all these tags in one place and manage them in a much quicker way from one place. With GTM, you no longer have to worry about installing and setting up each segment of code directly on your website.
Once the code for Tag Manager has been added to your website (or mobile app), you can safely and easily deploy analytics and measurement tag configurations from the web app. There are a ton of popular 3rd party tags (or code snippets) that GTM supports using native templates. Some of them are Hotjar, Criteo, Crazy Egg, Google Analytics, Bing ads, etc. Here is the full list.
For tags that aren’t natively supported by GTM, you can create custom HTML tags. If you use GTM extensively, you will use custom HTML tags quite often.
Do you need GTM?
If you run your website on WordPress, you need Google Tag Manager. If you are not a developer who can handle code snippets without worrying about breaking your site, then you absolutely need Google Tag Manager.
An easy way to understand this is, we use Google Tag Manager to collect the data, Google Analytics to store and analyze the data and Google Data Studio to report the data.
Are you a developer who can write code all day long?Yes, absolutely. You still need GTM. Why?
The more code you add to your site, the heavier your site will become. And when a page loads, all codes will fire at once, making your site slower to load. That’s why it’s always recommended to manage your tags using GTM, but we’ll see more about it in the Pros/Cons section.
Pros and Cons of Google Tag Manager
Pros of Google Tag Manager
- No coding skills required
- This is one of the top reasons to install Google Tag Manager. Most digital marketers work with tools for site analytics and tracking, but they don’t want to add/remove snippets of code every time they want to use a tool.
- Using GTM, you can simply add or delete tags on a particular page(s) of your site or if you want, on all pages.
- Asynchronous tag firing (for faster site speed)
- GTM allows tags to be fired only when they are needed to avoid slowing down the page upload if all tags are fired at once. You can set up the order of firing the tags.
- Your site loads much faster due to this. If you add all those tags in your site, it’s going to take much longer for the page to load when it has to process all those tracking codes first.
- Easy tag management
- With GTM, you can see all the tags in one place and manage them easily. If you’re running Facebook ads, you’d need to install Facebook Pixel to pass on data to Facebook. If you’re using other tracking tools like Hotjar or Capturly, you’d need to add their tags on your site too. GTM can manage all of your tags from one place.
- Can be used for mobile sites and mobile apps
- With GTM, you can track not just website, but also mobile apps and mobile site (AMP sites). It’s easier for businesses who have mobile apps and websites to track their tags from one place.
- Advanced Tracking
- This is the feature which I absolutely love the most, and the reason why I use GTM the most. You can track almost anything that’s on your webpage with GTM.
- For most businesses, it’s enough to track page views in order to understand what their visitors are doing on their site.
- If you are a savvy marketer, you love to track button clicks to understand which CTAs perform better or which buttons are driving the most clicks to a landing page.
- However, you want to take your tracking game up a level, you can use GTM to track things like pdf downloads, video percentage views, etc.
Cons of Google Tag Manager
- Slightly technical to set up
- If you’re just starting out and have no experience with coding, it’s a bit technical to set up GTM code on all the pages of your website that you want to track.
- Luckily, if your website is on WordPress, you can use plugins to quickly install GTM. (But if you don’t like adding too many plugins, you have no choice but to add the code in your website manually.)
- Needs discipline to manage tags
- Just because you can track anything and everything using GTM, it doesn’t mean that you should load it up with hundreds of tags firing on every page.
- Tracking should help you make decisions to optimize your site for your visitors’ experience. And that’s why you need a plan for what tags to implement and what to track.
Basic Glossary before you set up Google Tag Manager on WordPress
Before you start installing Google Tag Manager to your WordPress site or any site, let’s look at a few basic terms that will help you get started quickly.
A container contains a set of rules, tags, and macros or properties. When you set up GTM, it will create a container for keeping all your tags in one place. There are 4 types of containers available: web, iOS app, Android app, or AMP. Each container has one container snippet, and a container ID, which is unique to each website.
A container version is a snapshot of a container’s configuration at a particular point in time. Each time you make a new change like adding a new tag, will create a new version. You can see the history in Versions tab.
A workspace is your dashboard where you can create multiple and differing sets of changes to your container. Different users can work on these changes in separate workspaces so that they can work independently and test tag configurations. Most likely, if you are just setting up GTM, you won’t need to worry about creating multiple workspaces.
Hopefully, you didn’t skip this article’s introduction but if you joined the party late, here’s what you need to know. Tags are snippets of code which you can add to your site and manage with GTM in an easy way. You can view all tags within your workspace under Tags tab (on the left):
You can see that we have a unique naming convention, which you should also copy, if you want to have an organized way to manage your tags. Especially, if you have multiple teams or users creating and editing tags regularly. It is much easier to also keep accountability.
How to name tags in GTM?
The first 2 letters are my initials – VK, which lets my team know that it was me who created this tag. You may use another convention, but this helps us quickly sort tags with people who created them. You may use your agency’s initials next to person’s initials, and that works too.
Next, we have a label for what is it that this tag contains. You can see that we have installed tags for Linkedin Insight Tag and Google Analytics that are natively supported. (also mentioned in the tag type.) However, most of the tags are not natively supported by GTM, adding tool name quickly tells us what we have installed. In this screenshot, you can see that we have added Albacross, Capturly, and Facebook Pixel tags using custom HTML type.
The last part of the naming convention is to know which pages contain the tag. In this case, we have fired these tags on all pages, but you may have some tags firing on a few pages. Use a clear naming structure to avoid any confusions later on.
Ok, back to the topic…
A trigger is simply an event that will fire the tag. When you’re creating tags, you want to track several events on your website – be it button click, link click (click events) or form submission. Below is an example of trigger that I’m creating. Can you tell what this trigger is, on which pages and when will this tag load?
While this post is not a tutorial on how to create triggers, I wanted to quickly show you what a trigger is. So in this case, I created a trigger (Noted the initials VK?) that is fired when a user submits a form (Lead Form, to be specific). I set the tag load time to 5000 milliseconds because I don’t want it to slow the homepage loading. I’m sure no visitor will submit the form before 5 seconds of loading the homepage, so it can wait.
Variable is a helper function that stores a value that can be invoked or called by tags, triggers or other variables. A variable is used when you have to call a value multiple times. Tags use variables to collect information when a visitor takes an action that can be passed to another data layer.
Take a look at this Constant variable i.e. which is used to store the value of web property ID i.e. (UA-XXXXXX-X) instead of always typing the tracking code for your web property (UA-XXXXXX-X) into each GA tag.
There are two types of variable: built-in and user-defined variables. Built-in variables are the most common types of variables that google built themselves such as Page URL, Page Path, Click Element, Event, etc. Read more about variables here. User-defined variables are the variables that are not covered under built-in variables and are user-specific. These can be HTTP Referrer, URL, Custom events, etc.
Here is a quick diagram to explain the structure in Google Tag Manager.
Simply put, data layer is a virtual layer of your website that contains various data points (hence, data layer!) such as transaction value, product price, page category, etc. Understanding and leveraging the data layer is the key to unlocking GTM’s potential. And if you want to start with GTM, I highly recommend reading more about data layers.
How to set up Google Tag Manager for WordPress?
Step 1 : Visit https://tagmanager.google.com and log in with your Google account credentials
Step 2: Click on “Create Account” link
Step 3: Enter your account name by using your company name,
Next, choose the container type to your account and give it a name. Based on where you want to install the GTM code, you will choose the container – Web, iOS, Android or AMP. We already discussed what those mean.
Once you agree to the GTM Terms of Service, you account will be created. Google Tag Manager will show you the dashboard with a pop up containing the codes you will have to add to your website.
If you’re not familiar with your site’s backend, you should contact your developer to add the code. Simply send them this the instructions and they’ll know how to do it. Or send them this Quick Start Guide by GTM.
There are 2 sets of codes (snippets) that you will have to add to your website.
As per the instructions, the first snippet has to be added as high in the <head> of the page as possible. And the second code has to be added immediately after the opening of <body> tag. Once you add that in the right place in your website, you are good to go – GTM is installed correctly.
But what to do if you don’t have a developer?
In that case, most likely you are running a WordPress website which you installed yourself or got help from someone to do it for you.
How to install Google Tag Manager on WordPress?
If you’re using WordPress, and don’t want to mess with your code, I’d recommend using a plugin to install GTM. I recommend a plugin called Google Tag Manager for WordPress by Thomas Geiger. Here is the link or just look it up in your WordPress plugin search and download the plugin. Once you activate it, it will ask you to add your Google Tag Manager ID. You can find the GTM ID in your account or in the code snippets.
If you are using a CDN like Cloudflare, I highly recommend installing GTM from the apps in Cloudflare account. This will significantly improve the performance of your site since you’re no longer using your original server to serve the plugin.
How to verify that Google Tag Manager is installed on WordPress properly?
There are 2 methods to know if Google Tag Manager is installed properly on your WordPress site. First is to install a browser extension called Tag Assistant by Google. Here’s the Tag Assistant’s Chrome extension. Once you install it, go to your website and refresh the page you want to check.
However, Tag Assistant will not show the 3rd party tags that are fired.
The second method is to go back to your GTM dashboard, and click on the Preview button (top-right). It will activate the Preview mode. (in orange block)
Now, head over to your WordPress website where you installed the Google Tag Manager, and do a hard refresh (Cmd + Shift + R on mac).
Once you do that, a split-screen will pop up under your website. Here you can see all the tags that are fired on a particular page.
In the image above, you can see that there are 5 tags that are fired on this page. If you’re curious, you can visit any page on your website and you will find this split-screen by Tag Manager indicating the tags fired on that page.
To switch off the preview mode, just go back to Google Tag Manager and click “Leave Preview Mode”.
How to add a new user (For giving access to agencies)
Step 1: Go to “Admin” tab
Step 2: Under Account, click on the third tab – “User Management”.
This will open the account permissions window.
Step 3: Click on the blue “+” icon on the top right, then “Add user”.
Step 4: Add the email address who you want to invite. Whether you want to invite an internal team member or an external user like your agency, this is where you will add their email address.
Step 5: Set Account Permissions (Important)
Before you invite any user, be it internal or external, set the permissions for them. There are 2 types of users and 4 types of container permissions. Choose them wisely.
User type: There are You can either choose “Administrator” or “User”. By default, administrator has read right, but a user has no right and can only view basic account information.
Container Permissions: Choose whether the user can only
- Read: The user can view tags, triggers and variables, but can’t take any action.
- Edit: The user can create workspaces, edit tags, triggers and variables, but can’t modify any user permissions or create container versions or publish them.)
- Approve: The user can create container versions, workspaces, and make edits but can’t publish them.
- Publish: The user can create, edit and publish container versions, and workspace.
For more details on user permissions, I encourage you to read this section from Google Help Center.
What GTM permissions to give to your agency?
Depending upon the tasks your agency is going to do, you may have to give them permissions from read-only to full Publish rights.
At For The Love Of Growth, we ask for read-only permissions only when we are just auditing clients’ tags. But depending on the client’s level of technical capability, we may ask for higher permissions.
When we are setting up full tracking, we ask for Publish permissions so that the client doesn’t have to publish them individually. Once the project is over, we remind clients to remove the permissions.
If the client already has already set up Google Tag Manager on WordPress or any other CMS and wants us to only work with a container, we require Edit permissions to create workspaces or edit tags, triggers and variables.
Step 6: Click on invitation button (top-right) to invite the user
Step 7: The last step is to accept the invitation by the new user, who will receive an email notification and a notification in the Tag Manager. Accept the invitation, and you’re good to go.
There you go!
I recommend that you install Google Tag Manager on your WordPress site and start playing with the tool to see what events, buttons, clicks you wanna track in your website.
If you’re not managing the data, then share this post with your marketing team. Or get your agency to do it for you if you don’t want to do it yourself. But there’s no excuse to not using Google Tag Manager to collect data.
Deep Dive into Google Tag Manager (WordPress)
Check out CXL Institute’s Google Tag Manager for Beginners course to learn more about GTM. It’s a 7-hour course to take you from beginner to intermediate level.
You will learn from the basics of tag management to tracking scrolls, video views, button clicks, tag sequencing, and cross-domain tracking. All these things are possible because of GTM and you will be able to master them after this course.
If you work for an eCommerce company, there is a separate lesson focused on tracking eCommerce data using transaction tag which collects data like SKU detail, price, quantity, etc.
If you have any questions, let me know in the comments section or write to me on Linkedin.
🛡️ You just finished reading “Google Tag Manager for WordPress: A Game of Growth (Chapter 6)” – a series of articles on growth marketing.