Displaying Google Analytics Statistic Using Geektools

I like to know how my blog is doing traffic wise. It helps to know if any articles is becoming popular. To save me logging in to Google Analytics everyday i decided to create a script which i could then use to display this information on my desktop using Geektools. I decided to simply call this script ga_request.

You will need ruby to run this script, as far as i know all modern macs have this installed already.

First download and unzip ga_request file to your mac

Download ga_request

Before you can use this script you need to install gattica by running:

sudo gem install cannikin-gattica -s http://gems.github.com

Next ensure that the script has permission to execute.

Now you can setup geektools to display analytics information using the following command:

ruby /path/to/ga_request.rb -u google_email -p google_password -i profile_id -r results_to_display

The script has the following switches:

-u Your google account email as you use to login to your analytics account
-p The password you use to login to your analytics account
-i This is the profile id of the site you want to look at. This is not the UA number but can be found in the url when looking at the dashboard. https://www.google.com/analytics/reporting/?reset=1&id=12341234&pdr=20100323-20100422
-r The result set you want to return this can be visitors, pageviews or pageviews_per_page

Feel free to use the script and change it to suit your needs.



Wednesday, May 5th, 2010
Graham
Tags: , , ,

9 Responses to Displaying Google Analytics Statistic Using Geektools

  1. MIndaugas says:

    I found problem runing script :(
    Error message: undefined method `lt’ for nil:NilClass (NoMethodError)
    Can help solve this problem?

  2. Graham says:

    Hi thanks for you message letting me know you had a problem, i apologise for this. Unfortunatly the error you have posted does not help much do you have a line number for the line this appears from.

  3. Hi,
    Use Geektool for a long time now and I’m very interested in using this script. However , I’ve tried installing Gattica using the command you provide, and i get these errors :

    ERROR: http://gems.github.com/ does not appear to be a repository
    ERROR: could not find gem cannikin-gattica locally or in a repository

    Could you help me installing that , please ? Would be much appreciated .

    Cheers

  4. Graham says:

    It sounds like perhaps you have an older version of rubygems. Run the following command gem –version from the terminal at let me know the output.

  5. Thanks for fast answer :)
    result to the gem -v command is :
    1.3.5

  6. OK , don’t bother. I was behind a proxy, that’s why it couldn’t get cannikin-gattica. Got it now, and it work fine. Thanks again for this script.

  7. Pingback: Link dump for March 26th through April 6th | The Queue Incorporated

  8. skimmas says:

    This script does not return any results. Any guess whats happening?

  9. Fdo says:

    Would you please tell me why It doesn’t work for me:

    WHAT I DID:
    1) I installed cannikin-gattica
    2) chmod 755 the script
    3) Downloaded: http://www.macosxtips.co.uk/geeklets/modules/upload/attachments/ganalytics-pageviews.glet
    4) Opened the glet with geektool
    5) entered MY own parameter in the command box for
    ruby /path/to/ga_request.rb -u google_email -p google_password -i profile_id -r results_to_display

    RESULT:
    -Nothing… just the status “led” indicator.
    -Status image is “success” one; if I try running the script in my terminal, I get no output, but no error neither.

    MY SETUP:
    -Mac OS X: 10.6.7
    -Darwin kernel version:10.7.4
    -Ruby version: 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin10.7.4]

    thanks!

    F.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>