Log commerce events

This is for:

Developer
In this article
Important

The Event Protocol and Relay library are currently in early access. If you’re interested in using the Event Protocol and Relay library, reach out to your Customer Success Manager (CSM).

To create reports and power Coveo Machine Learning models, it’s crucial to track user interactions with your search interfaces. You can do this by sending events to the Coveo Usage Analytics (Coveo UA) service.

Two exclusive approaches exist with regards to collecting analytics data: the direct approach client side, and the recommended tag management approach through data layers, logging events through the use of tag management systems, such as Google Tag Manager, Tealium and Adobe Launch. The data layer approach reduces the amount of page loading time and decreases maintenance. For an introduction, see the Implement commerce event tracking course.

Libraries

To build your search interfaces, we recommend using the Coveo search UI libraries (Coveo Atomic & Coveo Headless) because they automatically take care of sending many analytics events. In addition to the events logged by these UI libraries, you must also log specific commerce events that track behaviors, such as when a purchase is made or when a product is added to a cart. To track such events, Coveo offers two protocols: Event Protocol or Coveo UA Protocol.

It’s recommended to use the Event Protocol for new Coveo for Commerce implementations. It simplifies event tracking by reducing the number of events you need to send to Coveo. The protocol also simplifies the event payload, requiring fewer fields and eliminating optional ones for clarity.

For existing implementations, continue with the Coveo UA Protocol as content is developed to assist in your migration to the new Event Protocol.

The following table summarizes the two protocols, the front-end libraries you can use to send events, and the underlying API to which the events are sent to.

Important

By default, Coveo search UI libraries log usage analytics events even when end users reject cookies. You must implement a mechanism to prevent logging events when end users reject cookies. Not doing so pollutes your usage analytics data and affects data health.

Name Tracking library Underlying API

New

Event Protocol

Relay

Event API

Legacy

Coveo UA Protocol

coveoua

Usage Analytics Write API