Hello. Congrats on taking a decision to vet a tag management solution and learning about how to Install Google Tag Manager on WordPress. You have come to the right place. In this blog we will look at the best way to install GTM on a wordpress website.

The world of marketing is constantly changing and there are new integration that marketing team needs to use everyday. And your web team needs to install these integration. When you install a tag management solution you remove a big bottleneck in your marketing operations and do your startup a big favor.

There are two high level methods to install GTM

  • Install it using a plugin (easy, and recommended for beginners)
  • Install it in the header file of a wordpress

Both the method works well. But the drawback of the first method is that the code is installed in footer. This is no problem until you start doing A/B tests. As it is in footer the website will load a default version and when it sees the other version in footer then will load it. This may cause your users to see the versions changing and know you are A/B testing. But again GTM has many applications and implementing A/B test is just one of them. The truth is if you are starting with GTM it can take you some time to even consider A/B tests. So as someone new to GTM we would recommend you install it using a plugin. Installing it using is really easy. If you are looking for a plugin then this is a great one to get started. Follow the given below until steps till step 3 and then just paste the container code in plugin and you should be all set.

If you are feeling adventurous and would like to pay attention to theme updates and reinstalling the code in header then you can install it using the below method:

Follow the steps to install GTM on your WordPress website:

1. Sign up on https://tagmanager.google.com

2. Create an account on GTM homepage for your website

mangoblogger install google tag manager

sign in google tag manger and create a account

3. Create account, name container and select ‘Web’ under ‘where to use container’ as you want to install it on wordpress

4. Once you create an account you will get the GTM code in the next screen. Copy the code to be paste underfrom the popup

6. Sign in to your wordpress website wp-login as an admin

7. Under appearance – click on Editor

wordpress install GTM mangoblogger.com

wordpress install GTM

8. On the right there will be a bunch of .php files. Find the one named ‘header.php’. Do not mess with any other file or anything else unless you know what you are doing.

9. In header.php file, find where is the tag, and immediately after it paste the code you got from your new GTM account as below

header.php wordpress install gtm

header.php wordpress install gtm

10. Save the file and you are good to go! Start the debug mode from your GTM to verify it is installed.


Prasanna Kulkarni

Founder and CEO of MangoBlogger.com. 6 years of experience in digital marketing. Managed hundreds of dollars in paid search budget. Creator of tools used by businesses all around the world and instructor of the ultimate guide to digital marketing course.


Leave a Reply