How to check whether the product was shortlisted before adding to cart? (Google Analytics Enhanced Ecommerce)



Business Objective: It will answer your business question of how many people move product from shortlist to cart and after how many days.

I still remember a client who was looking for the below output which is quite interesting and useful in an e-commerce business.




Add to Shortlist: Currently, we get an “add to cart” in an enhanced e-commerce section of the Google Analytics, in order to get an “add to shortlist” we will need to pass a custom metric with product scope. Please note that this approach is session independent means even if the session is over we can come and move product from shortlist to cart and desired result will get achieved.


from shortlist to cart



Implementation steps:
On click of an “Add to Cart” check whether same product is present in add to shortlist or not if present then sends metric value as 1 else 0.

Sample code:

// Measure adding a product to a shopping cart by using an ‘add’ actionFieldObject
// and a list of productFieldObjects.

‘event’: ‘addToCart’,
‘ecommerce’: {
‘currencyCode’: ‘INR’,
‘add’: { // ‘add’ actionFieldObject measures.
“list”: “similar”
‘products’: [{ // adding a product to a shopping cart.
‘name’: ‘Bed sheet’,
‘id’: ‘12345’,
‘price’: ‘15.25’,
‘brand’: ‘Google’,
‘category’: ‘Apparel’,
‘variant’: ‘Gray’,
‘quantity’: 1,
‘metric1’: ‘1’ //check whether the same product is present in an “Add to Shortlist” or not, if present sent 1 as a value else 0.

Please note: Above code is same as Add to Cart, only we have added one line “mertric1”. We have made a custom metric (name = “add to shortlist”, scope = “product”)

In order to see the required output, you will need to create a custom report in the Google Analytics

Please follow and like us:

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *