How To Set Up Google Tag Manager on WordPress
Google Tag Manager (GTM) is a free, online tool provided by Google to easily manage tags for marketing purposes on your site. GTM is most commonly used for installing and managing tags from Google AdWords and Google Analytics; more on that in future posts. For now, we are just going to be focusing on how you set up Google Tag Manager on your WordPress site.
The beauty of GTM is that you don’t have to rely on a ‘web guy’ to add pesky bits of code to your website. It provides you with a hassle-free way to manage code used for tracking user activity on your website. So, if you like the sound of keeping the code on your site as clean as possible, we highly recommend using Google Tag Manager.
Anyway, enough of why you should be using it. Here’s your guide on how to set up Google Tag Manager for WordPress.
Account Setup
The first thing you need to do is go to the Tag Manager site. With any luck, this is what you will see;
This page is pretty self-explanatory. You will need to choose an account name, which would most likely be the name of your business. In addition to the name, you will also need to select the country in which you are based. And as you can see, you can choose whether or not you would be happy for your data to be shared anonymously; that’s your call.
The second step involves setting up a ‘Container’. Your container will be where all of your tags are stored. So, rather than having lots of separate bits of code hanging around on your site, they will all be contained within… well, a container! You will need to give your container a name. Obviously it is completely up to you what you call the container, but most stick with the URL of their website. Finally, you just need to choose where you will be using your container. This is how it looks;
Obviously, as you are looking to set up Google Tag Manager on WordPress, you will need to select ‘Web’. Then just accept the Terms of Service, and that’s the first step done.
Oh, and for those of you who thought the fourth option was something that you plugged a guitar into… you would be right. However, in the context of digital marketing, AMP refers to Accelerated Mobile Pages.
Set Up Google Tag Manager
Now that your account is set up, you will need to install GTM onto your WordPress site. This is the only time where you will need to pop a bit of code on your website. But, before you look at the image below and think, “Erm… I’ll pass!” bear with us! You don’t need to worry about this,I promise that you don’t have to be some kind of software engineer to work this out.
So, here’s what you should see now;
Both of the above snippets of codes will need adding to the ‘header.php’ file on WordPress.
To do this, you are going to need to open up a new tab and login to your WordPress account. When the dashboard loads up, you should see ‘Appearance’ on the left-hand side of your screen; click on that and then ‘Editor’.
Once you have opened the Editor, you should see the header.php on the right hand side. It will look something like this;
Where Do I Paste My Code?
For the first snippet of code, you’re advised to copy and paste it as close to the <head> tag as possible. This is what this area you will be pasting into should look something like;
If yours looks identical to the screenshot above, then you would paste the code into line 5, just below the <head> tag.
As for the second snippet of code, it advises you to copy and paste it as close to the <body> tag on the page. With any luck, you should be able to find the opening body tag (<body>) just after the closing head tag (</head>), a bit like this;
Once you have pasted the code just below the opening body tag, that’s you all set up on the code front. Now, all that’s left to do is publish your container on GTM. So, head back over to your GTM account and make sure you are on the ‘Workspace’ tab. If you are, then the top-right-hand corner of your screen should look like this;
Obviously you will just have a different unique Container ID. All that is left for you to do is click ‘Submit’; name your first version and hit publish! Your version name just needs to be something simple and self-explanatory, like ‘Initial Setup’.
Job done! You are now ready to begin adding tags like: Google Analytics, Google AdWords Remarketing and Conversion Tracking to your Container.