Hi, I need some help.
I’m unable to track my website pages after Add to Cart. From Checkout pages, GTM is not able to track any page, even purchase. To solve this, I pushed the GTM code in Custom Pixel with Data Layers for relevant events that I want to track but the code is still not firing. Please help.
Here is the website: https://yourcleanlab.com/
I added this code:
window.dataLayer = window.dataLayer || ;
function gtag(){dataLayer.push(arguments);}
(function(w,d,s,l,i){w[l]=w[l]||;w[l].push({‘gtm.start’:
new Date().getTime(),event:‘gtm.js’});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!=‘dataLayer’?‘&l=’+l:‘’;j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,‘script’,‘dataLayer’, ‘GTM-XXXXXXX’);
analytics.subscribe(“checkout_started”, (event) => {
dataLayer.push({ ecommerce: null });
const items = event.data?.checkout?.lineItems?.map((item) => {
return {
item_id: item.variant.product.id,
item_name: item.variant.product.title,
price: item.variant.price.amount,
quantity: item.quantity
}
});
dataLayer.push({
event: “begin_checkout”,
url: event.context.document.location.href,
ecommerce: {
currency: event.data?.checkout?.currencyCode,
value: event.data?.checkout?.subtotalPrice?.amount,
items: items
}
});
});
—
Still not working. Sharing screenshots below for better understanding.
While checking through console, values are passed, but Data.Layer is still showing error. Check the screenshot below:





