How To Install Google Tag Manager on WordPress

When you create your account there are 3 levels inside of Tag Manager:

  1. Account- Think of this as a companywide account
  2. Container- Individual websites
  3. Tags- Individual tags you get from all the other platforms that want your website data

You should be the only one who has access to your account at the company level. If you do anything with clients or collaboration projects there should always be a separate account. If you have subdomains, you should have the same container for that entire domain. Inside of the containers you will have all of your tags.

It is time to set up an account. Google search Tag Manager and once you are on the page click the start for free button. Log in with your Gmail email which can always be changed later if you so choose. When setting up the container, the container name will be your website. From here you want to select web since it is a website and nothing else. Click on create after that. 

From here a tag manager code page will come up. This is the code that goes on your WordPress site. You want to copy the code and paste it onto the header tag and the body tag. You will most likely need to access these codes more than once. Here is the way to get back to the codes. Click on your Tag Manager ID also known as your GTM ID. You may want to save these codes to your internal documentation like a word doc or google doc. You can also download a copy of the Tag Manager playbook. Tag Manager should be on every page of your website. Now that you have the code it is time to put it on every page of your website. When it comes to WordPress you have two options to do this. You can either install it at the theme level or use it as a plugin. Tag manager should be on every page of your website. The downside of using the theme route is if you have any page builder plugins it will not show up. If you have a theme for your blog and then you’re using a page builder plugin for some of your landing pages or other pages it will not show up. The reason being is because it’s being managed by a different plugin. This may be the decision-maker of why you want to use a plugin as opposed to the theme route. If you don’t have any page-building plugins on your website then go ahead and use the theme. 

Theme Install

You will want to go to page options or theme settings. Install Thrive Themes. Inside the WordPress dashboard, you want to click on the Thrive Dashboard and then click on Theme Options. Under options, you will then look for something called Analytics/Scripts. When you click on it you will see a header script, opening body script, and a body script. Thrive Themes is focused on marketers that is why they have an opening body script. If you happen to have a body script but not an opening body script that is fine because Tag Manager will still work. Jump back to Tag Manager and you copy the header tag and body tag. The head tag will be pasted in the header script and the body tag will be pasted into the opening body script or the body. Either or is fine. After you have done this, you will click on save all changes. That is all there is to it when setting up your Tag Manager with your theme.

Plugin Install

On the left side panel, you want to click on plugins and then hit add new. Install Google Tag Manager for WordPress. Once it is installed you can then go to Setting and then Google Tag Manager on the left panel. From there you want to paste in your GTM ID. You will then see that in the Container Code Placement the footer of the page is selected. Selecting this method will not put the code in the right place but the code will work. The reason why they put it in the footer is that they want to make sure no matter what themes or plugins are running on your website Tag Manager will work. Is it the right way to install it? No. Will it still work? Yes. After selecting this you can then click save changes. Now it is time to verify the install. 

Verify Installs

There is a free chrome plugin that makes sure Tag Manager is added correctly. Go to Google then search google tag assistant. Click on the Chrome one that says Tag Assistant (by Google). After this, you want to click the Add to Chrome. When you are adding to Chrome for the first time you will leave everything checked as is. Click done. This will not automatically load. You will then need to go to your website and click on the plugin icon and hit enable. Once you do this it should work. After clicking enable you will then refresh the page. You will then see a red warning sign. The reason you will see this message is because there are no tags in the container. What you have to do is add a tag. Once you have done this then Tag Manager will turn green. You are now good to go. The problem is fixed.

Fix Errors

There are four colors that you need to be aware of when it comes to the errors that might show up. Green means everything is good to go and it’s a standard install. Blue means that it’s working and it’s not a standard install. You don’t have anything to worry about when it comes to these two colors. Yellow means there’s some sort of data collection issue. Red means that the tag is not working. When it comes to the yellow error color it can be a personal issue with your particular browser. It could be blocking some cookies or blocking something from firing. The good thing about any error is that it can be fixed. Many people have run into the same issues. What you want to do is click to see the installation errors. If the error doesn’t make sense to you then you can always search google for that specific error to solve the problem. 

If you need help with any of these steps, reach out to us here at Spark Factory and we will get you set up to conquer digital!

About the author

Stacey Stevens is an editor for Spark Factory, covering organic search, podcasting and e-commerce. Her background is in journalism and content marketing.