我有这样的Google Analytics(分析)代码。这是客户端浏览器的“查看页面源”上的结果示例,而不是JSP代码。首先创建对象并发送页面视图。
ga('create', 'UA-11111111-1', 'auto');
ga('send', 'pageview');
ga('create', 'UA-11111111-2', 'auto', {'name': 'Rollup'});
ga('Rollup.send', 'pageview');
ga('create', 'UA-11111111-3', 'auto', {'name': 'AnotherRollup'});
ga('AnotherRollup.send', 'pageview');
一切正常。我的意思是,我可以在Google Analytics(分析)中看到所有三个帐户的所有实时页面浏览量。然后遵循添加的事务代码。
ga('require', 'ecommerce');
// create transaction object
var Transaction = {
'id': '12345', // transaction ID
'affiliation': 'North East Store',
'revenue': 100.00',
'shipping': '0.00',
'tax': '0.00'
};
// add transaction to all the trackers
ga('ecommerce:addTransaction', Transaction);
ga('Rollup.ecommerce:addTransaction', Transaction);
ga('AnotherRollup.ecommerce:addTransaction', Transaction);
然后按照代码将项目添加到事务中。
var Item = {}; // this is to prepare the var for multi items.
Item = {
'id': '12345', // transaction ID
'name': 'Microwave', // name
'sku': '111', // SKU/code.
'category': 'Kitchen', // Category or variation.
'price': '20.00', // Unit price.
'quantity': '5' // Quantity.
};
ga('ecommerce:addItem', Item);
ga('RollUp.ecommerce:addItem', Item);
ga('AnotherRollUp.ecommerce:addItem', Item);
然后按照代码将所有这些订单发送到Google Analytics(分析)。
//submits transaction to the Analytics servers
ga('ecommerce:send');
ga('Rollup.ecommerce:send');
ga('AnotherRollup.ecommerce:send');
问题是,该订单仅在第一个帐户的Google Analytics(分析)上接收/更新(在此javascript代码案例中为未命名/默认)。我以为是因为我为其他两个帐户使用了错误的Google Analytics(分析)跟踪器帐户代码。但是我已经重新检查,另外两个跟踪器帐户代码正确,并且可以实时查看页面视图。所以那一定不是因为这个。我的来源是:
https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce#multitracker
我已经检查了所有内容,根据该手册,所有内容均正确无误。但是我仍然无法获得其他两个跟踪器(Rollup和AnotherRollup)的结果。我的代码有什么问题吗?还是问题出在别的地方?非常感谢你。
每次包含电子商务库时,您都需要包含跟踪器名称:
ga('require', 'ecommerce');
ga('RollUp.require', 'ecommerce');
ga('AnotherRollUp.require', 'ecommerce');
甚至记录在这里:https : //developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce#multitracker
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句