I am working on GoogleTagManger module in my magento2.3.6. i want to add price, brand and its values to the existing productClick event.
I tried the below steps in magento_catalog/product/list.phtml.. but didn;t work for me. Please somebody give me some idea on this
<script>
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
"event": "productClick",
"ecommerce": {
"click": {
"actionField": {
"list': "Catalog Page"
},
"products": [{
"id":"<?= $_product->getSku() ?>",
"price": "<?= $_product->getPrice() ?>",
"brand": "<?= $_product->getAttributeText('product_brands') ?>"
}]
}
}
});
</script>