Sha256: faab68d6b1fa26205cd578d4174bd819e78f89414eeae942503dde6cf58c8187
Contents?: true
Size: 986 Bytes
Versions: 2
Compression:
Stored size: 986 Bytes
Contents
module AnalyticsHelper def google_analytics( opts = {} ) # if no user account code (e.g. UA-397343-10) passed along use # code from *.yml settings code = opts.fetch( :code, config.google_analytics_code ) puts " Adding JavaScript for Google Analytics tracker (#{code})..." text = <<EOS <!-- begin google-analytics #{opts.inspect} --> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', '#{code}']); _gaq.push(['_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> <!-- end google-analytics --> EOS guard_text( text ) end end # module AnalyticsHelper class Slideshow::Gen include AnalyticsHelper end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
slideshow-0.9.1 | lib/slideshow/helpers/analytics_helper.rb |
slideshow-0.9 | lib/slideshow/helpers/analytics_helper.rb |