Sha256: 4ab341c21cb18888fe89b5050886e80c282e5a2bc47da16431594fb83a7fcef3

Contents?: true

Size: 882 Bytes

Versions: 2

Compression:

Stored size: 882 Bytes

Contents

module Analytics
  module Rails
    module ActionView
      module Base

        def google_analytics_include_tag(account)
          if ['production','test'].include? ::Rails.env
            script = <<-SCRIPT
              var _gaq = _gaq || [];
              _gaq.push(['_setAccount', '#{account}']);
              _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
            content_tag(:script, script.html_safe, type: 'text/javascript')
          end
        end

      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
analytics-rails-0.0.7 lib/analytics/rails/action_view/base.rb
analytics-rails-0.0.6 lib/analytics/rails/action_view/base.rb