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-1.1.0.beta2 lib/slideshow/helpers/analytics_helper.rb
slideshow-1.1.0.beta1 lib/slideshow/helpers/analytics_helper.rb
slideshow-1.0.5 lib/slideshow/helpers/analytics_helper.rb
slideshow-1.0.4 lib/slideshow/helpers/analytics_helper.rb
slideshow-1.0.3 lib/slideshow/helpers/analytics_helper.rb
slideshow-1.0.2 lib/slideshow/helpers/analytics_helper.rb
slideshow-1.0.1 lib/slideshow/helpers/analytics_helper.rb
slideshow-1.0.0 lib/slideshow/helpers/analytics_helper.rb
slideshow-0.9.11 lib/slideshow/helpers/analytics_helper.rb
slideshow-0.9.10 lib/slideshow/helpers/analytics_helper.rb
slideshow-0.9.9 lib/slideshow/helpers/analytics_helper.rb
slideshow-0.9.8 lib/slideshow/helpers/analytics_helper.rb
slideshow-0.9.7 lib/slideshow/helpers/analytics_helper.rb
slideshow-0.9.6 lib/slideshow/helpers/analytics_helper.rb
slideshow-0.9.5 lib/slideshow/helpers/analytics_helper.rb
slideshow-0.9.4 lib/slideshow/helpers/analytics_helper.rb
slideshow-0.9.3 lib/slideshow/helpers/analytics_helper.rb
slideshow-0.9.2 lib/slideshow/helpers/analytics_helper.rb