1. Events

Search results widget events

Sitecore Search JS SDK for React offers events to track interactions with the search results widget.

Note

All attributes are optional unless indicated otherwise.

trackSearchResultsClickEntityEvent

Tracks the click on an entity in the search results container.

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

Payload dispatched with the event.

SearchResultsClickEntityPayload

Payload dispatched with trackSearchResultsClickEntityEvent.

NameTypeDescription
itemsarray< EntityPayload >Required.

Clicked entity.
indexnumberRequired.

The index of the clicked entity.
keywordstringPhrase searched.
advancedQueryTextstringQuery search expression to narrow the search.

Example: filetype:pdf
modifiedKeywordstringModified keyword as returned in the results.
numResultsnumberMaximum number of results to retrieve.
totalResultsnumberTotal number of results identified by the search
pageSizenumberMaximum number of results that appear on one webpage.
pageNumbernumberThe number of the page hosting the widget after the results have been paginated using pageSize,
redirectUrlstringURL 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.

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.

trackSearchResultsFacetClickEvent

Tracks click or selection of a facet in a search results widget.

Note

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

NameTypeDescription
rfkIdstringRequired.

Identifies the widget being tracked.
entitystringRequired.

Type of entity
payloadSearchResultsFacetPayloadRequired.

Payload dispatched with the event.

SearchResultsFacetPayload

Payload dispatched with trackSearchResultsFacetClickEvent.

NameTypeDescription
filtersarray< FacetPayload >Required.

Clicked entity.
indexnumberRequired.

The index of the clicked entity.
keywordstringPhrase searched.
advancedQueryTextstringQuery search expression to narrow the search.

Example: filetype:pdf
modifiedKeywordstringModified keyword as returned in the results.
numResultsnumberMaximum number of results to retrieve.
totalResultsnumberTotal number of results identified by the search
pageSizenumberMaximum number of results that appear on one webpage.
pageNumbernumberThe number of the page hosting the widget after the results have been paginated using pageSize,
redirectUrlstringURL of the page the search redirects to.

FacetPayload

This payload object describes a facet.

ArgumentTypeDescription
facetIdstringRequired.

ID of the facet
facetTitlestringRequired.

Title of the facet.
facetIndexnumberIndex of the facet in the list of facets received with the search results.
facetValueIdstringID of the facet value.
valueIndexstringIndex of the facet value in the list of facet values received with the search results.
startValuestringStart or minimum value in the range.
 endValuestringEnd or maximum value in a range.
facetValuestringValue of the facet
If you have suggestions for improving this article, let us know!