0

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>
4
  • which error you are facing here? Jul 30, 2021 at 12:47
  • Hi i dont see any error. just that my custom entries are not reflecting in ProductClick Event. Jul 30, 2021 at 12:59
  • Have you check the above code, that is called when you click on that one? Jul 30, 2021 at 13:04
  • Yes.. i have checked that. The function is being called. but the custom data is not sending to datalayer. Aug 16, 2021 at 7:31

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.