WordPress is the most popular content management system (CMS) out there. Powering almost 40% of the internet websites, according to W3Techs.
In my last article we have discovered how to create a Google Tag Manager account and container. Now that you have this covered I will show you 3 different ways through which you can implement the GTM code in your WordPress website.
Just as a refresher, GTM is one of the best tag management platforms out there. It can allow you to simply implement snippets of code (remarketing codes, conversion codes) to your website without the need of programming know-how.
Disclaimer: Although WordPress is the most popular CMS not all WP implementations are born equal, different combinations of WP versions, themes, plug-ins, custom code can influence the way you will need to implement the code in your website.
With that out of the way let’s see…
Below I will show you three methods on how to achieve this. Two methods are based on plugins and one where you implement the code directly in your WordPress files. I do strongly recommend sticking to the plugins if you don’t want to bother with any code changes.
The most straightforward way of implementing the GTM code that I’ve found is using the Google Site Kit, a WordPress plugin developed by Google themselves.
I chose this this way to implement the GTM code on my website because of 3 main reasons:
The process of setup has two parts. The first one is the set up of the Google Site Kit plugin, which we will cover right below and the second is the linking of the Google Tag Manager service through the Site Kit.
Even if it sounds complicated it is as simple as it can get, because you basically just have to go through some simple steps.
Setting up the Google Site Kit plugin
Linking Google Tag Manager trough Site Kit
In order to see all the connected Google services navigate again to the Site Kit -> Settings. You can also see details here related to the connected accounts (i.e. Container ID for GTM).
For the second options I’ve wanted to show you a different way of implementing the code. This is the most obvious path for a tech person, but it might not be the right way for you if you don’t possess the required technical know-how.
Disclaimer: This implementation method tempers with the theme files. Any unwanted changes here can cause your website to malfunction so be mindful of this when making any changes in those files. I do not take responsibility for any changes that might affect your website in any negative way.
This is a great alternative to the Google Site Kit plugin, actually this one was the only option available before the Site Kit was available. I would recommend going this way if for some reason Site Kit does not work for your website.
You can read more about this plugin and download it by accessing it’s official website.
I won’t delve much in the implementation of this particular plugin because there are already great sources of information out there.
The implementation process is pretty straightforward, you will have to:
There are multiple ways to check if the GTM is active on your website. The one I strongly recommend is using Google Tag Assistant. It’s a free Chrome extension that allows you to see all the tags on a particular page.
To use the extension simply install it (you can use the link above to go to the extension page) and click on it’s icon from the extensions bar in Chrome to activate it. Now you will be able to see all the tags from the particular page you are viewing.