Google Analytics Wordpress Plugin
Important update: Due to new tracking capabilities, I released an updated Version of the Google Analytics plugin. Grab it here.
Google launched its Google Analytics Service and I took the occasion to add Google Analytics to my blog. Because changing the template is bad practice, I thought a plugin would be handy. Therefore I present the Google Analytics WP Plugin v1.1.
Installation Instructions
Just drop the google-analytics.php file into your wp-content/plugins folder and activate the plugin in the admin. Go to the “Google Analytics” options page under “Options” and set the value of the “Google Analytics Profile” to the value of the _uacct variable that’s defined in your Google Analytics Profile for your blog. (E.g. “UA-55418-1” in the case of this blog).
The plugin will then add the necessary code at the right position in the HTML header of your blog’s pages.
[Update]: Since the publishing of this plugin, I found at least three others that did the same thing as I:
So, you can even chose which plugin you want to use. I guess, mine’s by far the most “hackiest” of them all.
[Update 15.11.2005]: I updated the plugin to let you specify the “_udn” attribute as described in How do I track all of the subdomains for my site in one profile?. A new field “Domain” has been added to the admin panel. If filled-in, the value (e.g. mycvs.org in case of this blog) will be set in the script. Leave this field empty and the plugin will behave as before. As one reader pointed out: You must not put “http://” in front of the domain name.
[Update 16.11.2005]: For all those experiencing delays in analysis, here’s what Google has to say:
I have installed Google Analytics, but all or some of my data is missing from my reports.
Update: 5:22 PM PST. Tuesday, November 15th, 2005
Currently, report updating for Google Analytics is experiencing delays. As a result, you may not be seeing any data in your reports even after implementing the Analytics tracking code.
We are currently in the process of updating all reports. You should be able to see these updates in several hours. While this is going on, you may notice different reports updating at different rates. Once this process has completed, all data should be restored to your profiles. Please be assured that this update process has no effect on data collection.
We apologize for any inconvenience. This reporting delay is associated with unexpected demand for Google Analytics. Under normal circumstances, the data in your reports will be at most six hours old.
’nuff said! — Luckily, I just got my first results:

