Class: Rack::Tracker::GoogleAnalytics

Inherits:
Handler
  • Object
show all
Defined in:
lib/rack/tracker/google_analytics/google_analytics.rb

Defined Under Namespace

Classes: Ecommerce, EnhancedEcommerce, Parameter, Send

Constant Summary

Constants included from JavaScriptHelper

JavaScriptHelper::JS_ESCAPE_MAP

Instance Attribute Summary

Attributes inherited from Handler

#env, #options

Instance Method Summary collapse

Methods inherited from Handler

#dnt_header_opt_out?, #events, #handler_name, #initialize, #inject, process_track, #render, track, #tracker_options, #write_event

Methods included from JavaScriptHelper

#escape_javascript

Constructor Details

This class inherits a constructor from Rack::Tracker::Handler

Instance Method Details

#ecommerce_eventsObject



60
61
62
# File 'lib/rack/tracker/google_analytics/google_analytics.rb', line 60

def ecommerce_events
  events.select {|e| e.kind_of?(Ecommerce) }
end

#enhanced_ecommerce_eventsObject



64
65
66
# File 'lib/rack/tracker/google_analytics/google_analytics.rb', line 64

def enhanced_ecommerce_events
  events.select {|e| e.kind_of?(EnhancedEcommerce) }
end

#pageview_url_scriptObject



68
69
70
# File 'lib/rack/tracker/google_analytics/google_analytics.rb', line 68

def pageview_url_script
  options[:pageview_url_script] || 'window.location.pathname + window.location.search'
end

#trackerObject



56
57
58
# File 'lib/rack/tracker/google_analytics/google_analytics.rb', line 56

def tracker
  options[:tracker].respond_to?(:call) ? options[:tracker].call(env) : options[:tracker]
end