Add Google Analytics to WordPress, with this simple guide!

Wondering how to add Google Analytics to WordPress?

You’ve probably heard plenty of bloggers talking about how they can’t do without this powerful free tool.

But maybe you’ve been avoiding installing it because the whole process sounds overwhelmingly “techie”.

No worries!

I’ve created this step-by-step guide to help you add Google Analytics to WordPress in minutes.

I’ll show you how to easily set up a free Google Analytics account and start tracking the traffic on your WordPress website.

Even better, most of the methods I’ll show you are completely beginner-friendly.

But first things first.

If you’re on the fence about needing Google Analytics to grow your blog, let me tell you why you absolutely do.

Why Add Google Analytics to WordPress?   

As a blogger, your priority is to create content that drives traffic and engagement on your blog.

Consistently creating content that appeals to your target audience is the only way to build a successful, profitable blog.

But to do that, you have to understand how your audience interacts with your website.

What content brings you the most visitors? Where does most of your traffic come from? What are the busiest times on your site?

And that’s where Google Analytics comes in.

Installing Google Analytics on your WordPress site allows you understand all of this and more.

This information allows you to discover who your audience is and what kind of content they like.

You can then use this data to create more content that brings your audience to your blog and helps you successfully monetize.

While you may already have some idea of what works best for your audience, Google Analytics helps you grow your blog with data-driven decisions.

Plus, If your blog‘s business model includes working with brands, your Google Analytics numbers can help you land better collaboration opportunities.

How to add google analytics to WordPress guide

 

So exactly what kind of information can Google Analytics provide you with?

Here’s just a small sample:

Live data: Google Analytics allows you to see how many visitors are on your site, in real time. You can actually view how visitors navigate around your site.

Exactly how many visitors you get per hour/day/week/month: With this kind of data, you’ll find out which times and days are the most popular for site visitors. You can then schedule and promote your best content when it’s most likely to be seen and shared.

Where your site visitors are spending time on your site: Google Analytics shows you the most popular pages on your site. This allows you to identify and create more of your hottest content to drive even more traffic to your site.

You can also see how long visitors spend on any page of your site. This information is particularly helpful if you’re trying to lower your bounce rate. You can then create more of the type of content that keeps people on your site longer.

Who your blog’s audience is: Google Analytics gives you super-useful demographics data about your audience’s age range, geographic location, and more. This allows you to create content that speaks directly to your specific audience. The more your blog posts align with your audience’s interests and answer their questions, the more successful your blog will be.

Where your traffic comes from: Google Analytics shows you all of your traffic sources and compares them by the amount of visitors they bring to your site. Want to know whether you should focus on Instagram or do more guest posting? No problem.

With Google Analytics, you’ll know which sources and platforms are helping you grow your blog the most. No more guessing-games and wasting time on what doesn’t work.

As you can tell, Google Analytics is a must-have if you’re serious about getting more traffic and growing your blog.

So if you’re ready to take your blog to the next level, let’s get started!

(Quick note: This tutorial shows you how to add Google Analytics to WordPress sites that are self -hosted WordPress, not wordpress.com sites.)

Setting up a Google Analytics Account:  

Before you can add Google Analytics to WordPress, you’ll need to set up a Google Analytics account.

1. To do this, head to Google Analytics.

Add Google Analytics to WordPress, setting up a Google Analytics account

Sign in with the Gmail account you want to link your Google Analytics account to. If you don’t have a Gmail account, you’ll have to create one to use Google Analytics.

Once you’ve done that, you’ll be taken to a setup screen:

Add Google Analytics to WordPress, how to set up Google Analytics

2. Here, you’ll be given a choice between tracking a website or a mobile app. Since this Google Analytics account is for your WordPress website, select Website.

Add Google Analytics to WordPress, How to set up Google Analytics

3. You’ll then need to input your account name, website name, and your website URL. Here, it’s important to specify whether your website URL is http or https.

Add Google Analytics to WordPress website

4. Under the Industry Category dropdown, select your website’s niche. This will eventually allow you to understand how your website is performing compared with other sites in your industry.

5. Select your time zone. This will ensure that you can pinpoint exactly when your website receives the most traffic.

6. Finally, select the Get Tracking ID button. You’ll be presented with the Google Analytics service agreement. Read and accept by clicking on the “I Agree” option.

add Google Analytics to WordPress, Set up Google Analytics account, how to

You will now see your Google Analytics tracking code.

7. It’s time to add the tracking code to your WordPress website.

Select and copy the tracking code.

dd Google Analytics to WordPress, Get Tracking ID

Go ahead and leave the page with your Google Analytics tracking code open as you’ll need it later. 

Add Google Analytics to WordPress: The 3 Best Methods

There are several methods of adding your Google Analytics tracking code to your WordPress website.

We’re going to look at the top 3 ways and break down how you can do each, step-by-step.

Method #1:

How to Add Google Analytics to WordPress with a Plugin

This is the easiest and most beginner-friendly way to add Google Analytics to your WordPress website.

If you’re looking for the least “techie” option, I’d definitely recommend this one.

Once you’ve installed the free Insert Headers and Footers plugin, you’ll be able to quickly add your Google Analytics tracking code without touching a line of code.

Benefits of Using a Plugin:

 

This plugin allows you to insert code into the header and footer throughout your site. Even better, it enables you to do this without having to manually add code to your theme’s header.php or footer.php files.

Plus, you won’t have to worry about your tracking code disappearing after your theme updates. Because your code is kept separately in the plugin, it’ll stick around even after you update or change your theme.

