Module: Rubaidh::GoogleAnalyticsMixin

Defined in:
lib/rubaidh/google_analytics.rb

Instance Method Summary collapse

Instance Method Details

#add_google_analytics_codeObject

An after_filter to automatically add the analytics code. Add the code at the top of the page to support calls to _trackPageView (see http://www.google.com/support/googleanalytics/bin/answer.py?answer=55527&topic=11006)



10
11
12
# File 'lib/rubaidh/google_analytics.rb', line 10

def add_google_analytics_code
  response.body.sub! '</body>', "#{google_analytics_code}</body>" if response.body.respond_to?(:sub!)
end

#google_analytics_codeObject



3
4
5
# File 'lib/rubaidh/google_analytics.rb', line 3

def google_analytics_code
  GoogleAnalytics.google_analytics_code(request.ssl?) if GoogleAnalytics.enabled?(request.format)
end