Recording event data problem in google analytics ecommerce - google-analytics

I'm implementing enhanced ecommerce in Google Analytics and I have a problem.
When the purchase of a product is made, it's redirected to a thanks page and that's where the Purchase event is sent to Analytics.
ga('require', 'ec');
ga('set', 'currencyCode', 'EUR');
ga('ec:addProduct', {
'id': 'prueba-001',
'name': 'Prueba',
'brand': 'Prueba',
'category': 'Prueba',
'variant': 'Prueba',
'price': 10.50
});
ga('ec:setAction', 'purchase', {
'id': 't-prueba-01',
'revenue': 5.50
});
ga('send', 'pageview');
The 'purchase' event is recorded perfectly, but the addProduct event is not quite right, the unique purchases of each product are registered but nothing else.
I don't know what else to do, I have followed the steps in the documentation and the problem persists.
Edit:
Sales report

Try to use quote for price and revenue (for consistency with the documentation) and above all add the quantity parameter to the product.

Related

Google analytics add to cart quantity

We use this code format in google analytics corresponding to add to cart feature of google analytics.
function addToCarts() {
ga('ec:addProduct', {
'id': '12334',
'name': 'methyly methly',
'category': 'Clothing',
'brand': '',
'variant': '',
'price': '100',
'quantity': 40
});
ga('ec:setAction', 'add');
// send this using event
ga('send', 'event', 'enhanced ecommerce', 'button click', 'add to cart');
}
addToCarts();
Where in google analtics convertion tab----->Enhanced ecommerce i can see quantity of product added?.Their is one section in google analytics conversion---->Enhanced ecommerce--->shopping behaviour--->Products add to cart(metric). But it only reflect how many times product was added to cart but not how many qunatity of that product to cart.
You can find the quantity in Summary tab of the report: Conversions-->Ecommerce-->Product performace (Summary tab).

Google Enhanced E-Commerce Tracking not working

I tried the follwoing code
ga('create', 'UA-111563164-2', 'auto');
ga('require', 'ec');
ga('ec:addImpression', { // Provide product details in an impressionFieldObject.
'id': 'trip-to-fairy-meadows-and-nanga-parbat-base-camp-by-directions-explore-with-us', // Product ID (string).
'name': 'TRIP TO FAIRY MEADOWS AND NANGA PARBAT BASE CAMP', // Product name (string).
'brand': 'DIRECTIONS - EXPLORE WITH US', // Product brand (string). // Product variant (string).
'category': 'Apparel/T-Shirts',
'variant': 'black',
'list': 'Search Results',
'position': 1
});
ga('ec:addImpression', {
'id': 'P67890',
'name': 'YouTube Organic T-Shirt',
'category': 'Apparel/T-Shirts',
'brand': 'YouTube',
'variant': 'gray',
'list': 'Search Results',
'position': 2
});
ga('send', 'pageview');
The code is written in angular 4 and i am using angulartics2 library. the data is not push toward to the google analytics.
Your code looks fine and should work as intended. The reason you are not seeing any data is likely because Google Analytics data processing latency.
Processing latency is 24-48 hours. Standard accounts that send more than 200,000 sessions per day to Analytics will result in the reports being refreshed only once a day. This can delay updates to reports and metrics for up to two days. To restore intra-day processing, reduce the number of sessions your account sends to < 200,000 per day.
For Analytics 360 accounts, this limit is extended to 2 billion hits per month.
More in Google Analytics official documentation: https://support.google.com/analytics/answer/1070983?hl=en

I can not get Google Analytics to send commerce data

