Close and Go BackBack to Viget

Introducing

Updated Garb: Even Easier Access to the Google Analytics API

Tony Pitale
Tony Pitale, Web Developer, May 04, 2009 3

In my introductory post, I explained what Garb was, and how it could be useful to those wishing to get access to their Google Analytics data. In this post, I would like to introduce the latest version of Garb (0.2.1 as of this writing) and explain the many changes and new ways to use Garb to get at your data.

Getting sessions and profiles is still exactly the same.

  Garb::Session.login('username', 'password')
  profile = Garb::Profile.all.first

What's new in 0.2.1 is the way in which reports are built and results are retrieved. Check it out:

As a Report Class

  class Exits
    include Garb::Resource

    metrics :exits, :exit_rate
    dimensions :request_uri
  end

Getting the Results with a Class

  Exits.results(profile, :limit => 10,
                         :offset => 20,
                         :start_date => (Date.today - 30),
                         :end_date => Date.today)

  # With Filtering and Sorting

  Exits.results(profile) do
    filter :request_uri.contains => 'fun', :exits.gte => 1000
    sort :exit_rate
  end

One-off Report

  report = Garb::Report.new(profile)
  report.metrics :exits, :exit_rate
  report.dimensions :request_uri

  # With Filtering and Sort

  report.filter :request_uri.contains => 'fun'
  report.filter :exits.gte => 1000
  report.sort :exit_rate.desc

  # Getting Results

  report.results(:limit => 10,
                 :offset => 20,
                 :start_date => (Date.today - 30),
                 :end_date => Date.today)

The results returned from Garb will be OpenStructs with methods for each of the metrics and dimensions in an array.

  results.exits       #=> 1234
  results.exit_rate   #=> 0.20423810234
  results.request_uri #=> '/some/fun/url/to/a/page'

Overall, we feel that the improvements are solid and make more sense. Be warned: if you've used a previous version of Garb, then updating to the latest version will very likely break most of what was done previously. I hope everyone can find a use for this, and I encourage all to check out the project on Github and to read the documentation in the Wiki.

Introducing Garb: Access the Google Analytics Data Export API with Ruby

Tony Pitale
Tony Pitale, Web Developer, April 24, 2009 8

Since Google announced that they would be releasing an API for their de-facto analytics tools I was pained with the effort to contain my excitement. The results were a reporting tool and a new gem: Garb.

Continue reading "Introducing Garb: Access the Google Analytics Data Export API with Ruby"

Progressive Caching In-Depth

Ben Scofield
Ben Scofield, Technology Director, April 23, 2009 5

Recently, I've been presenting on a technique that takes advantage of Rack support in Rails to revitalize page caching; I've taken to calling it "progressive caching."  There are a couple of places around the web where you can find an introduction to the topic, but this post will go into significantly more depth.

Note: This technique isn't particularly new (I've seen at least one blog post from 2007 about it), though some of the advances in Rails make it more effective. As far as I can tell, however, it hasn't really been explored in depth, but I welcome disagreement on that point!

Continue reading "Progressive Caching In-Depth"

Rails Authentication Plugin: simplest_auth

Tony Pitale
Tony Pitale, Web Developer, January 09, 2009 6

simplest_auth is a plugin for Rails applications where RESTful Authentication is overkill – it handles authentication and nothing else.

Continue reading "Rails Authentication Plugin: simplest_auth"

Radarb: A Ruby Gem That Makes Using the Outside.in API Simple

Justin Marney
Justin Marney, Web Developer, January 08, 2009 1

What is outside.in?

Outside.in is a hyperlocal news and information service:

Hyperlocal means news and information on a level beyond what traditional media provides. Until now, most "local" sites didn’t actually get more, well, local than cities or towns. They assumed that just because you live in a specific city or town you are looking for the same news as everyone else. Hyperlocal content gives you the news and information for the area right around where you are, like the block around your office or the neighborhood where you live.

What is outside.in Radar?

outside.in Radar is the first local news experience that puts you at the center of the action. It is customized to exactly where you are and what’s going on right around you.

Examples include tweets, news stories, and blog posts in your immediate area (surrounding blocks or neighborhoods).

What is the outside.in Radar API?

The outside.in API is a means by which developers can easily integrate Radar results into their own applications. Send it a latitude and longitude and get back stories, tweets, and other outside.in user-generated content for the surrounding area. A sample query returns XML that looks like:

Continue reading "Radarb: A Ruby Gem That Makes Using the Outside.in API Simple"

We're the Developers

at Viget Labs. We write about web development trends, tips, best practices, industry events, and our projects — all with an emphasis on Ruby on Rails.

Recent Comments

For translating strings you can use Rails I18n backend instead of using inflectors.

The `typus_human_name` is a patch to fix a problem in `human_name` [1].

[1] https://rails.lighthouseapp.com/projects/8994/tickets/2120-humanize-and-human_name-dont-separate-words

Contact Us

Have any questions, comments, ideas, or secrets to share? Let us know.


Sorry, you need to have Javascript enabled to use this form. (Don't blame us, blame the spammers!) If you'd like to contact us, please visit our Contact page.