Sha256: 3db82e72d2b34fe60f9f5541b42ac2d30dae75d52d7feeea102b1699196a0975

Contents?: true

Size: 726 Bytes

Versions: 1

Compression:

Stored size: 726 Bytes

Contents

module Analytics
  module Rails
    module Helpers

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

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
analytics-rails-0.0.1 lib/analytics/rails/helpers.rb