def add_google_analytics_code
      if GoogleAnalytics.defer_load
        response.body.sub! /<\/[bB][oO][dD][yY]>/, "#{google_analytics_code}</body>" if response.body.respond_to?(:sub!)
      else
        response.body.sub! /(<[bB][oO][dD][yY][^>]*>)/, "\\1#{google_analytics_code}" if response.body.respond_to?(:sub!)
      end
    end
def add_google_analytics_code
      if GoogleAnalytics.defer_load
        response.body.sub! /<\/[bB][oO][dD][yY]>/, "#{google_analytics_code}</body>" if response.body.respond_to?(:sub!)
      else
        response.body.sub! /(<[bB][oO][dD][yY][^>]*>)/, "\\1#{google_analytics_code}" if response.body.respond_to?(:sub!)
      end
    end
An after_filter to automatically add the analytics code.
 If you intend to use the link_to_tracked view helpers, you need to set Rubaidh::GoogleAnalytics.defer_load = false
 to load the code at the top of the page
 (see http://www.google.com/support/googleanalytics/bin/answer.py?answer=55527&topic=11006)