【发布时间】:2016-03-02 20:44:06
【问题描述】:
其中哪个更优化?
我有一个感谢页面,我需要将我的所有交易销售信息加载到此页面中,然后通过 Google 跟踪代码管理器将其发布到 Google Analytics。
我是否使用下面的代码声明 dataLayer 并将其发布在我的 GTM 代码之前?
dataLayer = [{
'ecommerce': {
'purchase': {
'actionField': {
'id': '40008',
'revenue': '90.00',
},
'products': [{
'name': 'Clothes',
'price': '9.00',
'category': 'Shirt',
'quantity': 10.00,
}]
}
}
}];
还是将数据推送到自动创建的 dataLayer 中并在我的 GTM 代码之后发布?
dataLayer.push({
'ecommerce': {
'purchase': {
'actionField': {
'id': '40008',
'revenue': '90.00',
},
'products': [{
'name': 'Clothes',
'price': '9.00',
'category': 'Shirt',
'quantity': 10.00,
}]
}
}
});
有什么区别?我将通过“DOM Ready”事件将数据从 dataLayer 获取到 Google。
【问题讨论】:
标签: google-analytics e-commerce google-tag-manager enhanced-ecommerce