Sha256: a30ba0067241009c276065a0c402003ba7dd7d111c501e39f951ccaa74e9567e

Contents?: true

Size: 740 Bytes

Versions: 2

Compression:

Stored size: 740 Bytes

Contents

<% if ga_enabled? && @order.present? && order_just_completed?(@order) %>
  <script>
    window.addEventListener('turbolinks:load', function() {
      if (typeof gtag !== 'undefined') {
        clearGAplugins();
        gtag('event', 'purchase', {
          transaction_id: '<%= @order.number %>',
          value: <%= @order.total&.to_f %>,
          currency: '<%= @order.currency %>',
          tax: <%= @order.tax_total&.to_f %>,
          shipping: <%= @order.shipment_total&.to_f %>,
          coupon: '<%= @order.promo_code %>',
          items: [
            <% @order.line_items.each do |line_item| %>
              <%= ga_line_item(line_item) %>,
            <% end %>
          ]
        });
      }
    });
  </script>
<% end %>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spree_analytics_trackers-2.1.1 app/views/spree/shared/trackers/google_analytics/_purchase.js.erb
spree_analytics_trackers-2.1.0 app/views/spree/shared/trackers/google_analytics/_purchase.js.erb