Measure Cart Page Events

The following image is taken from the cart page view of the fictitious online store, TheGym. It contains elements that can trigger usage analytic events, such as how to Measure an Increase in Item Quantity in Cart or Measure a Decrease in Item Quantity in Cart.

TheGym Cart Page View

Tracking Commerce Events Prerequisites

Before each event, ensure that you’ve:

Measure an Increase in Item Quantity in Cart

The user has decided to purchase an additional product by increasing the cart quantity, and you want to measure this type of user interaction.

TheGym Increase Cart Quantity

Since the page is already loaded and the pageview event is logged, the data must be sent using generic event.

First, use the ec:addProduct command to include the relevant product data in the event you’re about to send:

coveoua('ec:addProduct', {
    'id': '034177201_YB',
    'name': 'Specter 2.0',
    'brand': 'la_sportiva',
    'category': 'sport/ski_mountaineering/boots',
    'price': 423.15,
    'variant': '034177201_YB_22',
    'position': 1,
    'quantity': 2
});

Then, use the ec:setAction command to specify that the action performed on this data is a product added to the cart:

coveoua('ec:setAction', 'add');

Finally, use the send command to send the event to Coveo UA:

If Then

The add action and product information is added before the see pageview event is sent

There’s no need to send the pageview event. The pageview event you previously configured on the page will contain the action and product information.

The user interaction didn’t open a new page

Manually send the add action with a generic event.

Measure a Decrease in Item Quantity in Cart

The user no longer wants to purchase an item and they remove the product from the cart. You want to measure this type of user interaction.

TheGym Remove From Cart View

First, use the ec:addProduct command to include the relevant product data in the event you’re about to send:

coveoua('ec:addProduct', {
    'id': '037212201_DKBL',
    'name': 'backland 120',
    'brand': 'Atomic',
    'category': 'sport/ski_mountaineering/boots',
    'variant': '037212201_DKBL_22',
    'price': 447.20,
    'quantity': 1
});

Then, use the ec:setAction command to specify that the action performed on this data is a product that was removed from the cart:

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

Finally, use the send command to send the event to Coveo UA:

If Then

The remove action and product information is added before the see pageview event is sent

There’s no need to send the pageview event. The pageview event you previously configured on the page will contain the action and product information.

The user interaction didn’t open a new page

Manually send the remove action with a generic event.

Recommended Articles