Created
October 8, 2019 23:34
-
-
Save tvpmb/6ecdbddb29bdb57248fd924bd9ff5449 to your computer and use it in GitHub Desktop.
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
if (Shopify.hasOwnProperty('checkout')) { | |
var purchases = Shopify.checkout.line_items; | |
var orderId = Shopify.checkout.order_id; | |
var items = []; | |
for (var x = 0; x < purchases.length; x++) { | |
items.push({ | |
sku: purchases[x]['sku'], | |
price: purchases[x]['price'], | |
quantity: String(purchases[x]['quantity']) | |
}); | |
} | |
(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', { | |
li: '1759289', | |
firstPartyCookieDomain: 'tvpage-dev.myshopify.com' | |
}]); | |
_tvpa.push(['track', 'products', { | |
'tid': orderId, | |
'orders': items | |
} | |
]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment