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

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

## trackRecommendationClickEvent

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 the navigation buttons of a recommendation widget.

| 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* | [RecommendationPayload](https://doc.sitecore.com/search/en/developers/search-developer-guide/integrating-using-search-js-data-package/tracking-user-interactions/recommendation-widget-events.html#UUID-e12fbc61-b6f8-07b7-f236-a8ed21f95a80_section-idm1743380786849700 "RecommendationPayload") | Required.<br><br>Payload dispatched with the event. |

### RecommendationPayload

Payload dispatched in the widget click event by the `trackRecommendationClickEvent` 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/recommendation-widget-events.html#UUID-e12fbc61-b6f8-07b7-f236-a8ed21f95a80_UUID-bbb261d8-0615-9e58-fb52-2e075c690e59 "EntityPayload") array | Entities being shown. |
| *index* | number | The index of the clicked entity. |
| *actionCause* | string | `navigation` or `close` |

#### 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. |

## trackRecommendationClickEntityEvent

This function triggers a [widget click](https://doc.sitecore.com/search/en/developers/search-developer-guide/integrating-using-rest-apis/using-the-events-api-to-track-events/widget-events/creating-a-widget-click-event.html "Creating a widget click event") event that tracks clicks on a recommendation widget's entity.

| Name | Type | Description |
| --- | --- | --- |
| *rfkId* | string | Required.<br><br>Identifies the widget being tracked. |
| *entity* | string | Required.<br><br>Type of entity. |
| *payload* | [RecommendationClickItemPayload](https://doc.sitecore.com/search/en/developers/search-developer-guide/integrating-using-search-js-data-package/tracking-user-interactions/recommendation-widget-events.html#UUID-e12fbc61-b6f8-07b7-f236-a8ed21f95a80_section-idm1743380786864328 "RecommendationClickItemPayload") | Required.<br><br>Payload dispatched with the event. |

### RecommendationClickItemPayload

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

| Name | Type | Description |
| --- | --- | --- |
| *items* | `[EntityPayload](recommendation-widget-events.html#UUID-e12fbc61-b6f8-07b7-f236-a8ed21f95a80_UUID-bbb261d8-0615-9e58-fb52-2e075c690e59 "EntityPayload")` array | Required.<br><br>Clicked entity. |
| *index* | number | Required.<br><br>The index of the clicked entity. |

#### 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. |