1. Events

Suggestion click events

Version:

The suggestion click event tracks when the site visitor clicks a search suggestion in your app, typically one of the suggested items that pop up as they enter text in the search field.

You can send suggestion click events by using the widgetSuggestionClick function and passing it the suggestion click event data object.

The suggestion click event data object

The suggestion click event data object represents all the required and optional data about the event.

This is the object where you provide data about the event. All this data is sent to Sitecore Search, so make sure to provide the correct data depending on your organization's requirements. Construct the object in the following way:

  • Provide the ID of the widget that was clicked, data about the suggestion that was clicked, and the URI where the event triggered.

  • Optionally, you can provide data such as the channel and the language of the page where the event triggered.

Examples

Tip

During development, use your web browser's developer tools to check the payload containing all the event data that is sent to Sitecore.

Example 13. Sending a suggestion click event

Here's an example event data object for a suggestion click event. The object contains all the required and some optional event data. You can send this event by passing the object to the widgetSuggestionClick function:

For this suggestion click event data object, the following payload is sent to Sitecore:

{
  "browser_id": "a38b230c-11eb-4cf9-8d5d-274e9f344925​",
  "client_key": "",
  "language": "EN",
  "page": "page",
  "pos": "",
  "requested_at": "2026-01-15T11:48:13.573Z",
  "sc_search": {
    "data": {
      "action_cause": "suggestion",
      "value": {
        "context": {
          "page": {
            "uri": "/page"
          }
        },
        "request": {
          "keyword": "green"
        },
        "rfk_id": "rfkid_6"
      }
    },
    "metadata": {
      "ut_api_version": "1.0"
    }
  },
  "type": "SC_SEARCH_WIDGET_CLICK"
}  


If you have suggestions for improving this article, let us know!