How to Add Google Analytics to WordPress

How to Add Google Analytics to WordPress


Feedback is your most important tool in figuring out what parts of your website are working and what parts need a little help. Comments are the greatest form of feedback since they come with that nice little glow of knowing that people are not only reading your content, they’re also willing to hang around and talk about it. But comments won’t tell you everything you need to know about how people are finding your site and what they are doing while they’re there. For that, you need Google Analytics.

Google Analytics gathers all sorts of very helpful information in a free tool. For example, it will tell you where your users are geographically, what browser they are using, whether they have JavaScript or Flash support, and a hundred other things.

This may sound like you’re delving deeper into your users’ information than you really need, but all of this is very important. For example, if almost none of your users have Flash support, then you need to make sure that nothing on your site requires it. You want to make everything you publish as compatible as possible with the equipment that visitors are using to view it.

How Do I Get Google Analytics on My WordPress Site?

There are many other things that Google Analytics can help you with, but for any of it to be done, you have to have it on your WordPress site. So let’s jump ahead to how you can make that happen.

The first thing you need is a Google account. If you already have one, just sign in. If you don’t, it doesn’t take much longer to register than it does to just log in. Once you’re on the Google Analytics page, you should have a large button on your screen prompting you to start using it. Once you click that button, you will be taken to a screen that gives you the choice between using Google Analytics on a website or a mobile app. For your WordPress site, you want to make sure that website is selected before you continue.

The Blog Millionaire Podcast

The top rated blogging podcast on iTunes is hosted by Brandon Gaille. He built his blog from zero to 1 million monthly visitors in less than 18 months, and he shares his secret strategies in his award winning podcast. Listen to the Latest Episodes Right Now.

It’s up to you whether you want to go with Universal Analytics or Classic. Universal has extra features that are still in beta. Once they come out of there, they will automatically be added to Classic. Both are free.

The rest of the form is very self-explanatory. Your account name can be anything you want. Fill in the rest of the information and click the Get Tracking ID button. You’ll see Google’s terms and services agreement that you have to sign off on before you can continue. Once you do, you’ll be given your Google Analytics tracking code.

You will need to enter this code into your WordPress site, but you will also need to revisit the Google Analytics page, so leave it open in a tab while you go to your site. You will need to enter the tracking code into your site’s header. You can do this one of three ways.

Method One: Plugins

First, you can use a plugin. This is the easiest method. There are a bunch of different Google Analytics plugins available, but all you need is something like the Insert Header and Footer Plugin. Copy and paste your tracking code into the plugin’s settings page.

Once you have Google Analytics working on your WordPress site, you will have to visit Google Analytics to see your reports. If you want to change this, use the Google Analytics + plugin. It will put all of your reports on your WordPress dashboard with charts and graphs.

How to Get Millions of Visitors to Your Blog

Find out the four things you need to do to get your posts to rank on the first page of Google, which will drive a ridiculous amount of traffic to your blog.

Method Two: Header.php File

The second way to insert the code is to directly paste it into your header.php. To find this, click on Appearance>Editor in your WordPress Admin. Open up the header.php file. The code should be inserted immediately following the tag. There isn’t any real advantage or disadvantage to doing this over using a plugin, but if you’re trying to avoid any extra plugins, this is a pretty straightforward way around it.

Method Three: Functions.php File (Not Recommended!)

The third way you can insert the code is through the functions.php file. If you mess this file up, it’s a headache to fix, so only do this if you are confident that you know what you are doing. Really it’s best to avoid any unnecessary tampering with this file, so you should probably just go back and do it through a plugin or your header.php file.

Wait For Results

Once you have the code inserted, go back to the tab where you left the Google Analytics screen and click Save. That’s it! You now have Google Analytics on your site tracking your visitors. You can click on the Reporting tab of Google Analytics and take the tour to see how everything works.

It can take up to 24 hours for Google to start actively reporting on your site, so don’t be alarmed if you don’t see anything right away. It doesn’t mean that you did something wrong or that nobody is on your site. To make sure that everything is working properly, click on the Admin tab of Google Analytics. Under Property you should be able to find your site and then click on Tracking Info. If the status says Receiving Data then you are good to go, even if you haven’t gotten any reports yet.

Digital Marketing Trends for 2015

10 Biggest Blogging Mistakes to Avoid at All Costs

These ten mistakes can destroy your chances of ever having success with your blog.
Brandon is a one of the top small business bloggers in the world. His small business blog (, which uses WordPress, gets over 500,000 unique visitors per month. He is the CEO of ByReputation, and has founded several multi-million dollar companies.