Google Analytics 未跟踪跨域实施的电子商务
这是我们的设置:
1) 主站点包含一个电子商务解决方案,该解决方案使用 GA 来跟踪所有内容并按要求执行。每个页面上的跟踪代码如下:
var pageTracker = _gat._getTracker("account id");
pageTracker._setDomainName("primary domain");
pageTracker._setAllowLinker(true);
pageTracker._setAllowHash(false);
pageTracker._trackPageview();
主站点还从辅助域目录 A 打开服务。在打开实用程序之前,我们使用 pageTracker._getLinkerUrl() 获取添加到 url 的所有正确 GA 信息。
2) 在辅助域目录 A 上运行的实用程序使用 Google 推荐的 GA 跟踪代码:
var pageTracker = _gat._getTracker("account id");
pageTracker._setDomainName('none');
pageTracker._setAllowLinker(true);
pageTracker._setAllowHash(false);
pageTracker._trackPageview();
辅助服务使用 GA 事件来记录主站点 GA 帐户中发生的各种事情,并且一切都运行良好。
现在事情开始出错了:
- 我们在二级域目录 B 上设置了一个对比测试。
- 我们还有一个服务器端代码,当用户打开目录 A 时,将大约 50% 的用户重定向到目录 B。目录中的 google 跟踪代码B 与 A 中的相同。但是,从目录 B 抛出的所有 GA 事件都有一个识别前缀,以便我们稍后可以分析拆分版本用户的行为。
其结果是,虽然 GA 记录了所有事件,但电子商务统计数据却陷入混乱,因为目录 B 部分记录了零电子商务交易,而平均值下降了 50% 左右,目录 A 部分继续保持正常的转化率水平。
我们目前正在考虑重做拆分框架,以使主域应用程序了解我们向用户发送的拆分测试 URL,而不是摆弄服务器端重定向。我们希望这能暂时解决这个问题。
但问题是 - 是否有可能以某种方式让 Google Analytics 在这里正常工作以与电子商务数据关联,而无需摆脱服务器端拆分框架?
Here's our setup:
1) Primary site contains an e-commerce solution that uses GA to track everything and is doing it as required. The tracking code on every page is as follows:
var pageTracker = _gat._getTracker("account id");
pageTracker._setDomainName("primary domain");
pageTracker._setAllowLinker(true);
pageTracker._setAllowHash(false);
pageTracker._trackPageview();
The primary site also opens a service from a secondary domain directory A. We use pageTracker._getLinkerUrl() to get all the proper GA information added to the url before opening the utility.
2) The utility running on secondary domain directory A uses GA tracking code as recommended by Google:
var pageTracker = _gat._getTracker("account id");
pageTracker._setDomainName('none');
pageTracker._setAllowLinker(true);
pageTracker._setAllowHash(false);
pageTracker._trackPageview();
The secondary service uses GA Events to record various stuff happening there to the primary sites GA account and it all works quite well.
Now's where things started going wrong:
- We set up a split test at secondary domain directory B.
- We also have a server side code in place that redirects around 50% of users to directory B when they open directory A. The google tracking code at directory B is identical to the one in A. All the GA events thrown from directory B however have a identifying prefix so we can later analyze Split version users behavior.
The result of this was that while GA recorded all events, the e-commerce statistics went haywire as the directory B segment recorded ZERO e-commerce transactions, while the average dropped around 50% and directory A segment continued at regular conversion rate levels.
What we're currently thinking of redoing the split framework to have the primary domains app to know the split test url we're sending the user and not fiddling with server side redirects. We hope that this will fix the issue for now.
But question is - is it possible to somehow get Google Analytics to properly work here to associate with e-commerce data without getting rid of the server side split framework?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于我们没有明确的问题原因,因此我们通过在客户端进行拆分 URL 准备来解决此问题,并使用 AJAX 从管理测试平衡的应用程序中检索拆分 URL,以便打开辅助域(并运行GA 代码)获取处理后的最终目标 url,页面不会被重定向。到目前为止,分析显示了主要版本和拆分版本的结果,并正确记录了事件,因此它有效。
在测试时,我们发现引用网址在途中丢失了(可能是由于我们的重定向代码),但由于使用 Google Web Optimizer 时电子商务跟踪也无法正确跟踪,因此这也可能是一个问题,处理在多个域上运行的拆分测试时。
As we didn't have a clear cause for the problem, we solved this by doing the split URL preparation in clientside with retrieving the split URL with AJAX from the app managing the test balancing, so that javascript that opens the secondary domain (and runs the GA code) gets the processed final target url and the page won't get redirected. Sofar analytics is showing results from both, primary and split versions and is recording events properly, so it worked.
When testing we discovered that the referring url got lost somewehere along the way (possibly due to our redirection code), but as the e-commerce tracking also failed to track properly when using Google Web Optimizer, then this might be an issue there aswell, when dealing with split tests run over multiple domains.