6
votes

I'm trying to figure out why the Ecommerce tracking in Google Analytics doesn't seem to work. I can see the page views correctly tracked but no transactions.

Snippet from the confirmation page:

<head>
<script type="text/javascript">
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-XXXXXXX-1']);
    _gaq.push(['_setDomainName', '.mydomain.com']);
    _gaq.push(['_trackPageview']);

    _gaq.push(['b._setAccount', 'UA-YYYYYYYY-1']);
    _gaq.push(['b._setDomainName', 'none']);
    _gaq.push(['b._addTrans',
                  '44bbd391-ff38-4f8d-ad68-aec490666151',
                  'Name',
                  '1.00',
                  '',
                  '',
                  '',
                  '',
                  ''
              ]);
    _gaq.push(['b._addItem',
                  '44bbd391-ff38-4f8d-ad68-aec490666151',
                  '15',
                  'test',
                  '',
                  '1.00',
                  '1'
              ]);
    _gaq.push(['b._trackTrans']);

    _gaq.push(['b._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>

...
</head>

I'm monitoring the traffic on the page with Firebug confirming that all pixel requests were made and came back OK.

I read about having to wait a few hours, up to one day, before you can see results in GA, but I can see the page views after only waiting a few minutes.

However, the transactions tracked using the same tracker object ("b") are not to be found anywhere(could the Ecommerce reports be refreshing slower than the page views?)

1
How long have you been waiting? Though, anecdotally, I've actually found the eCommerce data to be extraordinarily fast to process. - Yahel
It's been a few hours and still nothing. I don't think it's the wait time because, as I said, page views tracked at the same time are appearing just fine. I'm investigating further and keep this place updated, hopefully some will find it useful. - CyberDude

1 Answers

7
votes

And I finally found the issue. The answer is inconspicuously present on the GA docs page:

_trackTrans()

Sends both the transaction and item data to the Google Analytics server. This method should be called after _trackPageview(), and used in conjunction with the _addItem() and addTrans() methods.

It's rather easy to overlook but it has such a fundamental effect: transactions won't be tracked.

So yes, always call _trackTrans after _trackPageview!