1- require " split/helper"
1+ require ' split/helper'
22
33module Split
44 module Analytics
5- def tracking_code ( options = { } )
5+ def tracking_code ( options = { } )
66 # needs more options: http://code.google.com/apis/analytics/docs/gaJS/gaJSApi.html
77 account = options . delete ( :account )
88 tracker_url = options . delete ( :tracker_url )
@@ -26,15 +26,15 @@ def tracking_code(options={})
2626 })();
2727 </script>
2828 EOF
29- code = raw ( code ) if defined? ( raw )
29+ code = raw ( code ) if defined? ( raw )
3030 code
3131 end
3232
3333 def custom_variables
3434 return nil if ab_user . nil?
3535 arr = [ ]
36- ab_user . each_with_index do |h , i |
37- arr << "_gaq.push(['_setCustomVar', #{ i + 1 } , '#{ h [ 0 ] } ', '#{ h [ 1 ] } ', 1]);"
36+ ab_user . each_with_index do |h , i |
37+ arr << "_gaq.push(['_setCustomVar', #{ i + 1 } , '#{ h [ 0 ] } ', '#{ h [ 1 ] } ', 1]);"
3838 end
3939 arr . reverse [ 0 ..4 ] . reverse . join ( "\n " )
4040 end
@@ -44,25 +44,25 @@ def custom_variables
4444 def insert_tracker_methods ( tracker_methods )
4545 return nil if tracker_methods . nil?
4646 arr = [ ]
47- tracker_methods . each do |k , v |
47+ tracker_methods . each do |k , v |
4848 if v . class == String && v . empty?
4949 # No argument tracker method
5050 arr << "_gaq.push(['" + "_" + "#{ k } ']);"
5151 else
5252 case v
5353 when String
5454 # String argument tracker method
55- arr << "_gaq.push(['" + "_" + "#{ k } ', '#{ v } ']);"
55+ arr << "_gaq.push(['" + '_' + "#{ k } ', '#{ v } ']);"
5656 when TrueClass
5757 # Boolean argument tracker method
58- arr << "_gaq.push(['" + "_" + "#{ k } ', #{ v } ]);"
58+ arr << "_gaq.push(['" + '_' + "#{ k } ', #{ v } ]);"
5959 when FalseClass
6060 # Boolean argument tracker method
61- arr << "_gaq.push(['" + "_" + "#{ k } ', #{ v } ]);"
61+ arr << "_gaq.push(['" + '_' + "#{ k } ', #{ v } ]);"
6262 when Array
6363 # Array argument tracker method
6464 values = v . map { |value | "'#{ value } '" } . join ( ', ' )
65- arr << "_gaq.push(['" + "_" + "#{ k } ', #{ values } ]);"
65+ arr << "_gaq.push(['" + '_' + "#{ k } ', #{ values } ]);"
6666 end
6767 end
6868 end
0 commit comments