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.
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.
| Name | Type | Description |
|---|---|---|
rfkid | string | Required. Identifies the widget being tracked. |
entity | string | Required. Name of entity being viewed. |
payload | WidgetViewPayload | Required. Payload dispatched with the event. |
WidgetViewPayload
Payload dispatched with trackViewEvent.
| Name | Type | Description |
|---|---|---|
items | array< EntityPayload > | Entities in the widget displayed and seen by visitor. |
keyword | string | Required. Phrase searched. |
index | number | Required. The index of the clicked entity. |
advancedQueryText | string | |
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 |
numRequested | number | Total number as sent in the request. |
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 |
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. ID of the entity. |
| entityType | string | Required. Name of the entity. |
| url | string | URL of the entity page. Typically the detail page of the entity. 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. |
trackPageViewEvent
Tracks page view events. Typically dispatched every time the visitor views any webpage.
Dispatch this event verbosely because the SDK cannot infer when this action is happening.
| Name | Type | Description |
|---|---|---|
name | string | Required. Describes the type of page viewed. widgetentity pageconfirmcartcategory searchdetailqviewother |
payload | PageViewPayload | Required. Payload dispatched with the event. |
PageViewPayload
The payload object, dispatched with view events, describes a page with or without a widget.
| Name | Type | Description |
|---|---|---|
items | array< EntityPayload > | Entities on the page displayed and seen by a visitor. Typically a single entity. |
actionSubtype | string | Set 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.
| Name | Type | Description |
|---|---|---|
| id | number | Required. ID of the entity. |
| entityType | string | Required. Name of the entity. |
| url | string | URL of the entity page. Typically the detail page of the entity. 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. |
trackEntityPageViewEvent
Tracks entity page view events. It is dispatched when the visitor gets a detailed view of an entity, typically on its own page.
Dispatch this event verbosely because the SDK cannot infer when this action is happening.
| Argument | Type | Description |
|---|---|---|
entity | string | Required, Type of entity. For example, content. |
payload | PageViewPayload | Required. Payload dispatched with the event. |
PageViewPayload
The payload object, dispatched with view events, describes a page with or without a widget.
| Name | Type | Description |
|---|---|---|
items | array< EntityPayload > | Entities on the page displayed and seen by a visitor. Typically a single entity. |
actionSubtype | string | Set 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.
| Name | Type | Description |
|---|---|---|
| id | number | Required. ID of the entity. |
| entityType | string | Required. Name of the entity. |
| url | string | URL of the entity page. Typically the detail page of the entity. 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. |