Validate That an Interface Is Machine Learning Ready

The default Coveo-powered search pages are already properly 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.

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 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 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 Are 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 Headers 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 (see Coveo Analytics Component).

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

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

Ensure That You Are 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 check box, to ensure that the click event stays when changing pages.

  4. In your search interface, click on 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 Headers 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 (see Coveo ResultLink Component). 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 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 is going to consider the query and analytics events as unrelated, usually preventing Coveo ML rules from applying.

You must also ensure that there’s always a searchHub value, otherwise Coveo ML isn’t able to learn from your events. You can add a search hub as an option in your Analytics component (see Coveo Analytics Component - searchHub), or hardcode it in your search token (see Search Token Authentication).

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 (QS) 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 suggestions model in your query pipeline

    To do so, follow the steps on how to add a QS model in your organization (see Create a Query Suggestion Model).

To learn how to test Coveo ML QS, see Prerequisites and Testing Query Suggestions (QS).

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 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 Testing ART Models.

Ensure That Other Coveo ML Features Are Properly Configured

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

Recommended Articles