Tracking Shopify website events
This guide provides a detailed walkthrough for tracking CDP events on your Shopify website
Tracking StoreFront
Tracking Checkout Event
Script pubsub function
Insert the script into the file
1. Script get cart
<script id="cart-json">
var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://shopify.antsomi.com/cart.json', true);
xhr.onload = function () {
if (xhr.status >= 200 && xhr.status < 300) {
var response = JSON.parse(xhr.responseText);
document.getElementById('cart-json').textContent = JSON.stringify(response, null, 2);
}
else {
console.error('Request failed:', xhr.status, xhr.statusText);
}
};
xhr.onerror = function () {
console.error('Connection error');
};
xhr.send();
</script>2. Event Remove Cart
3. Event Sign-In
4. Event Sign-up
Last updated