I rewrote this post to be clearer and to simplify the problem that I am having.
I am trying to get e-commerce data to send to Google Analytics. I am using the most basic set up to send one test transaction based on their example setup.
Google tag manager is showing the transaction, but it is not making it to the Google Analytics dashboard Conversions > Ecommerce > Overview
I have enabled Ecommerce under view in the admin panel, but no data? This is probably something simple - but I can't find it. (sample GA ID, using the proper ID in my code and the pages are tracking fine in the dashboard, just no Ecommerce data)
Here is my code:
<script type="text/javascript">
(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','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-1234567-1', 'auto');
ga('send', 'pageview');
ga('require', 'ecommerce');
console.log('order placed');
ga('ecommerce:addTransaction', {
'id': '1234', // Transaction ID. Required.
'affiliation': 'Acme Clothing', // Affiliation or store name.
'revenue': '11.99', // Grand Total.
'shipping': '5', // Shipping.
'tax': '1.29' // Tax.
});
ga('ecommerce:addItem', {
'id': '1234', // Transaction ID. Required.
'name': 'Fluffy Pink Bunnies', // Product name. Required.
'sku': 'DD23444', // SKU/code.
'category': 'Party Toys', // Category or variation.
'price': '11.99', // Unit price.
'quantity': '1' // Quantity.
});
ga('ecommerce:send');
ga('ecommerce:clear');

Revenue always zero for addtransaction

I am implementing addItem and addTransaction on a web shop's cart page. Once an order has been placed, I go through the carts content and add each individual item as an addItem with google analytics ecommerce plugin, then I create the transaction and send it altogether to google.
What happens in google analytics is that all transactions show up as having 0 revenue, 0 tax and 0 shipping - but if I enter one individual transaction I can see the item price, name and quantity ordered.
This is the final executing google analytics code once rendered:
ga('require', 'ecommerce');
ga('ecommerce:addItem', { 'id': '143506092300', 'name': 'PRODUCT NAME #1 , COLOR Black', 'price': '229.00', 'quantity': '1'});
ga('ecommerce:addTransaction', { 'id': 'xxx123', 'affiliation': 'Web Shop Name', 'revenue': '229.00', 'shipping': '0.00', 'tax': '45.80'});
ga('ecommerce:send');
Does anyone see what I'm missing here?
So I had two issues:
the ID in the addItem block was actually the product ID, but it is supposed to be the transaction ID.
The solution was to have the same ID in all addItem calls and this ID in the transaction call.
Additionally, the transaction code should appear before the addItem calls, the following works for me:
ga('require', 'ecommerce');
ga('ecommerce:addTransaction', { 'id': '143506092300', 'affiliation': 'Web Shop Name', 'revenue': '229.00', 'shipping': '0.00', 'tax': '45.80'});
ga('ecommerce:addItem', { 'id': '143506092300', 'name': 'PRODUCT NAME #1 , COLOR Black', 'price': '229.00', 'quantity': '1'});
ga('ecommerce:send');

Google Analytics Enhanced Ecommerce - Track Product View with 'event' rather than 'pageview'

Is this acceptable? Calling the pageview in the header, and then sending an event(s) further down the page?
//head
ga('create', 'UA-XXXXX-Y');
ga('require', 'ec');
ga('send', 'pageview');
//inside product details/body
ga('ec:addProduct', {
'id': 'P12345',
'name': 'Android Warhol T-Shirt',
'category': 'Apparel',
'brand': 'Google',
'variant': 'black'
});
ga('ec:setAction', 'detail');
ga('send', 'event')
Would this be better practice?
//head
ga('create', 'UA-XXXXX-Y');
ga('require', 'ec');
//inside product details/body
ga('ec:addProduct', {
'id': 'P12345',
'name': 'Android Warhol T-Shirt',
'category': 'Apparel',
'brand': 'Google',
'variant': 'black'
});
ga('ec:setAction', 'detail');
//somewhere near footer
ga('send', 'pageview');
Yes, your suggested ga('send', 'pageview') at the bottom is the correct way.
Since you "know" when you render the page that the visitor will see the product detail page you might as well send it with the page view.
Use an event to send enhanced ecommerce tracking that hasn't happened when the page renders, like if the visitor adds the product to their cart. Use a non-interaction event to make it not affect bounce rate (and as suggested above, you should specify a category and an action for your event).
In terms of the syntax for the event push, when you send an event to GA, you have to include the category and action (as specified here https://developers.google.com/analytics/devguides/collection/analyticsjs/events). So you would have in your event push:
ga('send', 'event', 'eventCategory', 'eventAction');
Your eCommerce transaction looks fine.
Not sure about the strategy of sending an event with your pageview though. Usually an event is associated with some action (like a button or link click).
Hope this helps.

Resources