Wordpress & Google Analytics

Few weeks ago I wrote a post on this subject. If you didn’t read it you can find it here.

In that post, I was talking about 2 different ways of integrating google analytics with your wordpress blog. One was by editing your theme files and the other one by using a plugin (actually in reversed order). Well, the problem is now that those guys that wrote the plugin are not giving it away anymore to the public, but integrated it in a bigger software package and are selling it for $295 (I’d say it’s a little too high for many people’s budget).

I noticed that few days ago when a reader of this blog told me I was pointing to an expensive software as being free so I had to tweak the post a little.

Anyway, the point is I’ll write my own plugin very soon (I plan to release it at the end of this week) so if you want to grab it when it’s up, just leave your email in the box you can see in the upper right corner and I’ll shoot you a message when it’s the time.

Take care

How to Add Google Analytics to Wordpress

Google Analytics is still the most used traffic analysis tool on the planet, although it seems a little bit old and slow for these times (it loads at a slow speed and shows the actual data few hours after any events occur on your website … ). Wordpress & Google Analytics can work well together if you do it right.

Right now I’m using a plugin to add google analytics to my website, but there are few other ways to do that, depending on your imagination :).

First, let’s talk a little about this plugin. You can download it for free here.

Next, upload it to your “wp-content/plugins” folder and activate it from your plugins page in wp-admin. Once this plugin is active, you will have a new button in your settings sub-menu. Click on it and you’ll see this screen:

Wordpress Google Analytics

Here you can paste your google analytics code. Please note that this plugin works with the old version of GA as I marked with red in the screenshot (I hope in the near future we’ll have a version that will support the latest script from google). Hit update options and you’re done.

Another thing, if you’re logged in, this plugin won’t show the code in your page, so if you want to check it’s there, you need to logout first.

A second option would be to edit the theme files. This is good and bad at the same time. Good because you don’t have to get stuck with uploading plugins and so on, and it’s bad because it won’t work once you update your theme (or switch to another one). So it’s up to you if you use this method or not.

Here’s how to do this: first, you have to know what files from a WordPress theme are used always. These files are the header and the footer (the others might be used or not while user navigates on your website). Therefore, you may put the google analytics code inside one of those 2 files. I recommend editing the footer.php file because google instructions say that you have to place their code before the </body> tag. We’ll do so.

To edit your footer.php file, go to “Design” \ “Theme editor” and select “footer.php” from the right column. Once it’s loaded in the textarea, paste your code before the </body> tag, just like in the image below and hit the “Update file” button.

Wordpress Google Analytics

That’s it. You have installed Google Analytics on your WordPress Blog.

- Peter

(You can find an update for this post here)

  
Google Analytics integration offered by Wordpress Google Analytics Plugin

Hey, sorry to hear that!

Do you want to see this message again while on this website?
(pick an option)