1. Events

Recommendation widget events

Sitecore Search JS SDK for React offers events to track interaction with the recommendation widget.

Note

All attributes are optional unless indicated otherwise.

trackRecommendationClickEvent

Tracks clicks on recommendation widget navigation buttons.

Note

Fire this event only if you are not using Search UI components.

NameTypeDescription
rfkIdstringRequired.

Identifies the widget being tracked.
entitystringRequired.

Type of entity.

Example: content
payloadRecommendationPayloadRequired.

Payload dispatched with the event.

RecommendationPayload

Payload dispatched with trackRecommendationClickEvent.

NameTypeDescription
itemsarray< EntityPayload >Entities being shown.
indexnumberThe index of the clicked entity.
actionCausestringnavigation or close

EntityPayload

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

NameTypeDescription
idnumberRequired.

ID of the entity.
entityTypestringRequired.

Name of the entity.
urlstringURL of the entity page. Typically the detail page of the entity.

When not supplied, the SDK uses the URL of the page.
sourceIdstringID of the source of the entity, as assigned by the connector.

trackRecommendationClickEntityEvent

Tracks clicks on a recommendation widget's entity.

Note

Fire this event only if you are not using Search UI components.

NameTypeDescription
rfkIdstringRequired.

Identifies the widget being tracked.
entitystringRequired.

Type of entity.
payloadRecommendationClickItemPayloadRequired.

Payload dispatched with the event.

RecommendationClickItemPayload

Payload dispatched with trackRecommendationClickEntityEvent.

NameTypeDescription
itemsarray< EntityPayload >Required.

Clicked entity.
indexnumberRequired.

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.

NameTypeDescription
idnumberRequired.

ID of the entity.
entityTypestringRequired.

Name of the entity.
urlstringURL of the entity page. Typically the detail page of the entity.

When not supplied, the SDK uses the URL of the page.
sourceIdstringID of the source of the entity, as assigned by the connector.
If you have suggestions for improving this article, let us know!