Created
November 10, 2016 04:16
-
-
Save Sinetheta/7bae0a549cd3e635cb6420b9252b5e18 to your computer and use it in GitHub Desktop.
segment order complete
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
analytics.track('Order Completed', { | |
order_id: '<%= j order.number %>', | |
affiliation: '<%= current_store.name %>', | |
total: '<%= order.total %>', | |
shipping: '<%= order.ship_total %>', | |
tax: '<%= order.tax_total %>', | |
discount: '<%= (- order.promo_total) %>', | |
coupon: '<%= order.coupon_code %>', | |
currency: '<%= order.currency %>', | |
products: [ | |
<% order.line_items.each do |line_item| %> | |
{ | |
product_id: '<%= line_item.variant_id %>', | |
sku: '<%= j (line_item.variant.sku || line_item.variant_id) %>', | |
name: '<%= j line_item.variant.descriptive_name %>', | |
price: '<%= line_item.price %>', | |
quantity: '<%= line_item.quantity %>', | |
}, | |
<% end %> | |
], | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment