Parsing Google Analytics data with Ruby
The google analytics api come out a few days ago, meaning we can do some cool things with integrating stats data into web apps.
It should be pretty easy to show the number of page views or the most popular browsers in your templates, or even change the amount of advertising depending on the popularity of the page.
A couple of ruby gems have been created gattaca and garb to make it really easy to interface with the api, so I’ve put together a couple of examples to get you started.
Top 10 pages in the past day
The first one is nice and simple, setting up a few options then looping through the results to display the url and number of page views for each.
Graph of hits on the homepage for past month
This one uses the sparklines gem to draw a line graph of the hits on a particular url (’/’ in this example) over the past 30 days.
Neither of these scripts are particularly fast so if you’re planning on using them in a web page be sure to fragment cache them.
It will be really interesting to see how this data is used in the future, maybe we’ll even see self-tuning web sites!
Pragmatic Programming book sale
I’ve just listed some of my pragmatic programmer books for sale on amazon, including Prototype and script.aculo.us, My Job Went to India: 52 Ways to Save Your Job and Pragmatic Version Control: Using Subversion
Each one is very well written, and a perfect way to help advance your skills and career in web development, either in a specific topic (interface design, version control, ruby on rails) or more general advise in how to become a better programmer.
They are all in very good condition, will be delivered within 3 days of purchase and all the proceeds from the sales will go towards helping me further develop my own skills.
Segway Rally
This saturday I went segway rallying with mike, I had a great time, although I did sprain my arm in a pretty big crash, see the video below.
I took my new flip ultra video camera (a bargain at £45 from ebay) and duck taped it to the handlebars of the segway.
I wasn’t really expecting much from it, but it out did itself, the simplicity of the interface makes it easy to pickup and shoot, then easily import it into iMovie, plus at such a low price I’m not to worry about destroying it so I can get some great footage that most people wouldn’t usually risk.
If you’ve not rode a segway before, I highly recommend it. It’s like nothing else and so easy to get the hang of, you’ll be flying around like a pro after 5 minutes. The rally was provided by Seghire, it’s £69 for two and last about 2 hours, with everything you need included.
Also, on the time trial lap we each did at the end I was the quickest (47s), including being a whole second faster than the instructor!







