20 September 2017

When it comes to online marketing, nothing is more important than measuring the real-world impact your efforts have on business. The gold standard for measuring an owned media property like a blog is the free version of Google Analytics. In this post, we’ll look at how to add Google Analytics to WordPress so that we can measure our blogging efforts in a comprehensive fashion.

Avoid guesswork. Use Google Analytics to get hard data.

Why Google Analytics?

Why is Google Analytics the platform of choice for so many blogs? First, it’s free of charge for all but the largest websites. While the appeals to small businesses is obvious, it can also entice larger organizations that are piloting content marketing programs.

Another reason Google Analytics is so popular is it provides robust, detailed reporting on blogs without requiring much setup.

It doesn’t take long to figure out how to add Google Analytics to WordPress, and then you’re off and running. Google Analytics is like any great application — easy to start and find immediate benefits, yet robust enough to keep delivering value as you explore it.

What do we need to install Google Analytics in WordPress?

Installing Google Analytics in WordPress requires three components:

These pieces combine for an installation that follows best practices — and remains robust, flexible and adaptable to future changes. While some people advocate for directly installing Google Analytics on a WordPress blog, I advise against this. It’s all too easy to create outdated tracking codes over time, or have a new theme erase tracking codes entirely. The above setup provides insurance against these common mistakes.

How add Google Analytics to WordPress

This tutorial assumes that you’ve already got a live WordPress website and domain name. We’re also assuming you have a Google Analytics account, and you want to put the tracking code on your WordPress site.

  1. Find the Google Analytics tracking code.
  2. Set up a Google Tag Manager account.
  3. Set up your first tag.
  4. Install Tag Manager Plugin.
  5. Validate.

Let’s get started.

1. Find the Google Analytics tracking code

From Admin, go to Property Settings, and then find the code:

Make note of this code in a sticky note or your computer’s notepad app. Be sure to note your website domain, as well:

2. Set up a Google Tag Manager account

Sign up for a free Google Tag Manager account if you don’t already have one. Log in, and then add a new Google Tag Manager account:

Select your account name, and then choose a container and your domain name:

Agree to the terms of service. You’ll be greeted with a snippet of code for your website. Take note only of the Account ID in the code:

3. Set up your first tag

Set up your first tag by clicking New Tag:

Name the tag, then click the grey icon to begin adding the tag:

Select Universal Analytics:

Name this tag something obvious, like Google Analytics. From Google Analytics Settings, go to Select Settings Variable, and then select New Variable:

Paste your Google Analytics ID (the code you got earlier, which begins with UA-) into the Tracking ID field, then click Save:

Click Choose a trigger to make this tag fire:

Select All Pages:

Click Save. When you’re done, click Submit on the container’s main page:

Create some reference notes, and then click Publish. This completes the process for creating a tag with Tag Manager:

4. Install Tag Manager Plugin

Let’s move on to the final stage of the process, installing Tag Manager on your WordPress blog.

From your WordPress control panel, go to Plugins, and then click Add New Plugin:

In the Keyword field, enter Google Tag Manager, and then choose the plugin from either DuracellTomi or George Stephanis:

From Settings, go to Google Tag Manager, and then note the options. Paste in the Google Tag Manager code you got earlier (which begins with GTM-), and then make sure the top boxes are checked. Scroll down to the bottom of the page and click Save.

5. Validate

To make sure everything is working correctly, open Google Analytics, and then from the REAL-TIME section, select Overview:

You’ve just about figured out how to add Google Analytics to WordPress. To wrap things up, go online with another device, such as your smartphone, and then open your website. Go back to Google Analytics on your original device. You should see at least one new active user in the real-time overview, indicating that everything is working correctly.

A quick recap of how to add Google Analytics to WordPress

If you again find yourself wondering how to add Google Analytics to WordPress, remember the process we just covered. It ensures you have the most modern, up-to-date version of the software, and a robust way to make future changes. As you likely saw with Google Tag Manager, many other options are available. Once you have it installed, making changes is straightforward.

For example, using the free Google Optimize software, you could A/B test landing pages on your website with Google Analytics and Google Tag Manager. You’ve already completed most of the installation steps to do so.

You could use Google AdWords to run ads for your business and track conversions . And again, with the setup we just covered, you’ve already handled the majority of the nuts-and-bolts infrastructure needed to track it. All that’s left to do is add the AdWords tracker in Tag Manager.

Good luck measuring your WordPress blog!