Sha256: 01380573a20eb2d57a98ee5a731dfd7096bd5ec385acfa075dad492ab3fc0cdd

Contents?: true

Size: 727 Bytes

Versions: 2

Compression:

Stored size: 727 Bytes

Contents

<% if trackers.any? %>
<script async src='https://www.googletagmanager.com/gtag/js?id=<%= trackers[0][:id] %>'></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments)};
  gtag('js', new Date());

  <% if set_options %>
    gtag('set', <%= set_options.to_json %>);
  <% end %>

  <% trackers.each do |tracker| %>
    <% pages.each do |page| %>
      gtag('config', '<%= tracker[:id] %>', <%= tracker_options.merge(page.params).to_json %>);
    <% end %>
    gtag('config', '<%= tracker[:id] %>', <%= tracker_options.to_json %>);
  <% end %>

  <% events.each do |event| %>
    gtag('event', '<%= event.action %>', <%= event.params.to_json %>);
  <% end %>
</script>
<% end %>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rack-tracker-1.13.0 lib/rack/tracker/google_global/template/google_global.erb
rack-tracker-1.12.1 lib/rack/tracker/google_global/template/google_global.erb