To use this method:

1. In your WordPress dashboard, go to Plugins>> Add New.

how to add google analytics to wordpress with Insert Headers and Footers plugin

2. Here, type “Insert Headers and Footers” into the search bar. From the results, choose the the Insert Headers and Footers plugin by WPBeginner.

3. Hit Install Now and then activate the plugin. (Check out my detailed post on how to install a WordPress plugin, if you need more help with this process.)

How to add Google Analytics to WordPress with Insert Headers and Footers plugin

Now that you’ve got your plugin activated, it’s time to paste in your Google Analytics tracking code.

4. Go to Settings in your dashboard’s side menu. Here, you’ll see that a new option called Insert Headers and Footers has been added to the list. You’ll notice an area called Scripts in Header. This is where you want to paste the Google Analytics tracking code that you copied earlier. It’s important to add it here and not in the footer area, because this allows you to get more accurate data.

Add Google Analytics to WordPress with Insert Headers and Footers plugin , add code

5. Once you’ve added your tracking code to the header section, simply click Save.

And that’s all there is to it! The plugin will now automatically add your Google Analytics tracking code to your WordPress website.

Please note: It can take anywhere from 12-48 hours for Google Analytics to start showing you your first results

Method #2:

Add Google Analytics to WordPress: The Manual Method  

 

If you’re comfortable with adding code snippets to your WordPress files, this method is easy. Please note though, you’ll need to be using a child theme to implement this method.

That’s because, if you add your Google Analytics tracking code directly to your WordPress theme’s files, it will disappear every time you update your theme.

As themes generally update regularly, you definitely don’t want to be stuck having to add your code every time you update.

(I’ll be posting a tutorial on how to create a child theme for your WordPress site in the near future.)

OK, now that we’ve gotten that out of the way, let’s get started!

To manually add your tracking code to your WordPress website:

1. In your WordPress dashboard, head to Appearance >> Editor.

Here, select and open your child theme’s header.php file.

Add Google Analytics to WordPress, add code to header file

2. Right before the closing tag of you header.php file, paste the Google Analytics tracking code you copied earlier.

Add Google Analytics to WordPress to header file manually

3. Finally, make sure you save your changes by clicking Update File.

Add Google Analytics to WordPress, add code to theme header

Your Google Analytics tracking code will now be active.

Please note: This method adds the tracking code via your WordPress website’s child theme. So if you ever change the theme/child theme you’re using, you’ll have to add the code again.

 

 

 

Method #3:  

 

Add the Google Analytics Code Directly to Your WordPress Theme

Most quality WordPress website themes now allow you to add code snippets like your Google Analytics code directly within them.

For example, if you use the Genesis WordPress framework, you can easily add Google Analytics to WordPress.

Here’s how:

How to Add Google Analytics to WordPress Genesis Framework 

1. Head to your WordPress dashboard.

2. Here, in the right-hand menu, go to Genesis >> Theme Settings

3. Scroll to the bottom of the options and you’ll see theHeader and Footer Scripts In the first box, paste your Google Analytics tracking code.

4. Save your changes and you’re done!

Divi is another hugely popular WordPress theme that makes installing Google Analytics ridiculously simple.

I’ll also show you how to quickly add Google Analytics to WordPress in the Divi theme.

 

How to add Google Analytics to WordPress in the Divi Theme 

1. Log in to your WordPress dashboard

2. Go to Divi >> Divi Theme Options.

Add Google Analytics to Divi WordPress theme without a plugin, step 1

3. Here, select the Integration tab.

Add Google Analytics to Divi WordPress theme without a plugin

4. Scroll down to the section titled “Add code to the < head> of your blog”

In the adjacent box, paste your Google Analytics tracking code.

Add Google Analytics to WordPress Divi theme without a plugin

5. Scroll down and save your changes.

Add Google Analytics to WordPress theme Divi without a plugin

Google Analytics will now be up and running on your WordPress Divi theme website!

Super simple, right?

How to Test That Google Analytics Works by Sending Test Traffic

 

Once you add Google Analytics to WordPress, it should start tracking traffic pretty much immediately. In some cases though, you won’t see accurate data for 12-48 hours.

However, there is a way to check that you’ve successfully added Google Analytics to your site.

To do so:

1. Head back to the Google Analytics page with your tracking code that you left open earlier.

Once there, under Status, you’ll see a button that reads “Send test traffic”. Click this button. Google Analytics will then open your website in a new window.

Add Google Analytics to WordPress, how to send test traffic in Google Analytics

2. Under Status, you’ll see that, instead of “zero active users right now”, it now reads 1 active user right now (including 1 from test traffic)”.   

Add Google Analytics to WordPress, send test traffic in Google Analytics

This means that Google Analytics just successfully sent test traffic to your website and started properly tracking visits to your website.

Congratulations, you now know how to add Google Analytics to WordPress!

The Wrap-up:

While it may seem complex, installing Google Analytics in WordPress is actually a pretty straight forward process. If you use any of these 3 easy methods, you’ll be finished in no time!

And once you get it done, you’ll open up massive opportunities for your blog.

From finding out what your audience really wants, to being able to land great collabs, Google Analytics helps your blog go from hobby to thriving biz.

After all, the more you know about your blog’s traffic, the better equipped you’ll be to grow it.

So if you haven’t yet, I’d seriously recommend that you add Google Analytics to WordPress today!

And if you run into any difficulties getting started, feel free to reach out in the comments.