Hello DTM Experts,
We are using Google Analytics as out analytics tool. However, we use DTM as our tag manager due to our core site being under AEM. We want to rollout DTM on our other platforms like Hybris etc. But I am facing a problem. I am not able to track GA Enhanced E-Commerce data using GA as a tool within DTM. There seems to be no documentation or article on the internet.
Has anyone within this community successfully implemented GA EEC tracking using DTM. If yes, can you advise the method?
Thanks and regards,
Vish
Solved! Go to Solution.
Hi Umang,
If you are currently using ga.js, you will need to first migrate to analytics.js before using the enhanced ecommerce plug-in. Transaction and item data previously collected using the ecommerce.js plug-in will not be affected by the migration and will remain available in the properties and profiles to which they were originally sent. Please see the following link for more information regarding the same. https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce
To include ecommerce or advanced ecommerce library you have to setup the require in the GA tool pageCode. Something like:
ga('dtm_ga_standard.require', 'ec');
To use it you have to create custom third party tag in the correct pageLoad rule in order to setup advanced ecommerce tracking, something like:
ga('dtm_ga_standard.ec:setAction', 'purchase', {
id: s_orderid,
affiliation: s_orderid,
revenue: order_total,
tax: '0',
shipping: pageViewData.shipment_cost,
coupon: ''
});
ga('dtm_ga_standard.send', 'pageview');
Be sure to prevent in the tool custom page code the standard page view using the commend:
return false
When the ecommerce page load rule is running.
Thanks & Regards
Parit Mittal
Views
Replies
Total Likes
Hi Umang,
If you are currently using ga.js, you will need to first migrate to analytics.js before using the enhanced ecommerce plug-in. Transaction and item data previously collected using the ecommerce.js plug-in will not be affected by the migration and will remain available in the properties and profiles to which they were originally sent. Please see the following link for more information regarding the same. https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce
To include ecommerce or advanced ecommerce library you have to setup the require in the GA tool pageCode. Something like:
ga('dtm_ga_standard.require', 'ec');
To use it you have to create custom third party tag in the correct pageLoad rule in order to setup advanced ecommerce tracking, something like:
ga('dtm_ga_standard.ec:setAction', 'purchase', {
id: s_orderid,
affiliation: s_orderid,
revenue: order_total,
tax: '0',
shipping: pageViewData.shipment_cost,
coupon: ''
});
ga('dtm_ga_standard.send', 'pageview');
Be sure to prevent in the tool custom page code the standard page view using the commend:
return false
When the ecommerce page load rule is running.
Thanks & Regards
Parit Mittal
Views
Replies
Total Likes
Hi Parit,
Thanks for coming back quickly. Following are the clarification needed with regards to your points above:
Thanks again for your help.
Kind regards,
Umang
Views
Replies
Total Likes
Hi Umang,
Please find below my comments in line to your queries. Please let me know if you have any questions or queries.
We are using Google Universal Analytics in our GA Tool as a tool type. I am assuming this should load analytics.js not ga.js as we simply use DTM tool to specify our GA Account. // Yes this will load analytics.js only so no need to worry about it .
Is "ga('dtm_ga_standard.require', 'ec');" the standard method to call a GA plugin within DTM? //
To reduce the size of the analytics.js library, enhanced ecommerce tracking is not provided in the default library. Instead it is provided as a plugin module that must be loaded before being used. It
is basically a method to load the enhanced ecommerce plugin.I understand the action on pageLoad rule "ga('dtm_ga_standard.ec:setAction', 'purchase', {", can we also use other actions, for example 'add', 'remove' etc. on click and see it firing with onClick event? //
yes you call also set other actions also, Please see the following link on How to set other actions - https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce
Do we need to add return false with on click events as well? // Ideally we shouldn't add return false with on click events. Following is the example of "Add" functionality .
function addToCart(product) {What is s_orderid here. I am assuming it is a data element needed to be defined within DTM to capture the order id. If not can you please advise if it is not an standard DTM variable. // yes these are data elements, you can also use some other techniques to fetch the value for the parameters such as revenue, id etc.
Kind regards,
Parit Mittal
Views
Replies
Total Likes
HI Parit,
Following is my configuration:
ga('dtm_ga_standard.require', 'ec');
ga('ec:addImpression', { 'id': 'P12345', 'name': 'Warhol T-Shirt', 'category': 'Apparel/T-Shirts', 'brand': 'Adobe', 'variant': 'Black', 'list': 'Search Results', 'position': 1, 'dimension1': 'Member' }); ga('ec:setAction', 'detail'); ga('send', 'pageview');
ga('ec:addProduct', { 'id': _satellite.getVar("ECommerce - Product Code"), 'name': 'test name', 'category': 'test category', 'brand': 'ResMed', 'variant': 'test - variant', 'price': 'test price', 'quantity': 'test qty' }); ga('ec:setAction', 'add'); ga('send', 'event', 'UX', 'click', 'add to cart');
On loading of page and click of Add to cart buttons, I can see the events getting fired in console, but I don't see any data being captured in Google Analytics reports.
On a secondary note, in your first example you have referred function ga('dtm_ga_standard.ec:setAction', 'purchase' whereas in your second example you have quoted function ga('ec:addProduct'. What is the difference in these two methods? Which one is correct in context of Google Universal Analytics?
Thanks and regards,
Umang
Views
Replies
Total Likes
Hi Umang,
"Add Product" like actions are measured by using the ec:addProduct command with a productFieldObject to add product details, and the ec:setAction command to specify the action being performed while we measure transaction action like "Purchase" by using the ec:setAction command and setting the action type to purchase. Transaction level details like total revenue, tax, and shipping are provided in an actionFieldObject.
Also, Please replace the line ga('dtm_ga_standard.require', 'ec') to ga('require', 'ec') and then check whether the data has been sent to Google Analytics reports or not .
If the problem still persists then please check whether the tracker name is set correctly or not in the tool setting of Google Universal Analytics. If you have specified that Google Analytics is already installed on your site's pages, you **must** use the same name here for proper data collection. The default tracker name for Google Analytics is blank. Generally in the legacy implementations we use the following line to create the tracker object.
ga('create', 'UA-XXXXX-Y', 'auto');
Also, Please verify whether the the correct Account Id's have been set in the GA tool settings for Production and Staging account.
Thanks & Regards
Parit Mittal
Views
Replies
Total Likes
Hi Parit,
Is it possible to have a session with you to share my screen and see if there is anything wrong I am doing?
Dear umang1,
Were you able to find a solution for this issue? I am facing the same problem and I was wondering if you were able to fix it and if so how.
Thank you!
Views
Likes
Replies
Views
Likes
Replies