1. Events

Global events

Sitecore Search JS SDK for React offers the following events that are global events and that are dispatched when a visitor logs in to and views an entity or entity details page on your website.

Note

All attributes are optional unless indicated otherwise.

trackViewEvent

Tracks a view event of a widget. Typically dispatched to track visitor views of a widget and its host page.

NameTypeDescription
rfkidstringRequired.

Identifies the widget being tracked.
entitystringRequired.

Name of entity being viewed.
payloadWidgetViewPayloadRequired.

Payload dispatched with the event.

WidgetViewPayload

Payload dispatched with trackViewEvent.

NameTypeDescription
itemsarray< EntityPayload >Entities in the widget displayed and seen by visitor.
keywordstringRequired.

Phrase searched.
indexnumberRequired.

The index of the clicked entity.
advancedQueryTextstring
modifiedKeywordstringModified keyword as returned in the results.
numResultsnumberMaximum number of results to retrieve.
totalResultsnumberTotal number of results identified by the search
numRequestednumberTotal number as sent in the request.
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,
redirectUrlstring

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.

trackPageViewEvent

Tracks page view events. Typically dispatched every time the visitor views any webpage.

Note

Dispatch this event verbosely because the SDK cannot infer when this action is happening.

NameTypeDescription
namestringRequired.

Describes the type of page viewed.

widget

entity page

confirm

cart

category

search

detail

qview

other
payloadPageViewPayloadRequired.

Payload dispatched with the event.

PageViewPayload

The payload object, dispatched with view events, describes a page with or without a widget.

NameTypeDescription
itemsarray< EntityPayload >Entities on the page displayed and seen by a visitor. Typically a single entity.
actionSubtypestringSet as conversion only if you want to register the event to a conversion funnel.

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.

trackEntityPageViewEvent

Tracks entity page view events. It is dispatched when the visitor gets a detailed view of an entity, typically on its own page.

Note

Dispatch this event verbosely because the SDK cannot infer when this action is happening.

ArgumentTypeDescription
entitystringRequired,

Type of entity. For example, content.
payloadPageViewPayloadRequired.

Payload dispatched with the event.

PageViewPayload

The payload object, dispatched with view events, describes a page with or without a widget.

NameTypeDescription
itemsarray< EntityPayload >Entities on the page displayed and seen by a visitor. Typically a single entity.
actionSubtypestringSet as conversion only if you want to register the event to a conversion funnel.

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!