Created
May 25, 2019 07:19
-
-
Save karthik20522/aed18b2f90feea4c36f4b878ad49d355 to your computer and use it in GitHub Desktop.
Shopify conversion tracking
This file contains 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 type="text/javascript"> | |
var items = {{ order.line_items | json }}; | |
var item; | |
var productsArray = []; | |
for(var i = 0; i < items.length; i++) { | |
item = { | |
'sku': items[ i ].variant.sku, | |
'price': items[ i ].price, | |
'size': items[ i ].variant.option2, | |
'quantity': items[ i ].quantity | |
} | |
productsArray.push( item ); | |
} | |
var shpfy_track = { | |
products: productsArray, | |
transaction : '{{ order.order_number }}', | |
amount: {{ order.total_price | money_without_currency }}, | |
currency: '{{ shop.currency }}' | |
}; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment