Sha256: b39a2100e97f253563d008c420b81c839b3ad9aaacd074adfe9fba651b8503f1

Contents?: true

Size: 1.39 KB

Versions: 8

Compression:

Stored size: 1.39 KB

Contents

<script type="text/javascript">
<% if tracker %>
  if(typeof ga === 'undefined') {
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

    ga('create', '<%= tracker %>', <%= tracker_options.to_json %>);
  }
<% if options[:enhanced_link_attribution] %>
  ga('require', 'linkid', 'linkid.js');
<% end %>
<% if options[:advertising] %>
  ga('require', 'displayfeatures');
<% end %>
<% if options[:enhanced_ecommerce] %>
  ga('require', 'ec');
<% end %>
<% if options[:ecommerce] %>
  ga('require', 'ecommerce', 'ecommerce.js');
<% end %>
<% if options[:anonymize_ip] %>
  ga('set', 'anonymizeIp', true);
<% end %>
<% if options[:adjusted_bounce_rate_timeouts] %>
  <% options[:adjusted_bounce_rate_timeouts].each do |timeout| %>
      setTimeout(function() { ga('send', 'event', '<%= "#{timeout.to_s}_seconds" %>', 'read'); },<%= timeout*1000 %>);
  <% end %>
<% end %>
<% end %>
<% events.each do |var| %>
  ga(<%= var.write() %>);
<% end %>
<% if options[:ecommerce] && ecommerce_events.any? %>
  ga('ecommerce:send');
<% end %>
<% if tracker %>
  ga('send', 'pageview', window.location.pathname + window.location.search);
<% end %>
</script>

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rack-tracker-1.5.0 lib/rack/tracker/google_analytics/template/google_analytics.erb
rack-tracker-1.4.0 lib/rack/tracker/google_analytics/template/google_analytics.erb
rack-tracker-1.3.1 lib/rack/tracker/google_analytics/template/google_analytics.erb
rack-tracker-1.3.0 lib/rack/tracker/google_analytics/template/google_analytics.erb
rack-tracker-1.2.0 lib/rack/tracker/google_analytics/template/google_analytics.erb
rack-tracker-1.1.0 lib/rack/tracker/google_analytics/template/google_analytics.erb
rack-tracker-1.0.2 lib/rack/tracker/google_analytics/template/google_analytics.erb
rack-tracker-1.0.1 lib/rack/tracker/google_analytics/template/google_analytics.erb