Need to set up Google Tag Manager in WordPress? Not sure if you need Google Tag Manager on your website? Don’t worry. In this article, we explain how to install and configure Google Tag Manager correctly in WordPress as well as its main benefits.
What is Google Tag Manager?
Often, website owners need to add multiple scripts or snippets of code to track conversions, analyse traffic and gather other digital analytics data.
The great thing about Google Tag Manager is that you can easily add and manage all of these scripts from a single dashboard.
In addition, you can also use custom HTML to add more custom tracking or any other code you want to add and be able to track.
This saves you the time of adding and removing tags from your website code and gives you the ability to manage it all from a single dashboard. All the scripts integrated from Tag Manager are loaded as a single script which saves a lot of resources and improves the loading speed of your website.
It is very convenient to use tag manager to add tags in WordPress as you only need to install the code once and the next time you want to make a change or add a new one you can do it directly from Google Tag Manager.
Here we go!
How to install Google Tag Manager on WordPress
It is important to note that this guide is intended for self-managed WordPress.org sites.
The first thing you need to do is visit the Google Tag Manager website and sign up using the same Google account you use with Google Analytics.
After logging in, you will arrive at the home page, where we have an overview of all the accounts we have active.
Click on “Add new account”, then simply type in the name of your account and press the Continue button.
Next you will need to add a container to the account. A container can be a website or an app. In this case we are going to look at the web option.
You can use the domain of your website for the name of the container, once you are done, click on the “Create” button.
Once the account and container are created we get the Google Tag Manager code that we must include in WordPress.
Adding the code in WordPress
Manual installation
Tag manager notes that the code must be installed after the opening tag <body> and this tag is usually found in the header.php of our wordpress.
Go to your wordpress desktop in the menu, look for the appearance option and then go to the editor to find it. You can also find it through the FTP of your server.
On the right side of the screen you will see the theme files and you will have to select the one named “header.php”. It is important to remember that in order not to lose the tracking code you must work with a Child theme because if you put it directly in your theme, when there is an update you will lose that code.
Look for the opening of the <body> tag, paste the code and click on the update files button to save the changes.
Important. Remember that whenever you make modifications to the internal WordPress files it is highly recommended to make a copy of the files in case something breaks.
Installation with plugins
For those who don’t feel so comfortable touching the wordpress code, in the wordpress plugin directory you will find several options:
1- Insert Headers and Footers:
With this plugin we can add any type of script in the header or footer of WordPress. So if we choose this option we only have to paste the tag manager tracking code in the head part.
2- Google Tag Manager for WordPress (our favourite option):
This is an exclusive plugin for tag manager integration with wordpress and offers a large number of functions. It is the easiest integration of all.
To install Google Tag Manager on your WordPress you only need to download the plugin from the repository, go to the settings and select the option “Injection without code” once selected you must enter your Google Tag Manager ID in the corresponding field and save the changes.
It’s as simple as that!
Verify that Tag Manager is properly installed
How can we know if Google Tag Manager is properly installed? For this we are going to use the Tag Assistant extension for Google Chrome. By simply installing this add-on in your browser you will be able to see which scripts are active on any website you visit.
Once installed, go to your website, click on the Tag Assistant icon and check that your tag manager tag is shown in green.
Conclusion
Installing Google tag Manager in your WordPress is the best solution to have all the scripts of the tools you use in one place. It also allows you to configure in detail the measurement of all your conversion goals in a very simple way. It is essential that you learn little by little how Google Tag Manager works and how to take advantage of it. While it is true that most people use it only to install tags, it also has much more advanced functions with a lot of potential. Now it’s your turn!