Module: Ratel::Tracking::GoogleAnalytics

Defined in:
lib/ratel/tracking/google_analytics.rb

Instance Method Summary collapse

Instance Method Details

#push(*args) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/ratel/tracking/google_analytics.rb', line 5

def push *args
  options = args.extract_options!
  s = "_gaq.push(['_trackEvent', '#{options[:category]||args[0]}', '#{options[:action]||args[1]}', '#{options[:label]||args[2]}'"
  s << ", #{options[:value]}"          if options.key? :value
  s << ", #{options[:noninteraction]}" if options.key? :noninteraction
  s << "]);"
  s.html_safe
end