ArticlesForumDownload AboutContact

boakes.org

nice of you to drop by. tea?

Tags: Google, Releases, Website, WordPress

Google Analytics Plugin for Wordpress

November 14th, 2005, by Rich.

Google Analytics Plugin for Wordpress

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('

You appear to be using an older version of the plugin. You may wish to download the latest version.

‘);
}
}
?>

I have it running on this site and it seems to be working just fine so far.

Installation instructions

To use it:

  1. If you have a previous version of the plugin, delete it.
  2. Download this fileDownload this file
  3. Rename the file googleanalytics.php and copy it to your /wp-content/plugins directory.
  4. Enable it on the plugins page.
  5. Enter your Google Analytics User Account string (it’ll be something like UA-12345-6. It appears when you “Add a channel”)
  6. 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
    A graph showing clicks on outbound links - something not possible with stats based on server logs alone
  • 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.
  • Per Category Channels
    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!

    313 Responses to “Google Analytics Plugin for Wordpress”

    Pages: «123456789101132»

    1. 11
      Michael Hansen Says:

      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

    2. 12
      Rich Says:

      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

    3. 13
      Michael Hansen Says:

      Rich,

      Thank you very much for the plugin, and for looking into my problem. :)

      I’ll be waiting for that ‘fix’ :o)

      -michael

    4. 14
      Trackback from: konfabulieren»Blog Archive » Google Analytics
    5. 15
      Rich Says:

      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.

    6. 16
      Osh Says:

      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!

    7. 17
      Joe Foote Says:

      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

    8. 18
      Trackback from: Lvx ex Caelis » Google Analytics Plugin for Wordpress
    9. 19
      Rich Says:

      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?

    10. 20
      Mike Bowen Says:

      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

    Pages: «123456789101132»