Recommended Services

How To Install Google Analytics On A Wordpress Blog

By Pete Moore


In this tutorial I will teach you how to install Google analytics on a wordpress blog.

Step One

You will need a free Google analytics account, you don’t need a gmail email address you can sign up with any email address. If you already have a analytics account login if you need one sign up for free.

Go to the Google analytics home page here.

Google Analytics Home Page

Step Two

Once logged in you need to create a new website profile.

There are 2 locations you can do this first is on the right side of the screen:

Add Website Profile Location 1

Or you can scroll to the bottom of the page and click the following add website profile link:

Add Website Profile Location 2

Either will take you to the create new website profile page.

Add a Profile for a new domain is selected by default which is correct.

Enter the URL of your blog. If you have installed your wordpress blog in the root you will enter your domain name (e.g. yourblogbuilder.com). If you have installed your blog in a sub directory as I have done in this tutorial you will need to add the sub directory also (e.g. yourblogbuilder.com/demo/).

Click finish when you have completed entering the details.

Create New Website Profile Page

Step Three

After you click finish you will be taken to the tracking code page. Scroll down the page and you will see the code you need to enter into your blog.

Highlight and copy all of the code.

Google Analytics Code

Scroll down to the bottom page and click save and finish.

Step Four

Open a new browser window or tab and log into your wordpress admin panel.

Click Appearance then click Editor. On the right side of your screen you will now see all the file names related to your current theme under the heading Theme Files.

Locate the footer.php file in the list of files and click it.

footer.php file option

You should now see in the middle of your screen under Edit Themes heading footer.php below that in the window you can see the php code for the footer.php file.

Scroll down to the bottom of that window and locate the close body tag as shown below:

Close Body Tag

You need to paste the google analytics code above that close body tag.

So put your cursor next to the close div tag and press enter to create an empty line above the close body tag.

Paste your google analytics code in the blank line you just created.

It should now look something like this:

Inserted Google Analytics Code

Scroll down and click update file.

Step 5

Go back to your Google analytics account. Click on the edit link at the end of your website profile:

Edit Google Analytics Profile

It may say tracking not installed click on the check status link:

Check Status In Google Analytics

Google will now go and check to see if it can find the code installed.

I have had times where I have had to leave it until the next day before it picks up the code so if it doesn’t work straight away leave it until the next day and check again.

If your tracking status shows waiting for data then congratulations you have successfully installed Google analytics on your wordpress blog.

(IMPORTANT) If you change your wordpress theme you will need to reinstall Google analytics.

Tools used in this wordpress tutorial:

Google Analytics

Categories : Wordpress Analytics

Comments

  1. Tom says:

    I use Google Analytics regularly for all my sites. It’s amazing how far you can actually dig into your data. The problem is though that lots users just use the bare bones without realising the flexibility and the raw information you can extract from it.

    Tom

Leave a Reply