How to Add Google Analytics to WordPress
Easily Set-Up Google Analytics With Just A Few Clicks

Dale McManus

Co-Founder & Web Developer

Jan. 20, 2019

Hey, my name is Dale! My partner Alex and I have helped tens of thousands of people build beautiful websites around the world. In this simple, step-by-step guide, we’ll cover everything you need to know about how to add Google Analytics to your WordPress website. Let’s dive in!

  • Level of Expertise
    Beginner
  • Time To Complete
    20 Minutes
  • What You Get
    Google Analytics, Installed

We’re flipping the script with a special blend of a couple videos mixed in below, so let’s jump straight to the post. Right. Now.

So you’ve heard a bit about Google Analytics and think you want to add it to WordPress?

Smart. It’s an essential tool in the pro website toolkit.

But what exactly is it?

And is there an easy way to install Google Analytics in WordPress (meaning without having to tear your hair out messing with code).

There sure is friends.

All will be explained below.

how to add Google Analytics to WordPress

What is Google Analytics?

So WTF is Google Analytics?

Put simply, it’s an awesome tool that allows you (and over 50 million other websites around the world) to track and analyze your website traffic aka visitors.

It works by adding a piece of JavaScript code to your page (don’t worry – you won’t have to mess with this when you follow our tutorial below!).

That Google Analytics tracking code then monitors the visitors that come to your site to show you things like how long they spend on each page, where they come from, and what things they do while they’re visiting you.

It then does some programming magic to present this truckload of data in the form of stats and reports so you can better understand your visitors and how they use your WordPress site.

Why You Should Use Google Analytics with WordPress Sites 

GAnalytics. Definitely a must-have tool in the pro website game.

Not having it is like driving a cruise ship with a blindfold on – unless you’re the saltiest of sailors with a birdlike sense of magnetic north (for real, we watch way too many nature documentaries), you’ll just have no idea where you’re going.

And that means you’ll go in circles at best (read: create a bunch of content, do a bunch of marketing and earn no $$).

At worst, you’ll run aground on some uncharted island (not so bad except death).

By adding Google Analytics to WordPress, you’ll be able to learn a whole bunch about your website including:

Who Visits

Where do your visitors come from? What browsers and devices do they use? What times do they visit most?

We don’t know.

And neither do you until you install Google Analytics in WordPress!

How They Find You

When you add Google Analytics to WordPress, you’ll also be able to see where your visitors come from – search engines, typing your website directly into the address bar, links from other sites, and social media.

GA also lets you know what percentage of your visitors come from each source, as well as particular breakdowns for each category e.g. for “search engines” you can see how much traffic comes from Google, Yahoo, Bing, etc.

What They Do

Last but not least, setting up Google Analytics on WordPress will let you track which pages visitors land on first, where they go from there, and how long they stay on your pages.

And if you get fancy with the setup, you can even see what links people click on and create goals that let you track wins like lead magnet downloads and cart checkouts.

With all this juicy data, you’ll be able to effectively optimize your site to get more traffic and sales.

Examples:

  • Optimize your site for certain devices.
  • Invest in getting traffic from sources that work well for you.
  • Create content that better fits what your visitors are looking for to keep them on your site longer and build a stronger relationship with them.

Basically, installing Google Analytics on your WordPress site cuts out a lot of the guesswork so you can make decisions about where to go next based on what people actually do on your site.

Not gut instinct. We like that kind of moxie but it’s not pro website best practice.

Google Analytics Basics

Before we get into the details of how to add the Google Analytics tracking code to WordPress, let’s have a quick look at the main Google Analytics interface so you can start getting up to speed.

Google analytics wordpress dashboard

On the right, you’ll find a bunch of cool/important stats for your website like how many users (visitors) have come to your site recently, as well as how they’re getting to your site, when they visit, where they’re from, etc.

As you build your Google Analytics ninja skills, though, you’ll spend most of your time in the more specific “Reports,” which you’ll find from the sidebar on the left.

There are a ton of different sections here, but these are general types of reports you’ll find:

  • Real-Time: These reports show you what’s happening on your site in… real-time. Normally it takes 24 hours to see data in other reports, here you can see how many people are on your site, what they’re looking at, etc right now!
  • Audience: Here you’ll learn more about how many people have visited your site over the past x amount of time (you can adjust this), how long they staid on your site, plus demographic data.
  • Acquisition: These will show you where your traffic is coming from. Super valuable!
  • Behavior: Reports in this tab show you things like what pages visitors land on first, what pages they visit the most, how long they stay on each page and more.
  • Conversion: If/when you set up “Goals” in Google Analytics (a topic for another time), you’ll be able to see how well you do at getting visitors to complete those goals (eg email signups or product purchases).

