Sha256: 4dca745eeac6972a12671d44a31fd203e0482d4bf799da320efc46b93e2a9c10

Contents?: true

Size: 822 Bytes

Versions: 14

Compression:

Stored size: 822 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', '#{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

14 entries across 14 versions & 1 rubygems

Version Path
caboodle-0.3.0 lib/caboodle/kits/analytics/analytics.rb
caboodle-0.2.30 lib/caboodle/kits/analytics/analytics.rb
caboodle-0.2.29 lib/caboodle/kits/analytics/analytics.rb
caboodle-0.2.28 lib/caboodle/kits/analytics/analytics.rb
caboodle-0.2.27 lib/caboodle/kits/analytics/analytics.rb
caboodle-0.2.26 lib/caboodle/kits/analytics/analytics.rb
caboodle-0.2.25 lib/caboodle/kits/analytics/analytics.rb
caboodle-0.2.24 lib/caboodle/kits/analytics/analytics.rb
caboodle-0.2.23 lib/caboodle/kits/analytics/analytics.rb
caboodle-0.2.22 lib/caboodle/kits/analytics/analytics.rb
caboodle-0.2.21 lib/caboodle/kits/analytics/analytics.rb
caboodle-0.2.20 lib/caboodle/kits/analytics/analytics.rb
caboodle-0.2.19 lib/caboodle/kits/analytics/analytics.rb
caboodle-0.2.18 lib/caboodle/kits/analytics/analytics.rb