Skip to content

Instantly share code, notes, and snippets.

@tvpmb
Last active June 4, 2025 21:28
Show Gist options
  • Save tvpmb/06809eeb08f5b625fe4752bf169c8e60 to your computer and use it in GitHub Desktop.
Save tvpmb/06809eeb08f5b625fe4752bf169c8e60 to your computer and use it in GitHub Desktop.
Creatable Shopify Customer Event Pixel
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