How to Install Google Tag Manager Onto WordPress

Google Analytics, Marketing, Tutorials
Home ยป How to Install Google Tag Manager Onto WordPress

This is a tutorial on how to install Google Tag Manager(GTM) onto WordPress. Before you install Google Tag Manager, you’ll want to have Google Analytics(GA) installed on your site. You can learn how to do that here.

Why You want Google Tag Manager

Google Tag Manager allows you to track events. So what are events? They are interactions on your website. For example clicks, scrolling, form submissions, video plays are all events. Events are important because they often are the conversion on a site. If you have the campaign to get ebook downloads. You can place an event on the sign-up button to track the efficacy of the campaign and see how many people downloaded your ebook, which can be found here. There are hundreds of things that can be done with GTM.

In essence, events help you understand how people are interacting with your website. They are a more detailed and customizable way to asses user engagement on a site.

Creating a Google Tag Manager Account

First things first. You’re going to want to create a Google Tag Manager Account. that can be done here for free. I’m not going to go through how to create an account it’s very similar to how you create a Google Analytics account. Also, it’s 2020 you should know how to create accounts by now.

This is where things can get confusing. Within GTM, you’ll have more accounts for each of the web properties you have access to.

Google tag manager accounts

Within Accounts, there are GTM containers. In the container is where all the tagging takes place. So in the pictures above, Jon Elordi is the account and jonelordi.com is the container. An account can have multiple containers. So when you click on Create Account at the top right you’ll create an account and your first container. To start adding GTM to a website, click on Create Account in the top right.

google tag manager account form

Give your account a name. I generally just give it the name of the website. If you’re working for a client that has multiple websites just name it after the client.

Google Tag Manager Container

Next set up the container. For the container name, I usually just us the website URL. Select “Web.” Click on Create. You’re done. You’ve created a GTM account and container. Now to add it to WordPress.

Adding Google Tag Manager Code to WordPress

Upon completing the container set up. GTM should display the code you need to install onto WordPress. IF you missed it you can get it again by clicking on the container. Select Admin at the top left and click on “Install Google Tag Manager.” It will then show you the code you need to install.

google tag manager get the code

So there are many different ways to do the next part. I’m going to show you how I did it for my site. GTM gives you two code snippets to install onto your website. One snippet goes in the head tag the other in the body. So we need to alter the HTML of your WordPress site. There are many ways to do that with the optimal way depending on your theme among other things. But here’s how I did it.

Wordpress Appearance

Go to Appearance > Theme Editor. You’re going to see a lot of code, and it might be overwhelming if you’re new to this.

Select “Theme Header” from the right side menu. The HTML that is now on your screen is the HTML that is your website. So be careful, but also don’t worry too much. For the first GTM code snippet, you’ll want to identify the head tag and insert the GTM code within it.

head GTM code

The head area starts with “<head>” and ends with “</head>.” I marked them with arrows in the above picture. Copy and Paste the code between those head tags. The next snippet goes within the <body> tag.

head and body gtm code

In the above picture, the <body> tag and body GTM code are in blue. As you can see the GTM code was copied and pasted beneath the <body>. Once you’ve inputted both pieces of code. Click on “Update File” and you’ll be done.

And that’s how to install Google Tag Manager onto WordPress.

Leave a Comment