How To Install Google Analytics On WordPress Blog

By | February 13, 2015

For those of you just starting with WordPress, you may be wondering where’s the best place to put your code, and how to install Google Analytics on WordPress. Having Analytics and traffic data of your blog is very important to every internet marketer, or anyone with a website. It allows you to see where your visitors are coming from, which pages are popular and trending, bounce rate, and detailed user activity. This is all very valuable information. For example, if you have a niche website but notice you are getting a lot of traffic from a long tail keyword or “sub-niche” within your main niche, then perhaps it would be worth perusing that keyword even further. An even more detailed example would be, say you had a “celebrity gossip” website. You check your Analytics and notice that most if not all your pages with the keyword ‘Paris Hilton’ are getting more traffic than the other pages. Obviously this is a trending topic and keyword, people want to know more about it. You would then add more content and pages relating to that keyword (in this case, Paris Hilton), then BAM. You get more traffic.

I can’t¬†emphasize enough the importance of having detailed traffic data of your website. When used correctly, this information is as good as GOLD!

Now back to the topic at hand..

WordPress DOES have it’s own built-in analytics program inside the Jetpack plugin, which is fine for most people, but it doesn’t quite have the detailed information like GA. While using Jetpack’s “Site Stats”, I also noticed it had a hard time recognizing some of the used search terms. Often times just saying “Unknown Search Terms”.¬†We need to know HOW people are finding our website, so we can then EXPAND on it.

There are also WordPress plugins you can download that make adding your Google Analytics a whole lot easier. Literally as easy as installing the plugin and just pasting your code into it. (For example: Google Analytics WordPress Plugin)

But this article is not about that. This is for those who want to install their Google Analytics code the old school way, without the use of a baby-sitter plugin.

How To Install Google Analytics On WordPress Blog

For the sake of this article, I’m going to assume you already have your Google Analytics code. If not, log into your Google account or go create one. I’m going to make this brief.

Inside the Admin panel, create a new account.

Google Analytics Create New Account

Fill out the necessary information then click the “Get ID” button. Your code should look something like this:

(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

ga(‘create’, ‘UA-CODE-1’, ‘auto’);
ga(‘send’, ‘pageview’);


Okay. Now that we have our code it’s time to paste it into our WordPress blog. But where do we do this you ask? Simple!

Head back over into your WordPress control panel and click on Appearance > Editor

On the right hand side you should see all your PHP template and CSS files. Find your header.php, then click on it to edit. Depending on your theme, your header file may be named something different. Alternatively, you can also edit the footer.php file as well.

If you are able to edit your header.php, paste the code right under the opening <body> tag. This is the best and recommended way (for SEO purposes). If you have to do it using the footer file, paste it before the closing </body> tag. Then of course, save your changes.

Wordpress Header File

After that, you’re all set! Give the Google Analytics code some time to collect traffic data, then check your GA account a little while later to analyze it.

I hope this article was helpful, and you were able to install Google Analytics on WordPress easily. If you have any further questions, feel free to contact us.

(Visited 70 times, 1 visits today)