public
Description: Rack::GoogleAnalytics is middleware for embedding tracking code
Homepage: http://github.com/ambethia/rack-google_analytics
Clone URL: git://github.com/ambethia/rack-google_analytics.git
name age message
file .document Thu Aug 13 08:55:22 -0700 2009 Initial commit to rack-google_analytics. [ambethia]
file .gitignore Thu Aug 13 08:55:22 -0700 2009 Initial commit to rack-google_analytics. [ambethia]
file LICENSE Thu Aug 13 08:55:22 -0700 2009 Initial commit to rack-google_analytics. [ambethia]
file README.rdoc Thu Aug 13 17:17:15 -0700 2009 Vanity [ambethia]
file Rakefile Wed Oct 14 07:32:36 -0700 2009 Gemcutter [ambethia]
file VERSION Wed Oct 14 07:41:44 -0700 2009 Version bump to 1.0.1 [ambethia]
directory lib/ Wed Nov 04 08:55:34 -0800 2009 Updated code to allow multiple top level domains [jeremyf]
file rack-google_analytics.gemspec Wed Nov 04 08:55:34 -0800 2009 Updated code to allow multiple top level domains [jeremyf]
directory test/ Wed Nov 04 08:55:34 -0800 2009 Updated code to allow multiple top level domains [jeremyf]
README.rdoc

Rack::GoogleAnalytics

Rack middleware to embed Google Analytics tracking code.

Usage

  require "rack/google_analytics"

  use Rack::GoogleAnalytics, :web_property_id => "UA-000000-1"

  app = lambda { |env| [200, { 'Content-Type' => 'text/html' }, '<html><body></body></html>'] }
  run app

Configuring for a Rails App

  config.gem "ambethia-rack-google_analytics", :lib => "rack/google_analytics", :source => "http://gems.github.com"
  config.middleware.use "Rack::GoogleAnalytics", :web_property_id => "UA-0000000-1"

TODO and Motivations

This isn’t very "feature rich", because I’ve mostly written it as an excuse to learn more about rack. Hell, it’s possible someone has already done it (and better); I didn’t bother to look. See the notes below on contributing fixes for these deficiencies.

Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so I don’t break it in a future version unintentionally.
  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
  • Send me a pull request. Bonus points for topic branches.

Copyright

Copyright © 2009 Jason L Perry. See LICENSE for details.