Last active
August 29, 2015 14:10
-
-
Save tvpmb/01bf2af723c5904e9907 to your computer and use it in GitHub Desktop.
TVPage_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> | |
$SKUArr = new Array();$PriceArr = new Array();$QtyArr = new Array(); | |
</script> | |
{% for line_item in line_items %} | |
<script> | |
$SKUArr['{{ forloop.index }}']="{{ line_item.sku }}"; | |
$PriceArr['{{ forloop.index }}']="{{ line_item.line_price | money_without_currency }}"; | |
$QtyArr['{{ forloop.index }}']="{{ line_item.quantity }}"; | |
</script> | |
{% endfor %} | |
<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'; | |
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(tvpa, s); | |
})(); | |
var _tvpa = _tvpa || []; | |
_tvpa.push(['config', { | |
//********************************************************************** | |
tr: "", // Data source ID | |
li: "" // Account ID | |
//*********************************************************************** | |
}]); | |
$prodStr = []; | |
for($Cnt = 1; $Cnt < $SKUArr.length; $Cnt++){ | |
$prodStr[$Cnt] = { "sku": $SKUArr[$Cnt], "price": $PriceArr[$Cnt], "quantity": $QtyArr[$Cnt] }; | |
} | |
_tvpa.push(['track', 'products', $prodStr]); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment