Collect Commerce Events

Collecting commerce events is a valuable feature that lets you obtain an accurate account of a user’s interaction with elements of your commerce site. This data will let you create a true image of a user’s journey. It will also feed attribution dashboards and machine learning (ML) models which will ultimately help fine tune the relevance of your site.

How the Script Is Used

The script is used to send events to the Coveo Usage Analytics (Coveo UA) service. The library accepts a format similar to the Google Analytics tag (also called the analytics.js library).

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

Collect Commerce Events Flow


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

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.

Send Page View

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.

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.

Set the Action

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

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.

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.


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.

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

What's Next for Me?