Commerce Data Health Implementation Guide

This article guides you on how to set up a Coveo Usage Analytics (Coveo UA) library for Coveo for Commerce. It outlines the implementation steps, and covers the various events to implement, as well as prerequisites and best practices.

Collecting commerce events allows you to trace a user’s journey through your commerce site by providing you with accurate data on the user’s interaction with various elements on your site. The collected data also feeds attribution dashboards, which you can review on the Data Health Dashboard, and machine learning (ML) models which will ultimately help fine-tune the relevance of your site.


  1. Access to a Coveo organization that you can manage from the Administration Console. If you have never used the Coveo Administration Console before, log in now.

  2. To use the Coveo UA library, authentication credentials need to be passed in the form of an API key.

How the Script Is Used

The script is used to send events to the Coveo UA service.

The first parameter is always a command name, and the other parameters vary depending on the executed command.

Collect Commerce Events Flow

Step 1: Initialize the Coveo Analytics JavaScript

The init command is used to initialize the script and must be called once on each page. See Initialize the Coveo Analytics JavaScript.

Step 2: Set Global Fields

Some commands allow setting data where fields parameters can be set for the entire page. Fields can be set with coveoua("set", <FIELD_NAME>, <FIELD_VALUE>). For example, to set a currency parameter, use coveoua('set', 'currencyCode', 'EUR'). For reference information, see Global Fields References.

Step 3: Send Page View

While not specific to commerce events, page views are an essential piece of information that need to be collected to measure user behavior. A pageview event must be sent on every page of your site. This is the most important event as it gets cumulated data and sends the events to Coveo Usage Analytics.

Step 4: Add Product Data

The coveoua('ec:addProduct', <DATA>) command lets you include the relevant product data in the event you’re about to send. For reference information, see Product Data Fields Reference.

Step 5: Set the Action

The coveoua('ec:setAction', <ACTION>) command lets you set the executed action on your data. See Product Action Type Reference.

Step 6: Add Impression Data

Depending on your specific use case, you can add impression data from various pages, such as a product detail page or listing or search page.

Step 7: Cart and Purchase Events

The same principles apply when you update cart items and make purchases.

Step 8: Send Events

Depending on the way the page has been created, to send an event to Coveo UA, either a page view or generic event must be sent.

Step 9: Measure and Optimize the Personalization Experience

Finally, access the built-in dahsboards in the Administration Console to review your data health and fix validation errors.


All reference documentation can be found on the Commerce Events Reference page.


TheGym Demo Page Screencapture

To help understand the usage of tracking commerce events, you can explore the following pages. They’re based on a fictitious online store called TheGym, and capture the customer’s journey along the way.