Reputation: 21
We are using Google Analytics on hundreds of client sites. Each site has its own account, and we also have an account for aggregate data. We're using the following code for tracking pageviews to both accounts.
<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>
This is working well for tracking visits & behaviour, but I'm not sure how to implement the same type of double tracking for the ecommerce tracking code. We're using the usual _addTrans, _addItem and _trackTrans setup.
How can I adapt the ecommerce tracking to report to both accounts?
Upvotes: 2
Views: 649
Reputation: 7177
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...]);
Upvotes: 1