---
title: "Search results widget events"
slug: "search-results-widget-events"
abstract: "Describes the entity payload used for tracking interactions with an entity."
---
# Search results widget events

Sitecore Search JS Data package offers the following functions that trigger events to track user interactions with the search results widget.

## trackSearchResultsClickEntityEvent

This function triggers a `[widget click](../../integrating-using-rest-apis/using-the-events-api-to-track-events/widget-events/creating-a-widget-click-event.md "Creating a widget click event")` event that tracks clicks on an entity in the search results container.

| Name | Type | Description |
| --- | --- | --- |
| *rfkId* | string | Required.<br><br>Identifies the widget being tracked. |
| *entity* | string | Required.<br><br>Type of entity.<br><br>Example: `content`. |
| *payload* | [SearchResultsClickEntityPayload](https://doc.sitecore.com/search/en/developers/search-developer-guide/integrating-using-search-js-data-package/tracking-user-interactions/search-results-widget-events.html#UUID-da71fbfa-ea1e-3768-c561-4ed47a399d54_section-idm4623652547241633807865978041 "SearchResultsClickEntityPayload") | Required.<br><br>Payload dispatched with the event. |

### SearchResultsClickEntityPayload

Payload dispatched in the widget click event triggered by the `trackSearchResultsClickEntityEvent` function.

> [!note]
> All attributes are optional unless indicated otherwise.

| Name | Type | Description |
| --- | --- | --- |
| *items* | [EntityPayload](https://doc.sitecore.com/search/en/developers/search-developer-guide/integrating-using-search-js-data-package/tracking-user-interactions/search-results-widget-events.html#UUID-da71fbfa-ea1e-3768-c561-4ed47a399d54_UUID-bbb261d8-0615-9e58-fb52-2e075c690e59 "EntityPayload") array | Required.<br><br>Clicked entity. |
| *index* | number | Required.<br><br>The index of the clicked entity. |
| *keyword* | string | Phrase searched. |
| *advancedQueryText* | string | Query search expression to narrow the search.<br><br>Example: `filetype:pdf`. |
| *modifiedKeyword* | string | Modified keyword as returned in the results. |
| *numResults* | number | Maximum number of results to retrieve. |
| *totalResults* | number | Total number of results identified by the search. |
| *pageSize* | number | Maximum number of results that appear on one webpage. |
| *pageNumber* | number | The number of the page hosting the widget after the results have been paginated using `pageSize`. |
| *redirectUrl* | string | URL of the page the search redirects to. |

#### EntityPayload

This payload describes an entity. Use this payload type in all events when you want to track interaction with an entity.

| Name | Type | Description |
| --- | --- | --- |
| *id* | number | Required.<br><br>ID of the entity. |
| *entityType* | string | Required.<br><br>Name of the entity. |
| *url* | string | URL of the entity page. Typically the detail page of the entity.<br><br>When not supplied, the SDK uses the URL of the page. |
| *sourceId* | string | ID of the source of the entity, as assigned by the connector. |

## trackSearchResultsFacetClickEvent

This function triggers a `[widget click](creating-a-widget-click-event.html#UUID-e3cb43d4-9a73-60f6-8e79-fc70766eb0ad_section-idm4590998431598433581247919151 "Widget click on a filter")` event that tracks user clicks on an entity or the selection of a facet in the search results widget.

| Name | Type | Description |
| --- | --- | --- |
| *rfkId* | string | Required.<br><br>Identifies the widget being tracked. |
| *entity* | string | Required.<br><br>Type of entity |
| *payload* | [SearchResultsFacetPayload](https://doc.sitecore.com/search/en/developers/search-developer-guide/integrating-using-search-js-data-package/tracking-user-interactions/search-results-widget-events.html#UUID-da71fbfa-ea1e-3768-c561-4ed47a399d54_section-idm1743380786709328 "SearchResultsFacetPayload") | Required.<br><br>Payload dispatched with the event. |

### SearchResultsFacetPayload

Payload dispatched in the widget click event triggered by the `trackSearchResultsFacetClickEvent` function.

| Name | Type | Description |
| --- | --- | --- |
| *filters* | [FacetPayload](https://doc.sitecore.com/search/en/developers/search-developer-guide/integrating-using-search-js-data-package/tracking-user-interactions/search-results-widget-events.html#UUID-da71fbfa-ea1e-3768-c561-4ed47a399d54_section-idm4626350190644833831959897033 "FacetPayload") array | Required.<br><br>Clicked entity. |
| *index* | number | Required.<br><br>The index of the clicked entity. |
| *keyword* | string | Phrase searched. |
| *advancedQueryText* | string | Query search expression to narrow the search.<br><br>Example: `filetype:pdf` |
| *modifiedKeyword* | string | Modified keyword as returned in the results. |
| *numResults* | number | Maximum number of results to retrieve. |
| *totalResults* | number | Total number of results identified by the search |
| *pageSize* | number | Maximum number of results that appear on one webpage. |
| *pageNumber* | number | The number of the page hosting the widget after the results have been paginated using `pageSize`. |
| *redirectUrl* | string | URL of the page the search redirects to. |

#### FacetPayload

Payload dispatched in the `SearchResultsFacetPayload` object that describes a facet.

| Argument | Type | Description |
| --- | --- | --- |
| *facetId* | string | Required.<br><br>ID of the facet |
| *facetTitle* | string | Required.<br><br>Title of the facet. |
| *facetIndex* | number | Index of the facet in the list of facets received with the search results. |
| *facetValueId* | string | ID of the facet value. |
| *valueIndex* | string | Index of the facet value in the list of facet values received with the search results. |
| *startValue* | string | Start or minimum value in the range. |
| *endValue* | string | End or maximum value in a range. |
| *facetValue* | string | Value of the facet. |