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 |
|---|---|---|
|
|
string |
Required. Identifies the widget being tracked. |
|
|
string |
Required. Name of entity being viewed. |
|
|
|
Required. Payload dispatched with the event. |
WidgetViewPayload
Payload dispatched with trackViewEvent.
|
Name |
Type |
Description |
|---|---|---|
|
|
array< |
Entities in the widget displayed and seen by visitor. |
|
|
string |
Required. Phrase searched. |
|
|
number |
Required. The index of the clicked entity. |
|
|
string | |
|
|
string |
Modified keyword as returned in the results. |
|
|
number |
Maximum number of results to retrieve. |
|
|
number |
Total number of results identified by the search |
|
|
number |
Total number as sent in the request. |
|
|
number |
Maximum number of results that appear on one webpage. |
|
|
number |
The number of the page hosting the widget after the results have been paginated using |
|
|
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.
|
Name |
Type |
Description |
|---|---|---|
|
|
string |
Required. Describes the type of page viewed.
|
|
|
|
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 |
|---|---|---|
|
|
array< |
Entities on the page displayed and seen by a visitor. Typically a single entity. |
|
|
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.
|
Argument |
Type |
Description |
|---|---|---|
|
|
string |
Required, Type of entity. For example, |
|
|
|
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 |
|---|---|---|
|
|
array< |
Entities on the page displayed and seen by a visitor. Typically a single entity. |
|
|
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. |