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.