If you have installed the Instant pixel for BigCommerce and are not receiving added to cart events from Audiences, please manually add tracking directly to your website.
- Proceed to the BigCommerce dashboard, and click on Storefront in the sidebar
- Click on Script Manager
- Click on Create a script in the top right
- Select these settings for the script.
Script name: Instant Audiences Add to Cart
Placement: Header
Location: All pages
Script category: Essential
Script type: Script - Copy and paste the following code into the "Script contents" text box.
<script>Click on Save.
(function () {
const originalOpen = XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function () {
try {
this._interceptedUrl = arguments[1].toString();
} catch (err) {
console.error("Error setting intercepted URL");
}
return originalOpen.apply(this, arguments);
};
const originalSend = XMLHttpRequest.prototype.send;
XMLHttpRequest.prototype.send = function (body) {
try {
const urlToCheck = this._interceptedUrl;
if (
urlToCheck &&
(urlToCheck.includes("remote/v1/cart/add") || urlToCheck.includes("remote/v1/cart/update"))
) {
window.InstantJS.track("ITEM_ADDED_TO_CART");
}
} catch (err) {
console.error("Error adding event listener for handling interception");
}
return originalSend.apply(this, arguments);
};
})();
</script>