Measure Events on a Listing or Search Page

The following image is taken from a Coveo-powered product listing page view of the fictitious online store TheGym. It contains elements that can trigger usage analytic events, such as how to Measure Impression Data on a Listing Page and how to Measure Product Clicks on a Search-driven Listing Page. The examples below also apply to search pages and will depend on your specific use case.

TheGym Listing Page View

Tracking Commerce Events Prerequisites

Before each event, ensure that you’ve:

Measure Impression Data on a Listing Page

The product listing (or search) page contains at least one main product impression, which is the main list of results that you see.

TheGym Listing Impression Data View

When the product listing (or search) page is powered by Coveo, the Coveo Search API logs impressions automatically to Coveo Analytics. However, there are some scenarios where manually logging impressions is required or recommended:

  • When the list is powered by Coveo, and you have a proxy (or equivalent process) that adds client-side data to product data.

  • When the list isn’t powered by Coveo, and you would like to compare impressions with and without Coveo.

To send an impression manually, use the following command:

coveoua('ec:addImpression', <DATA>)

Where you replace <DATA> with the product impression object containing the relevant fields. For reference information, see Impression Data Field Reference.

// Add the relevant product data.
coveoua('ec:addImpression', {
  'id': '037212201_DKBL',
  'name': 'backland 120',
  'brand': 'Atomic',
  'category': 'sport/ski_mountaineering/boots',
  'price': 447.20,
  'variant': '037212201_DKBL_22',
  'list': `<LIST_VALUE>`,
  'position': 1
});
coveoua('ec:addImpression', {
  'id': '036834601_WHBK',
  'name': 'mtn explore 100',
  'brand': 'salomon',
  'category': 'sport/ski_mountaineering/boots',
  'price': 429.95,
  'variant': '036834601_WHBK_22',
  'list': `<LIST_VALUE>`,
  'position': 2
});
coveoua('ec:addImpression', {
  'id': '035141901_WHT',
  'name': 'S1 carbon',
  'brand': 'scott',
  'category': 'sport/ski_mountaineering/boots',
  'price': 553.68,
  'variant': '035141901_WHT_22',
  'list': `<LIST_VALUE>`,
  'custom' : {
      'onSale' : true
    },
  'position': 3
});
//...

Where you would replace <LIST_VALUE> by one of the following:

  • If your product listing (or search) page is powered by Coveo, use coveo:search:${searchUid} (e.g, coveo:search:9f5da2cc-11ad-11ec-82a8-0242ac130003). For information on how to retrieve the searchUid, see Extract the SearchUid.

  • If your product listing (or search) page isn’t powered by Coveo, enter the name of your list (e.g., ski boot listing).

When you structure your items with product grouping, ensure you add the group field to the product dataset. This will send all related items in the analytics payload.

Then, use the ec:setAction command to specify that the action done on this data is to send the impression data:

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

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

If Then

The impression view action and product information is added before the 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 impression view action with a generic event.

Measure Product Clicks on a Search-driven Listing Page

On a search-driven listing page powered by the Coveo JavaScript Search Framework, you want to measure a product click event. In the image below, a user has searched for shoes and clicked on a product in the results list of fictitious online store, TheGym.

TheGym Product Click Search Page View

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

// add the relevant product data.
coveoua('ec:addProduct', {
  'id': '038327301_1400',
  'name': 'xa pro 3d gore-tex',
  'brand': 'salomon',
  'category': 'sport/hiking/shoes/trail running',
  'price': 112.00,
  'quantity': 1,
  'position': 3
});

When you structure your items with product grouping, ensure you add the group field to the product dataset. This will send all related items in the analytics payload.

Then, use the ec:setAction command to specify that the action done on this data is a product click:

// ...
coveoua('ec:setAction', 'click', {
  list: `<LIST_VALUE>`
});

Where you would replace <LIST_VALUE> by one of the following:

  • If your product listing (or search) page is powered by Coveo, use coveo:search:${searchUid} (e.g, coveo:search:9f5da2cc-11ad-11ec-82a8-0242ac130003). For information on how to retrieve the searchUid, see Extract the SearchUid.

  • If your product listing (or search) page isn’t powered by Coveo, enter the name of your list (e.g., running shoe listing).

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

If Then

The click action and product information is added before the 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 click action with a generic event.

What's Next for Me?