Validate that an interface is machine learning ready

This is for:

Developer

The default Coveo-powered search pages are already configured to leverage Coveo Machine Learning (Coveo ML). However, during development, you may have changed the way the page behaves, and want to confirm that Coveo ML is properly configured for your search interface.

This article explains how to confirm that your page is pushing Coveo Usage Analytics (Coveo UA) data that can be leveraged by Coveo ML.

Note

This page assumes that you’re using the Google Chrome browser. Some steps might need to be adapted when using other browsers.

Concepts to understand

Coveo ML separates its models according to the search hubs and tabs (see Ensure that search hubs are implemented). This means that if your search hub or tab values don’t correspond between your queries and your usage analytics events, Coveo ML won’t be able to suggest relevant content.

The following table shows the equivalence of each relevant value between the Search API and Analytics API values. Ensure that your Search API and Analytics API requests share the same values for each of the following parameters if you want to ensure that Coveo ML returns the most relevant results.

Search API value Analytics API value

searchHub

originLevel1

tab

originLevel2

context

customData

Ensure that query and analytics events are properly configured

To confirm that you’re properly tracking everything, ensure that your query, search, and click events are all configured the same way.

Ensure that you’re tracking search events

  1. Access your search interface.

  2. Open the Developer Console of your browser and select the Network tab.

  3. In your search interface, perform a search.

  4. In the Developer Console, confirm that you can see a search analytics event performed.

    It should appear as searches in the console, performed to /v15/analytics/searches, sometimes followed by a visitorId value.

  5. Select the event, and in the Payload section, scroll to the Request Payload section.

  6. In the Request Payload, note the originLevel1, originLevel2, and customData values, for reference in later steps.

If your search events aren’t sent, you need to add the CoveoAnalytics component on your page.

This component is typically added before the main section of your interface, as such:

<div class="CoveoAnalytics"></div>

Ensure that you’re tracking click events

  1. Access your search interface.

  2. Open the Developer Console of your browser and select the Network tab.

  3. Check the Preserve Log checkbox to ensure that the click event stays when changing pages.

  4. In your search interface, click a result.

  5. In the Developer Console, confirm that you can see a click event performed.

    It should appear as click in the console, performed to /v15/analytics/click, sometimes followed by a visitorId value.

  6. Select the event, and in the Payload section, scroll to the Request Payload section.

  7. Ensure that the originLevel1, originLevel2, and customData values are the same for the click event as they were for the search event.

If you don’t have click events, you need to add the CoveoResultLink component back in all of your result templates. This component takes care of handling the click events for you, and shouldn’t be removed from result templates.

Since the September 2019 release (v2.7023) of the Coveo JavaScript Search Framework, not including the CoveoResultLink component in your templates triggers an error in your browser console.

Ensure that your queries share the same parameter options as your analytics

  1. Access your search interface.

  2. Open the Developer Console of your browser and select the Network tab.

  3. In your search interface, perform a search.

  4. In the Developer Console, open the query event.

    It should appear as v2, and be performed to https://platform.cloud.coveo.com/rest/v2.

  5. In the event, confirm that the searchHub, tab, and context values are the same as the originLevel1, originLevel2, and customData values (respectively) from your analytics requests.

If the searchHub/originLevel1 or tab/originLevel2 values are different, Coveo ML will consider the query and analytics events to be unrelated. This will usually prevent Coveo ML rules from applying.

You must also ensure that there’s always a searchHub value, or Coveo ML won’t be able to learn from your events. You can add a search hub as an option in your Analytics component or hardcode it in your search token.

Ensure that query suggestions are properly configured

Now that you have confirmed that your query and analytics events are properly sent, you’re ready to start verifying that Coveo ML query suggestions are properly configured in your page.

  • Ensure that you have enabled query suggestions on your search box

    To do so, confirm that the data-enable-query-suggest-addon attribute of your CoveoSearchbox component is set to true.

    You may also want to confirm that you can see querySuggest events in the Network tab of your browser console when typing in the search box.

  • Ensure that you have a Query Suggestion (QS) model in your query pipeline

    To do so, follow the steps on how to add a QS model in your organization.

To learn how to test Coveo ML QS, see Prerequisites and Test your QS model.

Ensure that Coveo ML Automatic Relevance Tuning (ART) is properly configured

Now that you have confirmed that your query and analytics events are properly sent, you’re ready to start testing your Coveo ML Automatic Relevance Tuning (ART) model to ensure that it’s properly configured.

To learn how to configure and test ART, see Create an Automatic Relevance Tuning model and Test your ART model.

Ensure that other Coveo ML features are properly configured

For other Coveo ML models, configuring Coveo ML and confirming events can be different.