Sha256: 8a1d7f3ea1b102c9ba525a35e3d30cb3c05f11713c2eb480d49adc34cf7979d3

Contents?: true

Size: 737 Bytes

Versions: 2

Compression:

Stored size: 737 Bytes

Contents

if (typeof ga !== 'undefined') {
  <% @order.line_items.each do |line_item| %>
  ga('ec:addProduct', {               // Provide product details in a productFieldObject.
    'id': '<%= j (line_item.sku.present? ? line_item.sku : line_item.variant_id.to_s) %>',  // Product ID (string).
    'name': '<%= j line_item.name %>', // Product name (string).
    'category': '<%= j line_item.category.try(:name) %>',            // Product category (string).
    'brand': '<%= j line_item.brand.try(:name) %>',                // Product brand (string).
    'variant': '<%= j line_item.options_text %>',               // Product variant (string).
    'price': '<%= line_item.price %>',
    'quantity': <%= line_item.quantity %>
  });
  <% end %>
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spree_analytics_trackers-1.1.0 app/views/spree/shared/_google_add_items.html.erb
spree_analytics_trackers-1.0.1 app/views/spree/shared/_google_add_items.html.erb