AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

Analytics
5.8K members online now
5.8K members online now
Learn how to set up goals and Ecommerce tracking, verify accuracy of attribution traffic sources, and discuss funnel visualization, Multi-Channel Funnels, the Goal Flow Report, and Enhanced Ecommerce
 
Guide Me
star_border
Reply

Ecommerce transactions when using Multiple Analytics tracking

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

We have an ecommerce site (Magento) with multiple tracking codes.

 

Both properties have the eommerce plugin enabled on the Admin tab in the Google Analytics Dashboard.

 

The main tracking code is tracking traffic, conversions and revenue. The secondary code is tracking traffic, conversions, but not revenue.

 

This is how the code looks like:

 

<!-- BEGIN GOOGLE UNIVERSAL ANALYTICS CODE -->
<script type="text/javascript">
//<![CDATA[
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

    
ga('create', 'UA-XXX', 'auto');
ga('create', 'UA-YYY', 'auto', 'clientTracker');
ga('clientTracker.require', 'ecommerce');

ga('send', 'pageview');
ga('clientTracker.send', 'pageview');
    
//]]>
</script>
<!-- END GOOGLE UNIVERSAL ANALYTICS CODE -->

This is how it looks the Ecommerce section on the Analytics Dashboard

 

Ecommerce Overview   Google Analytics.png

 

I've read the documentation in https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce?hl=en#multitracke...

 

 

Is there anything else that we need to do for the second tracking code to track the revenue?

 

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Sean M
April 2016

Re: Ecommerce transactions when using Multiple Analytics tracking

Participant ✭ ✭ ☆
# 4
Participant ✭ ✭ ☆
If you have two trackers you have to load ecommerce plugin for each of them.
If you don't do that, ecommerce tracking won't work.

In your code you are loading ecommerce plugin only for "clientTracker".

So first thing you have to do is to add this line to code:
ga('require', 'ecommerce');

And then make sure you are using tracker names when you add item and transaction, and you are sending data to proper trackers.

ga('ecommerce:addItem', {items_data});
ga('ecommerce:addTransaction', t{trans_data});

ga('clientTracker.ecommerce:addItem', {items_data});
ga('clientTracker.ecommerce:addTransaction', {trans_data});

ga('ecommerce:send');
ga('clientTracker.ecommerce:send');

View solution in original post

Re: Ecommerce transactions when using Multiple Analytics tracking

Participant ✭ ✭ ☆
# 2
Participant ✭ ✭ ☆
I think you forgot to add ecommerce plugin for main tracker:
ga('require', 'ecommerce');

Re: Ecommerce transactions when using Multiple Analytics tracking

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Hi Tomas,

Thanks for the reply, the main tracker works just fine, without explicitly defining the ecommerce plugin on the tracking code, although is enabled on the Analytics dashboard.

It's the second tracker that is not logging any transaction values at all.
Marked as Best Answer.
Solution
Accepted by topic author Sean M
April 2016

Re: Ecommerce transactions when using Multiple Analytics tracking

Participant ✭ ✭ ☆
# 4
Participant ✭ ✭ ☆
If you have two trackers you have to load ecommerce plugin for each of them.
If you don't do that, ecommerce tracking won't work.

In your code you are loading ecommerce plugin only for "clientTracker".

So first thing you have to do is to add this line to code:
ga('require', 'ecommerce');

And then make sure you are using tracker names when you add item and transaction, and you are sending data to proper trackers.

ga('ecommerce:addItem', {items_data});
ga('ecommerce:addTransaction', t{trans_data});

ga('clientTracker.ecommerce:addItem', {items_data});
ga('clientTracker.ecommerce:addTransaction', {trans_data});

ga('ecommerce:send');
ga('clientTracker.ecommerce:send');

Re: Ecommerce transactions when using Multiple Analytics tracking

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭
Hi Tomas,

Thanks for the detailed explanation.

With the code we're currently using we don't use any addItem or addTransaction calls.

We just use the standard universal tracking code, with the ecommerce option enable on the Analytics Dashboard, and it works fine. It tracks all the transactions and items of every purchase.

If we want to add an additional tracking code, shall we start using addItem and addTransaction for both codes, or just for the 'secondary' tracking code?

Thanks for your patience