Tags: Google, Releases, Website, WordPress
Google Analytics Plugin for Wordpress
November 14th, 2005, by Rich.

This is the first beta release of a WordPress plugin that can add Google Analytics to your website without you needing to code one single set of <>’s.
$latest = "0.65";
if ( $_GET['v'] != '' ) {
if ( $_GET['v'] != $latest ) {
echo('
‘);
}
}
?>
I have it running on this site and it seems to be working just fine so far.
Installation instructions
To use it:
- If you have a previous version of the plugin, delete it.
Download this file- Rename the file
googleanalytics.phpand copy it to your/wp-content/pluginsdirectory. - Enable it on the plugins page.
- Enter your Google Analytics User Account string (it’ll be something like UA-12345-6. It appears when you “Add a channel”)
- That’s it.
You don’t need to look alter the code in any way to make it run; of course you’re welcome to improve it and send me any updates for inclusion.
Features
- Zero Coding
A zero coding install enables both the default tracking and the use of different channels for specific posts. - Outgoing links
Track which outgoing links your users click on - i.e. the ones that don’t traditionally register in your logs. Separate tracking streams for outbound links that are in the main article, comments, and comment author URL’s
- Multiple Channels
Assign a specific channel to any article by entering the channel ID as metadata. i.e. simply type “analytics” as the metadata field name and the channel ID as the value and you can run a channel for each specific post
Requested Features
- Filtering the Sidebar
WordPress provides hooks for filtering articles and comments, but not for filtering the sidebar and footer. Since the sidebar often includes the blogroll there are page-exit clicks that cannot be tracked. If anyoen has a clean solution to filtering the sidebar then please speak up! - 100% Point’n'Click UI
I’ve asked on the forums to see if there’s away to automate the retrieval of the account id, so hopefully the plugin can become a configuration free install.
Assign a different channel ID to each category.
Versions
A historical list of releases.
Contribute
Please neatly tuck any feedback, comments, suggestions & requests onto the forum!


November 15th, 2005 at 4:45 pm
The plugin doesn’t seem to work on my block either.
Cant finde any code inserted in the mail page between the header tags?
Any ideas?
Cheers
-michael
November 15th, 2005 at 5:04 pm
Hi Michael, I just looked at the source of your blog and I notice 2 things.
1. The plugin is working (do a find on the word “urchin” and you’ll see that every externally directed link has been re-written to include a javascript call to teh google code).
2. You’re corrct that the script-bit is missing, my guess is that there is no call to wp_footer in your theme. As a workaround I’m going to change the hook in the next release to use wp_head rather than wp_footer.
Rich
November 15th, 2005 at 5:26 pm
Rich,
Thank you very much for the plugin, and for looking into my problem. :)
I’ll be waiting for that ‘fix’ :o)
-michael
November 15th, 2005 at 7:10 pm
November 15th, 2005 at 7:25 pm
I’ve just uploaded verion 0.40 to the site which shoudl fix michael’s issue of not having a blog footer.
There are also two new features, firstly, comment author URL’s are now included in the outbound link tracking and secondly, it’s now possible to assign a channel to a specific post by giving the channel if (i.e. UA-12345-6) as the valeu of an “analytics” filed in the metadata.
November 15th, 2005 at 8:24 pm
It’s spitting the correct code on my site, but Google Analytics claims not to see it. I suspect GA is sensitive to placement and wants the code to immediately follow the last meta tag. I’ll fiddle some more and let you know if I find out.
Nit: on your web site here, your link to v4.0 in the “list of releases” points to http://boakes.org/download/googleanalytics_0.30.zip instead of _0.40.zip.
Thanks for the cool plugin!
November 15th, 2005 at 8:25 pm
Thanks for the plugin - sounds great.
On clicking to enter my UA string, though, I get this message:
Fatal error: Cannot redeclare analytics_config_page() (previously declared in /home/joefoote/public_html/blogs/wp-content/plugins/googleanalytics.php:30) in /home/joefoote/public_html/blogs/wp-content/plugins/googleanalytics.php on line 29
My blogis at http://www.joefoote.com
Thanks in advance for any help!
Joe Foote
November 15th, 2005 at 8:28 pm
November 15th, 2005 at 9:37 pm
Osh, thanks for the heads up, I’ve fixed the nit. I’m fairly certain the problem will just be that Google are oversubscribed right now (which is a blinkin’ pain for testing but i suppose that’s the price of popularity!).
Joe, that’s a curious one. Have you (perhaps) installed the plugin twice? Maybe once in the directory and once not?
November 15th, 2005 at 10:16 pm
Rich,
You said, 4) Enter your Google Analytics User Account string (it’ll be something like UA-12345-6. It appears when you “Add a channel”)
Add a channel - What do you mean by that?
I have done steps 12&3, after I enabled it in the plugin screen, it
it tells me Google Analytics is not active. You must enter your
UA String to work. But where do I do that? When I click on the link I get: Fatal error: Cannot redeclare analytics_config_page() (previously declared in C:\xampplite\htdocs\wp-content\plugins\googleanalytics.php:30) in C:\xampplite\htdocs\wp-content\plugins\googleanalytics.php on line 33