Sha256: 2135d1e5146537733f741aa476bd570f1b28b6d6d9aaa68568f7bd8ec3986d4f

Contents?: true

Size: 1.02 KB

Versions: 38

Compression:

Stored size: 1.02 KB

Contents

module Slideshow
  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_block( text )             
end
  
  
end #   module AnalyticsHelper
end # module Slideshow


class Slideshow::Gen
  include Slideshow::AnalyticsHelper
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
slideshow-2.0.1 lib/slideshow/helpers/analytics_helper.rb
slideshow-2.0.0 lib/slideshow/helpers/analytics_helper.rb
slideshow-1.2.5 lib/slideshow/helpers/analytics_helper.rb
slideshow-1.2.4 lib/slideshow/helpers/analytics_helper.rb
slideshow-1.2.3 lib/slideshow/helpers/analytics_helper.rb
slideshow-1.2.2 lib/slideshow/helpers/analytics_helper.rb
slideshow-1.2.1 lib/slideshow/helpers/analytics_helper.rb
slideshow-1.2.0 lib/slideshow/helpers/analytics_helper.rb
slideshow-1.2.0.beta5 lib/slideshow/helpers/analytics_helper.rb
slideshow-1.2.0.beta4 lib/slideshow/helpers/analytics_helper.rb
slideshow-1.2.0.beta3 lib/slideshow/helpers/analytics_helper.rb
slideshow-1.2.0.beta2 lib/slideshow/helpers/analytics_helper.rb
slideshow-1.2.0.beta1 lib/slideshow/helpers/analytics_helper.rb
slideshow-1.1.0 lib/slideshow/helpers/analytics_helper.rb
slideshow-1.1.0.beta8 lib/slideshow/helpers/analytics_helper.rb
slideshow-1.1.0.beta7 lib/slideshow/helpers/analytics_helper.rb
slideshow-1.1.0.beta6 lib/slideshow/helpers/analytics_helper.rb
slideshow-1.1.0.beta5 lib/slideshow/helpers/analytics_helper.rb
slideshow-1.1.0.beta4 lib/slideshow/helpers/analytics_helper.rb
slideshow-1.1.0.beta3 lib/slideshow/helpers/analytics_helper.rb