Class: Rack::Tracker::GoogleAnalytics
- 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
Instance Method Summary collapse
- #ecommerce_events ⇒ Object
- #enhanced_ecommerce_events ⇒ Object
-
#initialize(env, options = {}) ⇒ GoogleAnalytics
constructor
A new instance of GoogleAnalytics.
- #pageview_url_script ⇒ Object
- #tracker ⇒ Object
Methods inherited from Handler
#dnt_header_opt_out?, #events, #handler_name, #inject, process_track, #render, track, #tracker_options, #write_event
Methods included from JavaScriptHelper
Constructor Details
#initialize(env, options = {}) ⇒ GoogleAnalytics
Returns a new instance of GoogleAnalytics.
5 6 7 8 |
# File 'lib/rack/tracker/google_analytics/google_analytics.rb', line 5 def initialize(env, = {}) [:explicit_pageview] = true if !.has_key?(:explicit_pageview) super(env, ) end |
Instance Method Details
#ecommerce_events ⇒ Object
65 66 67 |
# File 'lib/rack/tracker/google_analytics/google_analytics.rb', line 65 def ecommerce_events events.select {|e| e.kind_of?(Ecommerce) } end |
#enhanced_ecommerce_events ⇒ Object
69 70 71 |
# File 'lib/rack/tracker/google_analytics/google_analytics.rb', line 69 def enhanced_ecommerce_events events.select {|e| e.kind_of?(EnhancedEcommerce) } end |
#pageview_url_script ⇒ Object
73 74 75 |
# File 'lib/rack/tracker/google_analytics/google_analytics.rb', line 73 def pageview_url_script [:pageview_url_script] || 'window.location.pathname + window.location.search' end |
#tracker ⇒ Object
61 62 63 |
# File 'lib/rack/tracker/google_analytics/google_analytics.rb', line 61 def tracker [:tracker].respond_to?(:call) ? [:tracker].call(env) : [:tracker] end |