Last active
June 4, 2025 21:28
-
-
Save tvpmb/06809eeb08f5b625fe4752bf169c8e60 to your computer and use it in GitHub Desktop.
Creatable Shopify Customer Event Pixel
This file contains hidden or 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
const script = document.createElement('script'); | |
script.setAttribute('src', 'https://a.tvpage.com/tvpa.min.js'); | |
script.setAttribute('async', ''); | |
document.head.appendChild(script); | |
_tvpa = window._tvpa || []; | |
_tvpa.push(['config', { | |
li: "YOUR_ACCOUNT_ID", // Creatable Account ID | |
mode: "dl" | |
}]); | |
analytics.subscribe("checkout_completed", (event) => { | |
tid = event.data?.checkout?.order?.id; | |
products = event.data?.checkout?.lineItems.map((item) => { | |
return { | |
sku: item.variant.id, | |
price: item.variant.price.amount, | |
quantity: item.quantity | |
} | |
}); | |
orderData = {}; | |
orderData.tid = tid; | |
orderData.orders = products; | |
_tvpa.push(['track', 'products', orderData]); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment