User journey validation

This is for:

Developer

This article explains how to validate the proper operation of a basic customer user journey. This verification ensures the correct sequence of Event Protocol usage analytics events is sent to Coveo and that the data remains consistent across events.

What’s a user journey?

A user journey is the sequence of actions a user may take while in a Coveo-powered commerce implementation. Actions are tracked as usage analytics events. Think of it as a path made up of different steps, all linked together like a story. It’s crucial to make sure that the sequence of events sent to track this journey is consistent and that the information between these events aligns correctly to validate the effectiveness of your Coveo implementation.

Key validation factors

To effectively test a user journey, you need to emulate the experience of a customer visiting your site. As you analyze the journey, consider the following:

  • Appropriate event triggering: Confirm that the correct event is sent based on the relevant user interactions, as per the Event Protocol reference documentation. For instance, when a product is added to the cart, ensure that the corresponding ec.cartAction event is logged.

  • Consistent client ID: Ensure that the client ID value is the same throughout all events.

  • Alignment of product IDs: Verify that the product ID in events corresponds with the value in the index and catalog object configuration. This alignment should remain consistent across all events related to the same product, including actions such as clicks, adding to cart, and purchases.

  • Alignment of tracking IDs: Verify the accurate transmission of the trackingId field, ensuring its consistency across events.

  • Event duplication: Ensure that duplicate events aren’t being triggered by verifying the outgoing network requests.

  • Payload content: Validate that the payload of each event contains the necessary fields, as per the Event Protocol reference documentation. If you are using the Relay library and Chrome, we strongly recommend using the Coveo Explorer to carry out these validations automatically. Otherwise, you’ll have to meticulously validate each payload parameter yourself.

    Finally, in either case, you’ll want to validate payload quality with the help of the Coveo Administration Console Data Health (platform-ca | platform-eu | platform-au) page.

In the following section, we will walk you through a specific user journey and verify the above criteria.

Sample user journey

Outlined below is a sample user journey. You can replicate this user journey for your implementation by following the steps shown. While interacting with your site, pay close attention to the events transmitted to Coveo and validate the specified checks in this section. Examine these events using the Network tab in your browser’s developer tools. Subsequently, compare these events with the observations alongside the data presented in the Coveo Administration Console Data Health Event browser (platform-ca | platform-eu | platform-au).

From a high level perspective, the following is what the user journey will look like:

Search → Click on a product → Product detail page (PDP) → Add to cart → Purchase

  1. Search: User types a keyword or phrase into the search bar.

  2. Product click: User clicks a product from the search results.

  3. Product detail page (PDP): User views detailed information about the selected product.

  4. Add to cart: User clicks the "Add to Cart" button on the product detail page.

  5. Purchase: User completes the purchase by going through the checkout process.

Perform a search.

Search

As the Event Protocol uses server-side logging of search events, the search event is automatically logged by the Commerce API when a user performs a search. Nothing to validate yet, but you’ll be able to see the search event in the Data Health Event browser later on.

Product click

Click a product on the search results page.

Click

On your browser tools' network tab, observe a POST request sent to <ORG_ID>.analytics.org.coveo.com/rest/organizations/<ORG_ID>/events/v1.

Validate that a click event is logged therein, with a payload as shown in the following example.

{
  "currency": "USD",
  "product": {
    "productId": "SP00944_00002",
    "name": "Kevlar Kayak",
    "price": 2450
  },
  "position": 1,
  "responseId": "0e412d5a-47dc-4c0d-9134-6e4d405febc1",
  "meta": {
    "type": "ec.productClick",
    "config": {
      "trackingId": "sports"
    },
    "ts": 1715888148155,
    "source": [
      "@coveo/headless@2.63.2",
      "relay@0.7.7"
    ],
    "clientId": "de50f46a-95da-4cf6-b31f-b8b3fa25abb9",
    "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36",
    "referrer": null,
    "location": "https://sports-dev.barca.group/commerce-search#q=kayak"
  }
}

Take note of the payload. You’ll need it for the subsequent steps.

Also, on your browser tools' network tab, observe a POST request sent to <ORG_ID>.coveo.com/rest/search/v2 and make sure that the searchUid included in the response matches the responseId logged in the click event (0e412d5a-47dc-4c0d-9134-6e4d405febc1 in this example).

If you’re using Relay and Explorer, Explorer will validate the rest of the click event payload for you. Otherwise, validate in detail the payload as per the product click event reference.

PDP

Once clicked upon, the PDP will display more information about the product.

View a product

On opening the PDP, observe the following:

[
  {
    "currency": "USD",
    "product": {
      "productId": "SP00944_00002",
      "name": "Kevlar Kayak",
      "price": 2450
    },
    "meta": {
      "type": "ec.productView",
      "config": {
        "trackingId": "sports"
      },
      "ts": 1715888148393,
      "source": [
        "relay@0.7.7"
      ],
      "clientId": "de50f46a-95da-4cf6-b31f-b8b3fa25abb9",
      "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36",
      "referrer": null,
      "location": "https://sports-dev.barca.group/pdp/SP00944_00002?model=SP00944"
    }
  }
]
  • Confirm that:

    • meta.type is now ec.productView.

    • The meta.clientId, meta.config.trackingId and product.productId are consistent with the previous event.

If you’re using Relay and Explorer, Explorer will take care of the rest of the validations for you. Otherwise, also validate in detail the rest of the payload as per the product view event reference. Validate especially that:

  • The responseId is no longer present.

  • The position is no longer present.

  • The meta.ts value, which is the timestamp, has been increased.

  • The meta.location field should now point to the PDP URL.

Add to cart

Select the "Add to Cart" button.

Visit Browser

A cart event is logged, with a payload as shown in the following example.

[
  {
    "action": "add",
    "currency": "USD",
    "quantity": 1,
    "product": {
      "productId": "SP00944_00002",
      "name": "Kevlar Kayak",
      "price": 2450
    },
    "meta": {
      "type": "ec.cartAction",
      "config": {
        "trackingId": "sports"
      },
      "ts": 1715888495140,
      "source": [
        "@coveo/headless@2.63.2",
        "relay@0.7.7"
      ],
      "clientId": "de50f46a-95da-4cf6-b31f-b8b3fa25abb9",
      "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36",
      "referrer": null,
      "location": "https://sports-dev.barca.group/pdp/SP00944_00002?model=SP00944"
    }
  }
]

Confirm that:

  • meta.type is now ec.cartAction and action is set to add.

  • The meta.clientId, meta.config.trackingId and product.productId are consistent with the previous event.

If you’re using Relay and Explorer, Explorer will take care of the rest of the validations for you. Otherwise, also validate in detail the rest of the payload as per the cart event reference.

Purchase

Purchase the product.

Purchase

A purchase event should be logged, as shown in the following example.

[
  {
    "currency": "USD",
    "products": [
      {
        "quantity": 1,
        "product": {
          "productId": "SP00944_00002",
          "name": "Kevlar Kayak",
          "price": 2450
        }
      }
    ],
    "transaction": {
      "id": "de50f46a-95da-4cf6-b31f-b8b3fa25abb9-1715890920052",
      "revenue": 2572.5
    },
    "meta": {
      "type": "ec.purchase",
      "config": {
        "trackingId": "sports"
      },
      "ts": 1715890920326,
      "source": [
        "@coveo/headless@2.63.2",
        "relay@0.7.7"
      ],
      "clientId": "de50f46a-95da-4cf6-b31f-b8b3fa25abb9",
      "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36",
      "referrer": null,
      "location": "https://sports-dev.barca.group/cart/confirmation?orderId=de50f46a-95da-4cf6-b31f-b8b3fa25abb9-1715890920052"
    }
  }
]

Confirm that:

  • meta.type is now ec.purchase.

  • The meta.clientId, meta.config.trackingId and products[0].product.productId are consistent with the previous event.

  • The transaction value contains the transaction ID and revenue.

If you’re using Relay and Explorer, Explorer will take care of the rest of the validations for you. Otherwise, also validate in detail the rest of the payload as per the purchase event reference.

Confirm events in the Coveo Administration Console

Navigate to the Data Health Event browser (platform-ca | platform-eu | platform-au) to verify if the events sent in the preceding steps are logged here.

Filter the events by the client ID noted above, as shown in the screenshot below.

Note

A delay of a few minutes could occur before the events become visible in the Visit Browser.

Visit Browser

Click the latest visit and go through the events given here to verify if they match those sent in the previous steps. Furthermore, as shown in the screenshot below, you can inspect event payloads to verify if the correct fields were logged, starting from the search event that was logged server-side at the beginning of the user journey.

Visit Browser events

Validate especially analytics.trackingId and analytics.clientId consistency in this search event.

Validating all user journeys

While the steps above focus exclusively on a singular user journey, they provide invaluable insights applicable to verifying other essential user journeys.

The example journey emphasizes the search aspect. Similar methodologies can be applied to instances where products are discovered through recommendations or product listing pages.

We recommend that you start by identifying all potential Coveo-related user journeys, from product exploration to purchase. Subsequently, these journeys should be validated against the key validation factors outlined in this article.