Skip to content

Instantly share code, notes, and snippets.

@arturodz
Created November 2, 2016 18:45
Show Gist options
  • Save arturodz/a4e0b871657fe0cf00b2c0a6da5e8f34 to your computer and use it in GitHub Desktop.
Save arturodz/a4e0b871657fe0cf00b2c0a6da5e8f34 to your computer and use it in GitHub Desktop.
<script>
window.dataLayer = window.dataLayer || [];
dataLayer.push({
‘event’ : ‘transactionComplete’,
‘transactionId’: ‘{{order.order_number}}’,
‘transactionTotal’: {{total_price | times: 0.01}},
‘transactionTax’: {{tax_price | times: 0.01}},
‘transactionShipping’: {{shipping_price | times: 0.01}},
‘transactionProducts’: [
{% for line_item in line_items %}
{
‘sku’: ‘{{line_item.sku}}’,
‘name’: ‘{{line_item.title}}’,
‘category’: ‘{{line_item.type}}’,
‘price’: {{line_item.line_price | times: 0.01}},
‘quantity’: {{line_item.quantity}}
},
{% endfor %}]
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment