How to Add Google Analytics to Your WordPress Site

google analyticsKeeping track of your traffic stats is important to most website owners and Bloggers. One way to keep track of them is to add Google Analytics to your WordPress site.

There are a few different ways in which you can accomplish this. The way that I am going to show you, is by adding the Javascript code into the header.php file of your WordPress site.

Google Analytics

If you don’t already have a Google Analytics account., you will need to set one up. Once you set up your account, you will be asked to create a new Website Profile for your site. You will then be given the Javascript code. This is the code that you will be adding to your header.php file in your WordPress site.

Adding Javascript Code to Your WordPress Site

In the dashboard of your WordPress site, click on Appearance. In the drop down menu that appears, click on Editor. In the Editor, scroll down the list on the far right hand side until you find the header.php file and click on it.

A window similar to the one below will open.


Paste your Google Analytics code right before the </head> tag, which I have underlined in red in the image. Make sure you click on the blue Update File button at the bottom of your header.php file when you are done pasting your code.

Once you have updated your header.php file, head back over to your Google Analytics account and check to make sure that the code was installed properly. Google will let you know instantly if they detect the javascript code on your site. If you have installed the code correctly, Google will start collecting the data it needs in order to show your stats.

It will take at least 24 hours before your will start to see the data that has been collected for your site.

Photo of Laurie LambertLaurie Lambert is a web designer, graphic designer and author of Affiliate Marketing – Getting Started – A Beginner’s Guide. Connect with Laurie on Google+.

Please leave a comment below. I’d love to hear from you.

Commenting Policy

Please Read: If you want to have your comment approved, you must leave your real name in the name field.

Leave a Reply