2

我们在数百个客户网站上使用 Google Analytics。每个站点都有自己的帐户,我们也有一个用于汇总数据的帐户。我们使用以下代码来跟踪两个帐户的综合浏览量。

<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-12345678-1']);  //obviously fake UA numbers
_gaq.push(['_trackPageview']);
_gaq.push(
['aggregate._setAccount', 'UA-87654321-1'],
['aggregate._trackPageview']
);
(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/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>

这对于跟踪访问和行为非常有效,但我不确定如何为电子商务跟踪代码实施相同类型的双重跟踪。我们使用通常的 _addTrans、_addItem 和 _trackTrans 设置。

如何调整电子商务跟踪以向两个帐户报告?

4

1 回答 1

1

In your code, the aggregate. in the _gaq.push calls like aggregate._setAccount is used to create an additional named tracker.

Just copy the ecommerce _gaq.push code lines, and add aggregate. in front of the _addTrans, _addItem and _trackTrans calls.

For example,

 _gaq.push(['_addTrans', ...parameters...]);
 _gaq.push(['aggregate._addTrans', ...parameters...]);
于 2013-01-24T19:13:37.890 回答