BLOG

How to Install Google Tag Manager in WordPress

Published August 29, 2015
You probably know that Google Tag Manager is a great and free way to manage all of the tracking code needed on your website.
What you might not know, unless you are proficient with modifying WordPress Themes, is how to install Google Tag Manager in a WordPress site.
Fortunately, it is not that hard. You can get it done in less than 10 minutes. Here’s how.

 

Blog Image Install Google Tag Manager on WordPress

 

Step 1 – Create a Google Tag Manager Account and a Container for your Website

Before we get started, I should mention that, if you prefer to watch a video than read through the post, the folks who do Google Analytics training at webucator have created this video that takes you through the steps.

https://www.youtube.com/watch?v=kiTP9MC8uLI

If you haven’t done so already, create a Google Tag Manager account.

During this process you will create a container, where you will store all the tags for your WordPress website. Use the name of your website as the name of this container (You may have other containers in the future for other websites). Choose “Web” for “Where to Use Container”.

 

Create a Google Tag Manager Account

 

If you already have a Google Tag Manager account, you may need to create a new container for your WordPress site. In that case, simply navigate to the Admin section, and from the Container selector, pick “Create Container …”.

 

Create a Tag Manager Container

 

Once your container is set up, open it and click on the Admin tab to enter the administration area for your container. Click on the gear symbol next to “Install Google Tag Manager”.

 

Get Your Google Tag Manager Code Snippet

 

This will bring up a code snippet that you are going to cut and paste into WordPress.

 

Google Tag Manager Code Snippet

 

Step 2 – Paste the Code Snippet into your WordPress Theme (Or Child Theme)

To install Google Tag Manager, you are going to copy and paste that code snippet into WordPress. Specifically, you are going to paste it into the correct file in the WordPress Theme that your website is using.

Note that if you are using a 3rd party theme (e.g., a theme that you purchased), in order to preserve compatibility with future upgrades, you may not want to edit your theme directly. In this case you should
modify your theme using a child theme. In either case, the process of pasting in the code snipped is similar.

To get started, log in to WordPress and navigate to Appearance > Editor.

 

WordPress Appearance > Editor

 

In the upper right corner, where it says “Select theme to edit”, make sure you have selected the active theme for your website.

 

WordPress Select Active Theme

 

If you are not sure which theme is active, click on “Themes” in the left hand navigation bar, and see which of the installed Themes is highlighted.

Next, in the right-hand column, under Templates, click on the appropriate header file. By default, this will be “Header” (header.php). However, the theme may be using a different file, depending on how the developers have customized it. In this case, our site is using a file named “header-megalytic.php”. If you are not sure which file is your active header file, then check with your developer or use trial-and-error, testing as you go (testing process described below).

Assuming your active header file is header.php, click on this link in the right side column. The text editor in the center of the page now contains the header.php file. Scroll down until you find the opening <body> tag. Then, paste in the GTM code snippet right below that tag.

 

Insert Google Tag Manager Snippet in WordPress Header File

 

Once you’ve inserted the snippet, make sure you scroll to the bottom of the page and click on the “Update File” button to save your changes.

Step 3 – Testing that Google Tag Manager is Correctly Installed in WordPress

Next, we are going to use Tag Assistant (by Google) to make sure that Google Tag Manager is installed correctly. For this, you will need to use the Google Chrome Browser. So, if you don’t have Chrome, install it on your computer now.

Open the Chrome browser, and install Tag Assistant. Once Tag Assistant is installed, simply navigate to a page on your site, and click on the tag icon at the top of your browser. You should see a green smily-face tag labeled “Google Tag Manager”, indicating that GTM has been successfully installed.

 

Testing Google Tag Manager Installation with Tag Assistant

 

Check some other pages of your website as well. You should see that Google Tag Manager is installed on every page. If it is not, you may have to check with your developers to see if there is more than one header file where you need to paste the code snippet.

Conclusion

Now that you have Google Tag Manager installed, you can use it for installing all kinds of tracking tags like Google Analytics, Google AdWords, AdRoll, CrazyEgg, and more. To learn more about working with Google Tag Manager, check out Google’s Quick Start Guide

ALSO IN THIS BLOG

Remember how your mom told you not to stand too close to the television because it might hurt your eyes?

The same rules can apply to data. If you’re too close, you may miss the patterns and trends that are crucial to understanding your website’s performance. You can’t judge a site’s performance looking at data in the bubble of a single day, you must consider any day’s traffic compared to the days before and after.

Google Analytics makes it fairly easy to analyze trends over long periods of time. But it also allows you to stand right in front of that TV, to look at more granular levels of time, right down to the hour.
There’s a better way to get that close to the data, without burning your retinas. We’ll cover how to analyze traffic effectively in today’s post.
When the client first came to you, you talked up the value of Google Analytics. You emphasized the importance of seeing where your traffic was coming from. You went on and on about how Google Analytics can show traffic sources to pinpoint whether people came from search, social media or a specific site referral, and how valuable this data was. You sold them on it, so much so that your client looked forward to receiving that first report, the magical day when they would finally understand where visitors were coming from.
But then the report came, and it looked like this:

 

 

It showed that 10% of your client’s traffic came from “(direct)/(none)”. What does this label mean? How do you explain Direct traffic to your client? Better yet, how do you explain “none”?
Let’s take a closer look at understanding Direct traffic in Google Analytics and how we can address it with clients.
Digital marketers spend a lot of time focused on PPC and SEO campaigns in order to drive desirable traffic to a website. The phrases we’re ranking for and bidding on get meticulous attention, so much so that we often forget about some of the other ways that visitors find us.

We put a tremendous amount of the effort we put into reviewing organic search data and PPC campaign performance in analytics. But how closely do we monitor referral reports?

If that’s not a channel you review regularly, you may be missing out on seeing traffic that is coming directly from links you’ve obtained around the web, local business listings, news mentions, and more. Many times, links are only considered as a means to an end, a metric that Google uses in determining how to rank sites in the SERPs (search engine results pages). But the fact is, many of a site’s links may be directly contributing to its traffic.

In this article, we’ll review how to look at referral reports in Google Analytics, and some of the many ways to use that data to better inform your web marketing decisions.