In a recent post on comment link strategies I made a few mentions of Google Analytics. One of the comments left on the post asked how to go about installing Google Analytics on a WordPress blog. So in this post I’ll cover the steps to installing Google Analytics on WordPress.
Signup to Google Analytics
Obviously the first thing you will need is a Google Analytics account. Head to the Google Analytics home page and sign in with your existing Google account. If you don’t already have a Google account you can sign up for one there.

After you have signed in create a new website profile.

Add a profile for a new domain, and enter the domain name and timezone information, then click Finish.

Copy the Javascript tracking code that you are given to your clipboard or a text file and keep it to one side for now. Note the unique tracking ID that has been assigned to the new site, which is the number start with UA-. Click Save and Finish to continue.

Add the Tracking Code
Next we need to add the tracking code to the blog. There are a few different ways of doing this:
- Directly to the theme files. This lets you place it exactly where you want it (usually at the very end of the footer for performance reasons) but is easy to overlook when you change themes later on.
- Via a custom option in some premium themes. This is usually optimized for placement but again can easily be overlooked if you change themes.
- Using a plugin. Although some people don’t like adding plugins to do simple things for most people I recommend this option.
The plugin I’m going to demonstrate here is the Google Analyticator plugin. Install the plugin on your blog and activate it (click here if you aren’t sure how).
After the plugin has been activated click on Settings for the plugin.

Set logging to Enabled and enter your tracking ID (the UA- number) in the field provided.

Alternatively if you click on the link to authenticate to Google you can choose which website profile to track from a drop down list.
There are some advanced settings that you can look at if you wish to. Most of them are fine as is although if you are offering file downloads from your blog you can add the file extensions to track those downloads in Google Analytics (which doesn’t track them by default).
After you have configured the settings scroll to the bottom and click Save Changes.
Verifying Tracking Code Installation
The last step is to make sure that the tracking code is installed properly. The first place to look is in the source of the website. Open your blog home page in a web browser (or refresh the page if you already had it open) and view the source of the page. Depending on which browser you’re using the steps will vary, eg for Firefox you can simply right-click on the web page and choose View Page Source.
Look in the source code for a line that says “Google Analytics Tracking by Google Analyticator”. You will see just after it the Google Analytics tracking script with your unique tracking ID in it. Check the rest of your source to make sure there are no other instances of the tracking script in there as well.
Head back over to your Google Analytics Dashboard. On the line where you new website profile is shown click on the Edit link.
In the upper-right you will see a Check Status link. Click on that link.

If everything is installed correctly you will see a notice that data is being collected.

The first analytics data won’t show up for at least 24 hours, so now there is little to do but wait.
If you see any indications that Google Analytics is not installed or tracking correctly check out Google’s help page for some troubleshooting tips.
Image Credit: Flickr
Google Analytics Tracking by Google Analyticator
If you found this post useful please leave a comment below. To receive new blog posts automatically subscribe for free to the mailing list or RSS feed.












{ 1 comment… read it below or add one }
Thanks, this is incredibly useful stuff! I was planning to add Google Analytics support for my website and blog too. Your blog helped me a lot!