June 29th, 2006 at 10:39
Nice… it took me just 3 seconds to install, go to google analytics click on “check status” and it showed message that it all works. Thanks, very good job indeed.
June 30th, 2006 at 9:50
i have a question
in profile most be the traking code? and domain is (in my case http://www.hard-sets.nl)
can you email me.
for the answer.
July 15th, 2006 at 13:55
thanks a lot for your plug-in! i use it in my wp blog now
July 18th, 2006 at 23:12
Awesome!!! Thanks!!
July 31st, 2006 at 19:04
I installed the plug-in about 7 days ago. Google tells me it is installed correctly and gathering data but it has yet to kick in and com back with any reports. Anyone else experience this much wait time?… typically me regular sites only take about 3-4 days max.
August 18th, 2006 at 20:49
thanks
August 22nd, 2006 at 21:03
[...] Measuring traffic in such a low-traffic site as this one is probably vanity taken to an extreme, but I have tried it anyways – at least partly to understand how the various web measurements systems work. Google Analytics is a free, very comprehensive system that offers much more information than all those log analyser programs I have been trying out before. But since when I switched this blog to WordPress some time ago, I noticed a significant drop in the site visitor statistics that Google Analytics was reporting. It was only then when I realised that the Google system relies on a javascript embedded in all monitored pages, and WordPress is all database and PHP. It was not showing on the radar. Luckily, it appears that several people have figured out how to make Google Analytics work through a plugin in WordPress. I have now downloaded and activated this one from Johann Richard – lets see how it works out (and if there are actually anyone reading these notes, anyways). [...]
August 28th, 2006 at 17:43
Well, I seem to be getting lots of error messages:
Warning: Cannot modify header information - headers already sent by (output started at D:\Data\Web\vasquo.wachtel.nl\wp-content\plugins\google-analytics.php:71) in D:\Data\Web\vasquo.wachtel.nl\wp-includes\pluggable-functions.php on line 270
What could that be?
September 12th, 2006 at 10:22
[...] I switched from StatTracker to Google Anyalytics. StatTracker seems sorta adish and doesn’t seem that organized. Plus, the charts don’t show up in Camino. So I switched to Google Anyalytics. It seems a lot more professional and organized. I’m using the plugin from taking the red pill to embed the code into my pages. The only thing is my stats are gonna be a little off, but for some reason StatCounter stopped working for me and I had to reset it because of a glitch causing me to have over 10,000 views (which is impossible). I guess I can start about when I got my new theme and see how many people saw it. [...]
September 20th, 2006 at 20:58
very usefull plugin, thanks
October 28th, 2006 at 11:41
Thanks a lot for this plug-in. I need to use it in my blog.
October 28th, 2006 at 15:51
Excellent, thanks. You are still showing as the quickest path to get analytics working in a wpblog - good work!
October 29th, 2006 at 22:48
I got confused with the settings on the Wordpress dashboard, please be specific on your post, since I didn’t know if I had to put “http://” on the second field or not, but yea you don’t have to.
thank you.
December 4th, 2006 at 19:58
Photo Blocker is the solution used to block photo radar. Just spray the PHOTO BLOCKER on to your license and no photo blocker cameras can catch you. Photo Blocker infact works and will prevent any photo radar from picking up any license plate. This system is better than getting a photo radar ticket. blockradar.com has the right product.
December 12th, 2006 at 21:55
What I want to do on my blog, is every few hours take the oldest post and move it to the front of the queue, all automatically. Anyone know if there is a plugin that can do this or a simple way to set up another plugin to do this (use my own feed perhaps)? Thanks.
January 14th, 2007 at 2:18
[...] Google Analytics Easily embed Google Analytics into your blog. [...]
January 27th, 2007 at 22:48
[...] I followed the following after reading Unzip the google-anlytics.tgz file to get google-analytics.php. [...]
January 31st, 2007 at 15:58
[...] 8° - Audiência importa!? Se você não liga só para comentários, mas liga para o número de visitas, então use plugins de estatísticas como o WP-ShortStat, ou o Google Analytics Wordpress Plugin. Os dois lhe dão muito mais que o número de visitas, dão um perfil muito bom dos seus visitantes. Não precisa sujar o layout do seu blog com figuras de quantos acessos você teve. Isso importa apenas a você, não acha? O “muito” você quer só nas visitas, no layout “menos é mais”. [...]
February 18th, 2007 at 21:08
The Google Analytics tracking code has not been detected on your website’s home page. For Analytics to function, you or your web administrator must add the code to each page of your website.
it wont detect it….whats wrong?
February 19th, 2007 at 11:48
Hi ojas
Maybe you should wait some more time. The code seems to be included correctly on the page. something to check for is maybe the tracking code from Google. But I guess you entered it correctly?
Regards jr
March 6th, 2007 at 7:11
We’re looking to evaluate the different Google Analytics word press plug ins on our upcoming blog in the next few weeks. Thanks for providing this, and I’ll be sure to provide feedback!
March 7th, 2007 at 22:26
[...] I did some more digging and it turns out that there is a plugin for wordpress that adds the onclick javascript automaticly. All of this is explained here [...]
May 8th, 2007 at 2:30
[...] Google Analytics: bindet Google Analytics Code ein vorgestellt von Der Korsti [...]
May 8th, 2007 at 22:30
[...] Google Analytics Plugin (tags: wp worpress plugin) [...]
May 18th, 2007 at 13:58
[...] Google Analytics Easily embed Google Analytics into your blog. [...]
May 20th, 2007 at 9:48
[...] Visit [...]
June 11th, 2007 at 0:19
[...] Google Analytics Wordpress Plugin auf taking the red pill [...]
June 21st, 2007 at 6:02
Thanks for the plugin! I’m new to self-publishing a sites (make that people) like you are a huge help!
July 4th, 2007 at 19:07
I installed your plugin like described, but I don’t get GA to recognize the code. I get this message on the GA website: The Google Analytics tracking code has not been detected on your website’s home page.
I tried with a normal html index page and that works fine.
Please email me the answer.
Thanx in advance. Jasper
July 12th, 2007 at 0:32
http://wmwebtr-odullu-seo-yarismasi.wm-tr.com
July 29th, 2007 at 14:34
[...] taking the red pill - » Google Analytics Wordpress Plugin (tags: plugins software WordPress Google statistics) [...]
August 17th, 2007 at 6:13
Great job! I actually like the simplicity of the setup - it’ll make it easier for me to mess around with later on.
November 14th, 2007 at 23:57
[...] Google Analytics : bindet Google Analytics Code ein vorgestellt von Der Korsti, m-blog [...]
December 26th, 2007 at 1:32
[...] Google Analytics Wordpress Plugin v1.1 from taking the red [...]
January 3rd, 2008 at 10:22
[...] Google recently added a new tracking code for Google Analytics. In order to enable this, I updated my popular Google Analytics Plugin for WordPress. [...]
January 3rd, 2008 at 10:39
[...] Google Analytics Plugin [...]
February 7th, 2008 at 18:56
thanks! now i just have to wait 24hours for data to show up eh?
-shabooty
February 12th, 2008 at 2:24
Hi, I want know if the plugin add visit when the admin open the wordpress site. Or if I can choose this. Because I dont like when Google Analytics count my visits on my own blog! =P
Sorry my poor english! =D
Thanks!
February 24th, 2008 at 22:03
[...] kan de plugin hier downloaden. TOKKEL.be is een project van Seo Tips & [...]
March 20th, 2008 at 15:06
[...] Google Analytics Fügt automatisch den Google Analytics-Code auf jeder Seite ein. [...]