Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Analytics Enhanced Ecommerce - How to track cart quantity update?

Google doesn't say a word on how to deal with the user changing the quantity of a line in their cart using the Enhanced Ecommerce plugin.

When a user adds something to his cart, returns to the same cart in a later session and adds more of the same product it might occur that he gets a lower unit price (for example when price breaks are used by the e-commerce site).

So, for example, he first adds 1 unit for $3, comes back and raises the number to 10 and thereby only has to pay $2 for each unit.

Now the price previously sent to GA needs to be invalidated in some way.

There are multiple solutions for this, but each of them have some serious drawbacks:

1) Calculate the difference and add / remove that.

2) Remove the line and then add with current quantity.

Method 1 has the advantage of passing the (most) correct user interaction. Since add/remove doesn't seem to have a nonInteraction parameter, using method 2 would mean wrong numbers of adds/removes.

Method 2 has the advantage of being able to change the price if a price change has happened after the product has been added the first time. For example: after adding more units the customer now has a lower unit price. Using method 1 would mean that either the amounts in GA are incorrect, or you would have to calculate price differences and fictionally give the latest added units a lower price.

Which of the two methods is preferable?

like image 387
inwerpsel Avatar asked Jan 09 '17 10:01

inwerpsel


People also ask

How do you track add to cart in Google Analytics?

To view Add to Cart, go to Insights » Reports » eCommerce. Here you can see how your online store is performing. Find out the conversion rate, number of transactions, revenue, and average order value. Plus, you get to see your top products, their order quantity, percentage of sales, and total revenue.

How do I set up enhanced ecommerce tracking in Google Analytics?

In most implementations, you should enable Enhanced Ecommerce on each of your Universal Analytics pageview or event tags. You have two options for enabling Enhanced Ecommerce in the tag editor screen of the web interface: Implement using the Data Layer (Recommended) Implement using a Custom JavaScript Macro.

Can Google Analytics track purchases?

In Google Analytics, 'transactions' represent unique orders on your online store, and a 'unique purchase' measures the number of times a product was part of a transaction. Since transactions can include multiple products, the number of unique purchases is often higher than the number of transactions.


1 Answers

In a pure analytics.js implementation you do use

ga('ec:setAction', 'remove');

along with the product attributes describing the product being removed

see https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#add-remove-cart

// describes the product being removed
ga('ec:addProduct', {
    'id': product.id,
    'name': product.name,
    'category': product.category,
    'brand': product.brand,
    'variant': product.variant,
    'price': product.price,
    'quantity': product.qty
  });
ga('ec:setAction', 'remove'); // notice 'remove' here
ga('send', 'event', 'UX', 'click', 'removed from cart'); // sends the action

If you are using GTM and GA native tags in GTM, see https://developers.google.com/tag-manager/enhanced-ecommerce#add and the remove section

// Measure the removal of a product from a shopping cart.
dataLayer.push({
  'event': 'removeFromCart',
  'ecommerce': {
    'remove': {                               // 'remove' actionFieldObject measures.
      'products': [{                          //  removing a product to a shopping cart.
          'name': 'Triblend Android T-Shirt',
          'id': '12345',
          'price': '15.25',
          'brand': 'Google',
          'category': 'Apparel',
          'variant': 'Gray',
          'quantity': 1
      }]
    }
  }
});
like image 179
Open SEO Avatar answered Sep 26 '22 01:09

Open SEO