Sha256: 2dfa0c62f20b6cb0b7cb00303733a870b02f97657d63a75ff0c5099956091f80
Contents?: true
Size: 1.05 KB
Versions: 2
Compression:
Stored size: 1.05 KB
Contents
module Analytical module Google class Api include Analytical::Base::Api def initialize(parent, options={}) super @tracking_command_location = :head_append end def init_javascript(location) init_location(location) do js = <<-HTML <!-- Analytical Init: Google --> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', '#{options[:key]}'], ['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> HTML js end end def track(*args) "_gaq.push(['_trackPageview'#{args.empty? ? ']' : ', "' + args.first + '"]'});" end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
analytical-1.5.0 | lib/analytical/google.rb |
analytical-1.4.0 | lib/analytical/google.rb |