Alright, time to deliver on what we promised in the headline…

Adding Google Analytics to WordPress

Step 1: Set Up a Google Analytics Account

Alright, first step in setting up Google Analytics on WordPress is to set up a Google Analytics account.

Totally free and super simple (especially if you already have a Google account).

Just head over to Google.com/analytics and click start for free.

Sign in to your Google account if you’re not already logged in, otherwise, just click “sign up.”

google analytics wordpress account signup

From here, Google’s going to ask you what you want to track (select “website”), then you’ll type in an account name (your business name works well, in case you want to build more websites later), then your website name (your domain name works here).

Select an industry and make sure your time zone is correct.

google analytics wordpress settings

Leave all the other boxes below that checked, then click “Get Tracking ID,” and accept the terms.

That’ll take you to your new Google Analytics dashboard and this step’s done!

Step 2: Install the Google Analytics WordPress Plugin

Next, time to install Google Analytics on WordPress, no code required!

Because we’re using a plugin baby. B)

Jump over to your WordPress dashboard, then “Plugins” and “Add New” in the sidebar.

google analytics wordpress plugin add new

From here, head over to the search box, type in “Google Analytics,” find the “Google Analytics Dashboard for WP” plugin, smash that “Install Now” button then “Activate” once that’s done.

wordpress google analytics plugin install

Sweet, now we’ve got to link your account to the Google Analytics WordPress plugin we just installed.

Easy enough, just go over to the sidebar menu on the left and scroll down until you see “Google Analytics,” then click on “General Settings.”

google analytics wordpress plugin settings

On the next page, click “Authorize Plugin.”

authorize google analytics wordpress plugin

Then on the page after that, click the “Get Access Code” link.

wordpress google analytics plugin get access code

This will open a new tab/window (depending on your chrome settings lol), from here just sign in to the Google account you signed up for Analytics with, then click “Allow.”

You’ll then get a code to copy:

google analytics code copy

Copy that bad boy, paste it into the aptly named “Access Code” field back in the Google Analytics WordPress plugin page, then click “Save Access Code.”

save wordpress google analytics tracking code

Assuming plugin authorization succeeded (if not you probably copied the code wrong; no biggie, we screw that up sometimes too), just scroll all the way down the plugin page and click “Save Changes”…

wordpress google analytics plugin save changes

And we’re set on Step 3!

Step 4: View Your Google Analytics Data;

Setup’s done, time to start checking out that sweet sweet website data!

We covered the basics of what you’ll find inside Google Analytics’ dashboard above (“Google Analytics Basics” in case you forgot or skipped it).

But one of the cool things about the Google Analytics WordPress plugin we installed is that it gives you a lot of this information right inside WordPress!

To check that out, head over to your main WordPress dashboard (click “Dashboard” in the sidebar if you’re not already there), scroll down and you’ll see a mini Google Analytics dashboard widget

google analytics wordpress plugin dashboard

This will start at zero because we just installed Google Analytics/the WordPress plugin, but over the next few weeks Analytics will record data and start displaying that here.

Here you’ll also find a couple of dropdown boxes to change what data is displayed in the little line graph.

In the one on the right, options include:

  • Sessions (how many times people visited your site; sometimes one person will have more than one “session”)
  • Users (how many people visited your site)
  • Organic (how much traffic you got from search engines)
  • Page Views (how many pages users visited)
  • Bounce Rate (percentage of page views where users left without clicking to another page on your site)
  • Location (where users are coming from)
  • Pages (shows you which pages were visited the most)
  • Referrers (tells you what websites your traffic is coming from besides Google)
  • Searches (shows you what keywords searched when they found/clicked to your site)
  • Traffic (stats on what “channels” [search, direct, social media, other sites] users come from and whether they’re new or returning)
  • Technology (tells you what browsers, operating systems, and types of mobile device people use when visiting your site)
  • 404 Errors (lets you know if any of your pages have a “404 Not Found” error)
google analytics wordpress plugin reports

Using the dropdown on the left, you can set how far back you want this data to go, from Real Time (now!) up to Three Years (one day!).

wordpress google analytics plugin times

Google Analytics + WordPress = Done

Alright yall, that’s a bit on what Google Analytics is and how to add it to WordPress.

If you found our little tutorial here helpful be sure to check out our other written guides for more super helpful pro website tips and tricks.

See you over there!

Sharing is caring!

Leave a Reply

Your email address will not be published. Required fields are marked *