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

Sitecore Search JS SDK for React offers the following functions that trigger events to track user interactions with the preview search widget.

## trackPreviewSearchClickEvent

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 preview search 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* | [PreviewSearchPayload](https://doc.sitecore.com/search/en/developers/search-developer-guide/integrating-using-search-js-data-package/tracking-user-interactions/preview-search-widget-events.html#UUID-1f566ee3-97bc-ebe8-f535-019e0d084927_section-idm1743380786825032 "PreviewSearchPayload") | Required.<br><br>Payload dispatched with the event. |

### PreviewSearchPayload

Payload dispatched in the widget click event triggered by the `trackPreviewSearchClickEvent` 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/preview-search-widget-events.html#UUID-1f566ee3-97bc-ebe8-f535-019e0d084927_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. |
|     | 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. |

## trackPreviewSearchSuggestionClickEvent

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 a keyphrase, category, or suggestion in the preview search container.

| Name | Type | Description |
| --- | --- | --- |
| *rfkid* | string | Required.<br><br>Identifies the widget being tracked. |
| *payload* | [PreviewSearchSuggestionPayload](https://doc.sitecore.com/search/en/developers/search-developer-guide/integrating-using-search-js-data-package/tracking-user-interactions/preview-search-widget-events.html#UUID-1f566ee3-97bc-ebe8-f535-019e0d084927_section-idm1743380786835928 "PreviewSearchSuggestionPayload") | Required.<br><br>Payload dispatched with the event. |

### PreviewSearchSuggestionPayload

Payload dispatched in the widget click event by the `trackPreviewSearchSuggestionClickEvent` function.

| Name | Type | Description |
| --- | --- | --- |
| *filters* | [FilterPayload](https://doc.sitecore.com/search/en/developers/search-developer-guide/integrating-using-search-js-data-package/tracking-user-interactions/preview-search-widget-events.html#UUID-1f566ee3-97bc-ebe8-f535-019e0d084927_section-idm452576511897443383195485037 "FilterPayload") array | Required.<br><br>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. |

#### FilterPayload

Payload dispatched in the `PreviewSearchSuggestionPayload` object that describes a filter.

| Name | Type | Description |
| --- | --- | --- |
| *name* | string | Required.<br><br>Name of the suggester created in Sitecore Search. |
| *value* | string | Value of the suggestion clicked. |
| *title* | string | UI title of suggester name. |
| *displayName* | string | Display name of suggestion clicked. |
| *uri* | string | URL of the suggestion filter, if available. |