Created
June 18, 2024 15:35
-
-
Save tvpmb/357bb3f97e636902689cafea254ccd73 to your computer and use it in GitHub Desktop.
Shopify Conversion Pixel Script
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"> | |
(function() { | |
var tvpa = document.createElement('script'); | |
tvpa.type = 'text/javascript'; | |
tvpa.async = true; | |
tvpa.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'a.tvpage.com/tvpa.min.js'; | |
let s = document.getElementsByTagName('script')[0]; | |
s.parentNode.insertBefore(tvpa, s); | |
})(); | |
var _tvpa = _tvpa || []; | |
_tvpa.push(['config', { | |
li: "*** REPLACE ACCOUNT ID ***" // Account ID | |
}]); | |
var shopifyOrderData = { | |
"tid": "{{ checkout.order.id }}", | |
"orders": [ | |
{% for line_item in checkout.order.line_items %} | |
{ | |
"sku": "{{ line_item.product_id }}", | |
"price": "{{ line_item.final_price | money_without_currency }}", | |
"quantity": "{{ line_item.quantity }}" | |
}{% unless forloop.last %},{% endunless %} | |
{% endfor %} | |
] | |
}; | |
_tvpa.push(['track', 'products', shopifyOrderData]); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment