TrustPulse Marketing Blog

Actionable advice to boost your website conversions.

How to Add Google Analytics to Your WordPress Site—Quick & Easy!

Analytics can be a scary word to some people, but it doesn’t have to be!

In fact, tools like Google Analytics make it super easy to make the data-driven decisions that are going to help your eCommerce store or publishing site succeed.

In this article, we’re going to show you how to add Google Analytics to your WordPress site.

Knowing how your audience interacts with your site and your content is essential for your success and Google Analytics can help you understand those interactions easily.

If you’ve ever been intimidated by Google Analytics in the past, don’t worry! We’re with you, every step of the way.

Let’s get started.

What Is Google Analytics?

google analytics home page

Google Analytics is a free, comprehensive analytics solution for your website.

Whether you’re an eCommerce store owner, publisher, or small business, Google Analytics gives you all the information you need to know about your website visitors.

With Google Analytics, you can get an excellent understanding of your marketing impacts with easy-to-understanding site statistics like:

  • Number of website visitors
  • Where visitors are coming from (referral links)
  • What content on your site is most popular
  • And a ton more

Google Analytics also has advanced reports that you can use to get real-time website traffic information, do A/B testing, and track user engagement, among other things.

Basically, Google Analytics gives you everything you need to know about your visitors.

Why Is Google Analytics Important?

google analytics dashboard screenshot

Understanding your website analytics is key to growing your site’s traffic. That, in turn, leads to increased subscribers and then, to boosting revenue.

With Google Analytics on your website, you’ll be able to track all of the data that you need to get actionable insights to grow your business, eliminating the question of what you should be doing.

That way, you can stop wondering and just make informed marketing decisions based on the actual data that you’ve collected.

Here are some of the ways Google Analytics helps improve your business marketing strategy:

Learn More About Your Visitors

Using Google Analytics for WordPress helps you track and collect information about your visitors, like demographics and interests, location, browser, screen resolution, JavaScript and Flash support, language, and more.

This information is helpful for two very important reasons:

  1. Make sure your site is compatible with your audience. The data that you collect about the hardware and software your visitors use can help you build a site that is easier for them to access and browse.
  2. Create targeted marketing messages. The better you know your target audience, the more targeted your messaging can be. This leads to better engagement and higher conversions.

Understand How Visitors Interact With Your Content

google analytics audience overview

Adding Google Analytics to WordPress lets you track what your visitors are doing while they’re on your site. You’ll be able to see things like what pages they visit, how long they stay on your site, what pages they stay on the longest, and more.

Information like this is ridiculously useful. With it, you’ll be able to create strategies to keep visitors engaged on your site longer and even encourage them to purchase.

You’ll also be able to find your most popular post and compare them to the ones that aren’t performing as well to figure out the kind of content your visitors want. Then, give them more of that.

When you know where your visitors are spending their time on your site, you can create more of the content they like, increasing pageviews and decreasing your bounce rate.

Discover How Visitors Find Your Website

referral traffic from google analytics

Having Google Analytics on WordPress also gives you important information about how visitors find your site in the first place. Did they get to you from a search, direct link, or through a referral link from another site?

This data shows you where you should be focusing your attention.

For instance, if your top referral source is from an external website that you don’t already have a partnership with, you should definitely reach out to them for one! Maybe you could do a guest post exchange or a cross-selling promotion.

How Does Google Analytics Work?

As you can see, Google Analytics gathers a lot of data from your site. So, how does it do all that?

Well, it uses a small piece of JavaScript code to collect data all about your visitors and the things they do while they’re on your website.

Once you’ve set up Google Analytics on your WordPress site, it drops a tracking cookie in the visiting user’s browser that does all the work for you. That little tracking cookie tracks every action the user performs on your site.

So cool.

How to Sign Up for Google Analytics

Google Analytics is available for free. All you need is a Google or Gmail account to sign up.

It even has a simple signup process:

No Google Account? Start Here!

If you don’t have a Google account at all, then this is the first place to start. If you already have an account (like a Gmail or YouTube account), just skip over the first step and start at Step 2.

Step 1: Create a Google Account

You need to have a Google account to use Google Analytics. If you already have a primary Google account like Gmail, YouTube, or Google Drive, you’ll want to set up your Google Analytics account under the same name.

Otherwise, you’ll need to create a new one.

Step 2: Sign Up for Google Analytics

Once you have a Google account, you’ll need to sign up for Google Analytics.

sign up for a google analytics account

Click the Sign In link in the upper right-hand corner and you’ll see a dropdown menu. Select Analytics. You’ll be redirected to a page where you can choose the Google account you want to use.

google analytics sign up

Click Sign Up, then, on the next page, select Website and fill in your details, including Account Name, Website Name, URL, Industry, and your Time Zone.

