1. Events

SC_SEARCH_WIDGET_CLICK events

Version:

The SC_SEARCH_WIDGET_CLICK event tracks when the site visitor clicks a Sitecore Search widget in your app, such as an item, facet, or suggestion. You can set up this event when you're implementing a Sitecore Search widget.

You can send SC_SEARCH_WIDGET_CLICK events by using the event function and passing it the event data object.

The event data object

The 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, so make sure to provide the correct data depending on your organization's requirements. Construct the object in the following way:

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 11. Sending an SC_SEARCH_WIDGET_CLICK event for an item

Here's an example event data object for a SC_SEARCH_WIDGET_CLICK event. This object describes a click event on an item:

You can send this event by passing the object to the event function:

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

{
  "browser_id": "a38b230c-11eb-4cf9-8d5d-274e9f344925​",
  "client_key": "",
  "pos": "",
  "requested_at": "2025-08-29T12:13:28.417Z",
  "sc_search": {
    "metadata": {
      "ut_api_version": "1.0"
    },
    "data": {
      "action_cause": "entity",
      "value": {
        "rfk_id": "rfkid_7",
        "index": 0,
        "entities": [
          {
            "id": "itemId",
            "entity_type": "content"
          }
        ],
        "request": {
          "keyword": "what is sitecore",
          "num_results": 21,
          "total_results": 21,
          "page_size": 24,
          "page_number": 1
        },
        "context": {
          "page": {
            "uri": "https://www.sitecore.com/search?phrase=XM+Cloud"
          }
        }
      }
    }
  },
  "type": "SC_SEARCH_WIDGET_CLICK"
}


Example 12. Sending an SC_SEARCH_WIDGET_CLICK event for a facet

Here's an example event data object for a SC_SEARCH_WIDGET_CLICK event. This object describes a click event on a facet:

You can send this event by passing the object to the event function:

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

{
  "browser_id": "a38b230c-11eb-4cf9-8d5d-274e9f344925​",
  "client_key": "",
  "pos": "",
  "requested_at": "2025-08-29T12:13:28.417Z",
  "sc_search": {
    "metadata": {
      "ut_api_version": "1.0"
    },
    "data": {
      "action_cause": "filter",
      "value": {
        "rfk_id": "rfkid_7",
        "request": {
          "keyword": "SitecoreAI",
          "page_size": 9,
          "total_results": 766
        },
        "context": {
          "page": {
            "uri": "https://www.sitecore.com/search?phrase=XM+Cloud"
          }
        },
        "filters": [
          {
            "name": "product",
            "title": "Product",
            "value_position": [
              0
            ],
            "display_name": [
              "Connect"
            ],
            "value": [
              "facetid_eyJ0eXBlIjoiZXEiLCJuYW1lIjoicHJvZHVjdCIsInZhbHVlIjoiQ29ubmVjdCJ9"
            ],
            "facet_position": 1
          }
        ]
      }
    }
  },
  "type": "SC_SEARCH_WIDGET_CLICK"
}


Example 13. Sending an SC_SEARCH_WIDGET_CLICK event for a suggestion

Here's an example event data object for a SC_SEARCH_WIDGET_CLICK event. This object describes a click event on a suggestion:

You can send this event by passing the object to the event function:

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

{
  "browser_id": "a38b230c-11eb-4cf9-8d5d-274e9f344925​",
  "client_key": "",
  "pos": "",
  "requested_at": "2025-08-29T12:13:28.417Z",
  "sc_search": {
    "metadata": {
      "ut_api_version": "1.0"
    },
    "data": {
      "action_cause": "suggestion",
      "value": {
        "rfk_id": "rfkid_7",
        "index": 0,
        "request": {
          "keyword": "make",
          "page_size": 6,
          "page_number": 1
        },
        "context": {
          "page": {
            "uri": "https://www.sitecore.com/search?phrase=XM+Cloud"
          }
        },
        "filters": [
          {
            "name": "article_name_context_aware",
            "title": "Suggestions",
            "display_name": [
              "makeup tips for people with glasses"
            ],
            "value": [
              "makeup tips for people with glasses"
            ]
          }
        ]
      }
    }
  },
  "type": "SC_SEARCH_WIDGET_CLICK"
}


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