Sha256: b1bd255e8d6ae4b70f6691a8f7376e5d6a1fe8175755c5d0d337a973069ab31e

Contents?: true

Size: 837 Bytes

Versions: 2

Compression:

Stored size: 837 Bytes

Contents

class Caboodle::Analytics < Caboodle::Kit
  
  description "Adds Google Analytics to every page of the site"
  
  required [:analytics_id]
  
  if ENV["RACK_ENV"] == "production"
    add_layout :after_body, "<script type=\"text/javascript\">
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', '#{Caboodle::Site.analytics_id}']);
      _gaq.push(['_setDomainName', 'none']);
      _gaq.push(['_setAllowLinker', true]);
      _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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
caboodle-0.2.16 lib/caboodle/kits/analytics/analytics.rb
caboodle-0.2.15 lib/caboodle/kits/analytics/analytics.rb