magento2 - 我想在 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 实现并通过参数发送自定义数据
解决方案
推荐阅读
- python - numpy数组中给定值的凸包 - python 2.7
- android - adb 无法识别设备
- sql-order-by - 如何通过使用 sparql 查询自定义订单来获取结果
- ruby - 将当前类属性注入新类的构造函数
- hive - Hive 中的 DROP TABLE(通过 Spark)挂起
- docker - Docker 容器如何访问 VPN 后面的服务器?
- python - 在 pandas 数据框中动态创建所有列组合
- android - 如何在 Android 列表视图中调用多个 Web 服务?
- select - 连接来自同一个表但条件不同的多个相似查询的结果
- java - 连接到 Cassandra 集群时 Java 应用程序(Wasabi)失败