Upgrade from v1 to v2

This is for:

Developer
Important

The Event Protocol and Coveo Relay library are generally available for Commerce.

However, they’re in closed beta for Coveo for Service, Website, and Workplace implementations. If you’re interested in using the Event Protocol and Relay library for these implementations, contact your customer success manager (CSM).

Important
The following are breaking changes from Relay v1 to v2

Environment changes

The Environment interface now exports getClientId which replaces the previous generateUUID method, simplifying the interactions required.

generateUUID has been deprecated, along with the entire Storage interface.

This breaking change will affect customers a custom Relay environment, which is a small subset of implementations.

The following are non-breaking changes from Relay v1 to v2

sendBeacon deprecation

Relay now uses fetch with keepalive instead of navigator.sendBeacon to transmit analytics events, since keepalive is now supported by all major browsers (including Firefox 133+).

The change ensures event payloads are visible in browser developer tools, and enhances security by making it possible to pass authentication tokens via request headers instead of the request URL. The keepalive option preserves the same delivery guarantees as sendBeacon, ensuring events are sent even when the page is being unloaded.

As part of the change, the emit method is now asynchronous and returns a Promise. Relay will also throw an error if an event doesn’t conform to the base Event Protocol payload structure.