0
votes

I have used the following code in Google Analytics and I confirm that it works for me because I can see data in the Google Analytics dashboard:

ga('require', 'ecommerce');
ga('ecommerce:addTransaction', {
    'id': '<?php echo $product_id ?>',
    'revenue': '<?php echo $revenue_amount ?>',
});

Now I am trying this but I am not receiving data in the Google Analytics dashboard:

// Require the Enhanced Ecommerce plugin for use with the default tracker.
ga('require', 'ec');
// Call the Enhanced Ecommerce plugin's addProduct method.
ga('ec:addProduct', {
  'id': 'P12345',
  'name': 'Android Warhol T-Shirt',
  'category': 'Apparel',
  'brand': 'Google',
  'variant': 'black'
});

What is the difference between using ga('require', 'ecommerce'); and ga('require', 'ec');?

I am reading https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce and https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce and it seems to me that ga('require', 'ecommerce'); is for the Ecommerce plugin, and ga('require', 'ec'); is for the Enhanced Ecommerce plugin. I just wanted to confirm this information and if there are any conflicting issues when using both Ecommerce and Enhanced Ecommerce. As I said, my implementation of ga('require', 'ecommerce'); is working correctly but ga('require', 'ec'); is not. Thank you.

1
I just read at developers.google.com/analytics/devguides/collection/… this: "Important: The Ecommerce plug-in should not be used alongside the Enhanced Ecommerce (ec.js) plug-in." - Jaime Montoya

1 Answers

2
votes

These are two different GA plugins with a different set of features that feed into different reports.

That is why you need to choose between standard e-commerce tracking and EEC in your view settings - Enhanced E-Commerce tracking enables a set of additional reports, including product list tracking, refunds, voucher tracking, checkout funnels etc. that are not available with the standard tracking (which is limited to transaction tracking).

And as you found out yourself implementation-wise the plugins are not compatible. You need to choose one or the other and use the appropriate code, EEC features will not work with standard e-commerce-tracking.