Module: JonathanNelson::WoopraAnalyticsMixin

Defined in:
lib/jonathannelson/woopra_analytics.rb

Instance Method Summary collapse

Instance Method Details

#add_woopra_analytics_codeObject

An after_filter to automatically add the analytics code.



8
9
10
11
12
13
14
# File 'lib/jonathannelson/woopra_analytics.rb', line 8

def add_woopra_analytics_code
  if WoopraAnalytics.defer_load
    response.body.sub! '</body>', "#{woopra_analytics_code}</body>" if response.body.respond_to?(:sub!)
  else
    response.body.sub! '<body>', "<body>#{woopra_analytics_code}" if response.body.respond_to?(:sub!)
  end
end

#woopra_analytics_codeObject



3
4
5
# File 'lib/jonathannelson/woopra_analytics.rb', line 3

def woopra_analytics_code
  WoopraAnalytics.woopra_analytics_code(request.ssl?) if WoopraAnalytics.enabled?(request.format)
end