首页 > 解决方案 > 我想在 magento2.3.6 中向 GTM 数据层添加其他数据

问题描述

我想在我的 magento 2.3.6 中为现有的数据层事件(productCLick 事件)添加一些附加值(价格、品牌)。

function myFunction(id,price,brand,productUrl) {
    dataLayer.push({ ecommerce: null });  // Clear the previous ecommerce object.
    dataLayer.push({
        'event': 'productClick',
        'ecommerce': {
            'click': {
                'actionField': {'list': 'Catalog Page'},
                'products': [{
                    'id':id,
                    'price': price,                      // Name or ID is required.
                    'brand': brand
                }]
            }
        },
        'eventCallback': function() {
            document.location = productUrl
        }
    });
}

我使用 onclick 实现并通过参数发送自定义数据

标签: magento2google-tag-managermagento-2.3google-datalayer

解决方案


推荐阅读