Sha256: e348d534fff8efaaa8c18955d305f630b7d72d5bfd0ab40db77bf9d5bb0ae891

Contents?: true

Size: 721 Bytes

Versions: 2

Compression:

Stored size: 721 Bytes

Contents

<% if segment_enabled? && defined?(products) && products.present? %>
  <script>
    window.addEventListener('turbolinks:load', function() {
      if (typeof analytics !== 'undefined') {
        var segmentProductListViewedJson = {
          category: '<%= @taxon&.name %>',
          products: [
            <% products.each_with_index do |product, index| %>
              <%= product_for_segment(product, position: index+1, image: default_image_for_product_or_variant(product)) %>,
            <% end %>
          ]
        }

        analytics.track('Product List Viewed', segmentProductListViewedJson);
        analytics.page('Product List Viewed', segmentProductListViewedJson);
      }
    });
  </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/segment/_product_list_viewed.js.erb
spree_analytics_trackers-2.1.0 app/views/spree/shared/trackers/segment/_product_list_viewed.js.erb