Transactions Google Analytics电子商务错误地重新提交以前的交易和后续交易
我在Google Analytics电子商务跟踪方面遇到了一个奇怪的问题,我无法通过自己的实验、在这个网站上或在Google上找到解决方案 我们网站上的所有购买都是作为javascript单页web应用程序的一部分进行的,页面重新加载通常不会在购买之间进行,除非用户专门访问网站内的其他页面。我们的网站既使用谷歌分析跟踪页面浏览量,也使用事件和电子商务跟踪购物。这已经运行了很长一段时间,并且仍然有效,但是我们的一位开发人员最近注意到,在调用trackTrans时,以前提交给trackTrans的事务和项目被重新包含。谷歌Chrome网络标签(uuuUTM请求)中注意到了这一点,并使用谷歌自己的Chrome GA调试扩展进行了验证 让我用所做的调用和日志输出来说明问题(请注意,出于隐私原因,某些信息已被删除): 首次购买页面加载:Transactions Google Analytics电子商务错误地重新提交以前的交易和后续交易,transactions,google-analytics,duplicates,e-commerce,Transactions,Google Analytics,Duplicates,E Commerce,我在Google Analytics电子商务跟踪方面遇到了一个奇怪的问题,我无法通过自己的实验、在这个网站上或在Google上找到解决方案 我们网站上的所有购买都是作为javascript单页web应用程序的一部分进行的,页面重新加载通常不会在购买之间进行,除非用户专门访问网站内的其他页面。我们的网站既使用谷歌分析跟踪页面浏览量,也使用事件和电子商务跟踪购物。这已经运行了很长一段时间,并且仍然有效,但是我们的一位开发人员最近注意到,在调用trackTrans时,以前提交给trackTrans的事
_gaq.push(['_addTrans', 872, (removed), 0.10, , , (removed), null, (removed)]); F3085D20782A2AC201B3D564B205E01B.cache.html:32780
_gaq.push processing "_addTrans" for args: "[872,(removed),0.10,,,(removed),,(removed)]": [VM] ga_debug.js (4049):24
_gaq.push(['_addItem', 872, Id#11474748#GameId#17, (removed), (removed), 0.10, 1]); F3085D20782A2AC201B3D564B205E01B.cache.html:32769
_gaq.push processing "_addItem" for args: "[872,Id#11474748#GameId#17,(removed),(removed),0.10,1]": [VM] ga_debug.js (4049):24
_gaq.push(['_trackTrans']); F3085D20782A2AC201B3D564B205E01B.cache.html:32813
_gaq.push processing "_trackTrans" for args: "[]": [VM] ga_debug.js (4049):24
Track Transaction [VM] ga_debug.js (4049):24
Tracking beacon sent!
utmwv=5.4.4d&utms=13&utmn=1580365368&utmhn=(removed)&utmt=tran&utmtid=872&utmtst=(removed)&utmtto=0.10&utmttx=&utmtsp=&utmtci=(removed)&utmtrg=null&utmtco=(removed)&utme=8(ageGender)9(M%2065%2B)11(2)&utmcs=UTF-8&utmsr=2560x1440&utmvp=2560x1352&utmsc=24-bit&utmul=en-gb&utmje=1&utmfl=11.8%20r800&utmdt=(removed)&utmhid=1366812599&utmr=-&utmp=(removed)&utmht=1378732665904&utmac=(removed)&utmcc=__utma%3D162785085.187708818.1377079516.1378725565.1378732612.33%3B%2B__utmz%3D162785085.1377079516.1.1.utmcsr%3D(direct)%7Cutmccn%3D(direct)%7Cutmcmd%3D(none)%3B&utmu=6xCL~ [VM] ga_debug.js (4049):24
Account ID : (removed)
Page Title : (removed)
Host Name : (removed)
Page : (removed)
Referring URL : -
Hit ID : 1366812599
Hit Type : tran
Visitor ID : 187708818
Session Count : 33
Session Time - First : Wed Aug 21 2013 11:05:16 GMT 0100 (BST)
Session Time - Last : Mon Sep 09 2013 12:19:25 GMT 0100 (BST)
Session Time - Current : Mon Sep 09 2013 14:16:52 GMT 0100 (BST)
Campaign Time : Wed Aug 21 2013 11:05:16 GMT 0100 (BST)
Campaign Session : 1
Campaign Count : 1
Campaign Source : (direct)
Campaign Medium : (none);
Campaign Name : (direct)
Custom Var 1 : label:'ageGender' value:'M 65 ' scope:'2'
Order ID : 872
Billing City : (removed)
Billing Region : null
Billing Country : (removed)
Affilliation : (removed)
Total : 0.10
Shipping Cost :
Tax :
Language : en-gb
Encoding : UTF-8
Flash Version : 11.8 r800
Java Enabled : true
Screen Resolution : 2560x1440
Browser Size : 2560x1352
Color Depth : 24-bit
Ga.js Version : 5.4.4d
Cachebuster : 1580365368 [VM] ga_debug.js (4049):24
Tracking beacon sent!
utmwv=5.4.4d&utms=14&utmn=2121074133&utmhn=(removed)&utmt=item&utmtid=872&utmipc=Id%2311474748%23GameId%2317&utmipn=(removed)&utmiva=(removed)&utmipr=0.10&utmiqt=1&utme=8(ageGender)9(M%2065%2B)11(2)&utmcs=UTF-8&utmsr=2560x1440&utmvp=2560x1352&utmsc=24-bit&utmul=en-gb&utmje=1&utmfl=11.8%20r800&utmdt=(removed)&utmhid=1366812599&utmr=-&utmp=(removed)&utmht=1378732665904&utmac=(removed)&utmcc=__utma%3D162785085.187708818.1377079516.1378725565.1378732612.33%3B%2B__utmz%3D162785085.1377079516.1.1.utmcsr%3D(direct)%7Cutmccn%3D(direct)%7Cutmcmd%3D(none)%3B&utmu=6xCL~ [VM] ga_debug.js (4049):24
Account ID : (removed)
Page Title : (removed)
Host Name : (removed)
Page : (removed)
Referring URL : -
Hit ID : 1366812599
Hit Type : item
Visitor ID : 187708818
Session Count : 33
Session Time - First : Wed Aug 21 2013 11:05:16 GMT 0100 (BST)
Session Time - Last : Mon Sep 09 2013 12:19:25 GMT 0100 (BST)
Session Time - Current : Mon Sep 09 2013 14:16:52 GMT 0100 (BST)
Campaign Time : Wed Aug 21 2013 11:05:16 GMT 0100 (BST)
Campaign Session : 1
Campaign Count : 1
Campaign Source : (direct)
Campaign Medium : (none);
Campaign Name : (direct)
Custom Var 1 : label:'ageGender' value:'M 65 ' scope:'2'
Product Code : Id#11474748#GameId#17
Product Name : (removed)
Unit Price : 0.10
Quantity : 1
Item Variation : (removed)
Order ID : 872
Language : en-gb
Encoding : UTF-8
Flash Version : 11.8 r800
Java Enabled : true
Screen Resolution : 2560x1440
Browser Size : 2560x1352
Color Depth : 24-bit
Ga.js Version : 5.4.4d
Cachebuster : 2121074133 [VM] ga_debug.js (4049):24
不重新加载页面的第二次购买(同一会话):
对于第一次购买,发送两个跟踪信标:
- 订单ID为“872”的命中类型“tran”之一
- 点击类型“物品”之一,订单ID为“872”,产品代码(SKU)为“ID#11474748#GameId#17”
- 点击类型“tran”之一,订单ID为“872”(上一笔交易)
- 一个命中类型为“物品”,订单ID为“872”,产品代码(SKU)为“ID#11474748#GameId#17”(上一个物品)
- 订单ID为“873”的点击类型“tran”之一(新交易)
- 点击类型“物品”之一,订单ID为“873”,产品代码(SKU)为“ID#26113584#GameId#17”(新物品)
/**/
谷歌分析电子商务测试页面
谷歌分析电子商务测试
\u addTrans使用给定值创建事务对象。与_addItem()一样,此方法仅处理事务跟踪,不提供额外的电子商务功能。因此,如果事务是该会话的现有事务的副本,旧事务值将被新事务值覆盖。此方法的参数按位置匹配,因此确保提供所有参数,即使其中一些参数的值为空
资料来源:
由于每次推送事务时您都处于同一会话中,因此它会提交所有事务,但不会复制现有事务,它将覆盖这些事务。(然后它们将保持不变且唯一)
_addTrans使用给定的值创建事务对象。与_addItem()一样,此方法仅处理事务跟踪,不提供额外的电子商务功能。因此,如果事务是该会话的现有事务的副本,旧事务值将被新事务值覆盖。此方法的参数按位置匹配,因此确保提供所有参数,即使其中一些参数的值为空 资料来源: 由于每次推送事务时您都处于同一会话中,因此它会提交所有事务,但不会复制现有事务,它将覆盖这些事务。(然后它们将保持不变且唯一)
正如我在最初的评论中提到的,这是一个没有文档记录的特性,但是请看一下在
\u trackTrans
之后使用\u clearTrans
。顾名思义,它清除了所有当前的电子商务数据(项目和交易)
修改您的示例的结果如下..:
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXX-X']); /* REPLACE WITH YOUR OWN ACCOUNT ID */
_gaq.push(['_setDomainName', 'none']); /* Must be set to none when running from localhost, but normally set to auto in Prod */
_gaq.push(['_setAllowLinker', false]); /* set to true in Prod but doesn't seem to have any effect on the issue */
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/u/ga_debug.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
var orderId = 1;
var sku = 200;
makePurchase = function() {
console.group('New Purchase');
_gaq.push(['_trackPageview', '/purchase/complete']);
console.log("Tracking purchase for order with id " + orderId + " and SKU " + sku);
_gaq.push(['_addTrans', orderId, 'Acme Clothing', '11.99', '1.29' , '5', 'San Joes', 'California', 'USA']);
_gaq.push(['_addItem', orderId, sku, 'T-Shirt', 'Green Medium', '11.99', '1']);
_gaq.push(['_trackTrans']);
_gaq.push(['_clearTrans']); // Clear Transaction data
incrementOrderIds();
console.groupEnd();
}
var incrementOrderIds = function() {
orderId = orderId + 1;
sku = sku + 10;
}
此外,如果/当你最终切换到Universal Analytics,谷歌的优秀员工会很好地通过
ga('ecommerce:clear')
将其包括在内,作为奖励。。。他们甚至还这样 正如我在最初的评论中提到的,这是一个未记录的功能,但是请看一下在\u trackTrans
之后使用\u clearTrans
。顾名思义,它清除了所有当前的电子商务数据(项目和交易)
修改您的示例的结果如下..:
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXX-X']); /* REPLACE WITH YOUR OWN ACCOUNT ID */
_gaq.push(['_setDomainName', 'none']); /* Must be set to none when running from localhost, but normally set to auto in Prod */
_gaq.push(['_setAllowLinker', false]); /* set to true in Prod but doesn't seem to have any effect on the issue */
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/u/ga_debug.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
var orderId = 1;
var sku = 200;
makePurchase = function() {
console.group('New Purchase');
_gaq.push(['_trackPageview', '/purchase/complete']);
console.log("Tracking purchase for order with id " + orderId + " and SKU " + sku);
_gaq.push(['_addTrans', orderId, 'Acme Clothing', '11.99', '1.29' , '5', 'San Joes', 'California', 'USA']);
_gaq.push(['_addItem', orderId, sku, 'T-Shirt', 'Green Medium', '11.99', '1']);
_gaq.push(['_trackTrans']);
_gaq.push(['_clearTrans']); // Clear Transaction data
incrementOrderIds();
console.groupEnd();
}
var incrementOrderIds = function() {
orderId = orderId + 1;
sku = sku + 10;
}
此外,如果你最终转向通用分析,谷歌的优秀员工也会
_addTrans(transactionId, affiliation, total, tax, shipping, city, state, country)
_gaq.push(['_trackTrans']);
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXX-X']); /* REPLACE WITH YOUR OWN ACCOUNT ID */
_gaq.push(['_setDomainName', 'none']); /* Must be set to none when running from localhost, but normally set to auto in Prod */
_gaq.push(['_setAllowLinker', false]); /* set to true in Prod but doesn't seem to have any effect on the issue */
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/u/ga_debug.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
var orderId = 1;
var sku = 200;
makePurchase = function() {
console.group('New Purchase');
_gaq.push(['_trackPageview', '/purchase/complete']);
console.log("Tracking purchase for order with id " + orderId + " and SKU " + sku);
_gaq.push(['_addTrans', orderId, 'Acme Clothing', '11.99', '1.29' , '5', 'San Joes', 'California', 'USA']);
_gaq.push(['_addItem', orderId, sku, 'T-Shirt', 'Green Medium', '11.99', '1']);
_gaq.push(['_trackTrans']);
_gaq.push(['_clearTrans']); // Clear Transaction data
incrementOrderIds();
console.groupEnd();
}
var incrementOrderIds = function() {
orderId = orderId + 1;
sku = sku + 10;
}