0
votes

We have an eCommerce website for one of our clients. On the payment confirmation/receipt page we have the Google Analytics eCommerce tracking code. Every so often certain orders do not register in Analytics, even though we know for certain that the user has been redirected back to that page and has remained there for several seconds. The code below for example will not register in Analytics no matter what:

ga('require', 'ecommerce');
ga('ecommerce:addTransaction', {
'id': '1842','affiliation': 'https://www.ourwebsite.com','revenue': '313.80','shipping': '0.00','tax': '52.30','currency': 'GBP'});
ga('ecommerce:addItem', {
'id': '1842','name': 'Product1','sku': 'Product1SKU','category': 'Category 1','price': '13.08','quantity': '10'});
ga('ecommerce:addItem', {
'id': '1842','name': 'Product1','sku': 'Product1SKU','category': 'Category 1','price': '13.08','quantity': '10'});
ga('ecommerce:send');

You will notice that the two order lines have the same SKU - this is because on the website even variants can be customised, i.e. different sizes / different colors - but they have the same SKU.

Can anyone see any reason why this particular example would not register in Analytics?

Thanks in advance

dotdev

1
Quantity is an integer! No a string. - Jakub Kriz
I dont think that is the issue, otherwise it would never work surely. It works 99% of the time. - dotdev

1 Answers

0
votes

I had the same problem and I think I found the answer here:

https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiEcommerce#_gat.GA_Tracker_._addItem

It states: Ensure that each item in your inventory has a unique SKU. If your inventory has different items with the same SKU, and a visitor purchases both of them, you will receive data for only the most recently added.

I used the analytics debug tool and fired my tracking tags again with a different sku and they got picked up. I hope this helps