google analytics setup1

Check the boxes next to all the recommended options, and then hit the blue Get Tracking ID button.

google analytics setup2

You will then be asked to accept the Terms of Service.

google analytics terms of service

After you hit the I Accept button, you will be redirected to your Google Analytics account.

We recommend leaving the Google Analytics browser window open since you may need it depending on which method you choose to add Google Analytics to your WordPress site.

How to Add Google Analytics to WordPress

There are many ways to add Google Analytics to WordPress. Let’s take a look at them below:

  • Install Google Analytics on your site using MonsterInsights (Recommended)
  • Add the raw tracking code to your site’s header with a plugin
  • Manually add the tracking code in header.php
  • Manually add the tracking code in functions.php

MonsterInsights: The Best Way to Add Google Analytics to WordPress

While manually installing Google Analytics allows you to gather basic traffic stats like sessions, pageviews, bounce rate, etc., the downside is that it doesn’t let you take advantage of the full potential of Google Analytics.

Plus, even a slight mistake when setting up anything can skew your analytics tracking. And if your analytics tracking is what you’re basing marketing decisions on, well, that can mess up a lot of other things.

There’s also the whole “manually customize the code” thing.

For example, if you want to use tracking features like forms tracking, downloads tracking, eCommerce tracking, or more, you have to manually customize the code for every instance.

Are you a developer or a Google Analytics expert? Unless you are, that doesn’t sound like it would be a fun time.

With MonsterInsights, though, you can add Google Analytics to WordPress with just a few clicks. Then, to add those advanced tracking features it’s just a few more clicks to enable the feature or install the addon.

Best of all? Zero coding, millions of hours* of your time saved.

Get started with MonsterInsights today to easily set up Google Analytics on your WordPress site!

*estimated

MonsterInsights

grow your business with confidence with monsterinsights

MonsterInsights is the easiest (and by far the best) way to add Google Analytics to WordPress.

It’s available as both a paid premium plugin and a free version, but for this tutorial, we’ll be using the MonsterInsights free version.

Want more advanced features like eCommerce tracking, ads tracking, author tracking, and more? Go with MonsterInsights Pro plugin!

To add Google Analytics to WordPress using MonsterInsights plugin, go to Plugins » Add New from your WordPress menu.

Search for MonsterInsights and when the plugin shows up, click Install Now then, Activate.

search for the monsterinsights plugin

Go to Insights » Settings to authenticate your blog with Google Analytics.

authenticate monsterinsights with your google account

Click Authenticate with your Google account.

On the next screen, select your Google account.

8 MonsterInsights-Authentication-Select-Your-Google-Account

Next, allow MonsterInsights to manage your account.

9 MonsterInsights-Authentication-with-Google-Process

Finally, select the correct website profile for your blog and click Complete Authentication.

9b mi authentication

After activation, the plugin will add a new menu item called Insights to your WordPress menu. Clicking on it gives you access to your reports and insights.

That’s it! You’ve successfully added and set up Google Analytics on your WordPress site. It will take Google Analytics a bit of time before showing your stats (typically 12-24 hours, but sometimes up to 48).

Insert Headers and Footers Plugin

With this method, you’ll add the Google Analytics tracking code to your site’s header using the Insert Headers and Footers plugin.

After installing and activating the plugin, go to Settings » Insert Headers and Footers and paste the Google Analytics tracking code into the plugin’s settings.

add google analytics tracking code to insert headers and footers

Remember, that you won’t be able to do advanced tracking configurations with this method. And, you won’t be able to view Google Analytics data in your WordPress dashboard.

Manually Add Google Analytics Code in header.php File

A more complex way to add Google Analytics to WordPress would be to open your theme’s header.php file and place the code right after the

<body>

tag.

If you add the code to your main theme, then it will be overwritten whenever you update your theme. We strongly recommend using a child theme when adding customizations to your WordPress site.

Manually Add Google Analytics Code in functions.php File

If you’re confident in your knowledge of PHP you can open your theme’s functions.php file and add the following code, replacing the fourth line with your Google Analytics code:


<?php add_action('wp_footer', 'add_googleanalytics'); function add_googleanalytics() { ?>

// Paste your Google Analytics code here

<?php } ?>

Now you know 4 different ways to add Google Analytics to your WordPress site!

While we firmly believe in your ability to use any of these methods to successfully add Google Analytics to WordPress, only MonsterInsights makes it super simple to set up advanced tracking and view reports from the comfort of your WordPress dashboard.

Get the most out of Google Analytics on your WordPress site by learning which metrics you need to track to boost conversions then setting up and tracking conversion goals.

Author Photo
Published by

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

Increase Trust, Conversions and Sales NOW
Try TrustPulse 100% risk-free for 14 days!