0

I recently upgraded to (Google) Universal Analytics but since the upgrade no product information is appearing in my Conversions reports. But, transactions do appear as do all of the other usual Analytics data. It appears that the 'ecommerce:addTransaction' is working fine but the 'ecommerce:addItem' is having problems.

Here is the js that gets written out on the page:

<script>
  (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-XXXXXX-X', 'XXXXXXXXXXX.com');
  ga('send', 'pageview');

</script>
<!-- Analytics Conversions Tracking -->
<script>
ga('require', 'ecommerce', 'ecommerce.js');

ga('ecommerce:addTransaction', {
  'id': 'WEB7014997',                     // Transaction ID. Required
  'affiliation': 'NA',   // Affiliation or store name
  'revenue': '0.120000',               // Grand Total
  'shipping': '0.000000',                  // Shipping
  'tax': '0.020000'                     // Tax
});

ga('ecommerce:addItem', {
  'id': 'WEB7014997',                     // Transaction ID. Required
  'name': 'Test Product | Fresh Air',                // Product name. Required
  'sku': '9999999-99',                    // SKU/code
  'category': 'RT',       // Category or variation
  'price': '0.050000',                 // Unit price
  'quantity': '2.000000'                   // Quantity
});

ga('ecommerce:send');      // Send transaction and item data to Google Analytics.

</script>

In the above I have split the script tags so that the top part can appear on every page and then the bottom part just appears on the order confirmation page. I have tried combining into a single script tag but this didn't solve the problem.

Could the hyphen in the SKU or the number of decimal places in PRICE or QUANTITY be causing a problem? Or is there just a typo that I can't see?

Any help appreciated!

John

3
  • The dots or dashes shouldn't be a problem because they are properly wrapped in the single quotes. Have you tried it with Google Analytics debugger? chrome.google.com/webstore/detail/google-analytics-debugger/…
    – NicoM
    Commented Jan 14, 2014 at 19:16
  • No, but I will now!
    – johncross85
    Commented Jan 15, 2014 at 11:30
  • Hmmm... no errors in the debugger but it does show this: analytics_debug.js:9 <unknown> (&ic) 9999999-99 analytics_debug.js:9 <unknown> (&in) Test Product | Fresh Air analytics_debug.js:9 <unknown> (&ip) 0.050000 analytics_debug.js:9 <unknown> (&iq) 1.000000 analytics_debug.js:9 <unknown> (&iv) RT analytics_debug.js:9 adSenseId (&a) 1188481922 analytics_debug.js:9 apiVersion (&v) 1 analytics_debug.js:9
    – johncross85
    Commented Jan 21, 2014 at 11:56

1 Answer 1

0

John, everything seems to be fine except the number-formats. Make sure you include only 2 decimal places, with quantity being a whole number. I am pretty sure this might be causing the issues.

11
  • Okay, will try thanks. Annoyingly that is how the e-commerce platforms spits out the values. I guess I'll have to add in some javascript to round them off.
    – johncross85
    Commented Jan 20, 2014 at 8:53
  • Simply JS should do... please let me know if this helped. :)
    – Petr Havlík
    Commented Jan 20, 2014 at 16:53
  • Ive added in the rounding off but it still looks like its messed up when I use GA Debug: analytics_debug.js:9 <unknown> (&ic) 9999999-99 analytics_debug.js:9 <unknown> (&in) Test Product | Fresh Air analytics_debug.js:9 <unknown> (&ip) 0.05 analytics_debug.js:9 <unknown> (&iq) 1 analytics_debug.js:9 <unknown> (&iv) RT analytics_debug.js:9 adSenseId (&a) 1064725295 analytics_debug.js:9
    – johncross85
    Commented Jan 21, 2014 at 12:13
  • Good grief, I wish I knew how to do line returns in comments!!
    – johncross85
    Commented Jan 21, 2014 at 12:18
  • John, just send a link :)
    – Petr Havlík
    Commented Jan 21, 2014 at 13:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.