---
title: "Global events"
slug: "global-events"
abstract: "Describes the entity payload used for tracking interactions with an entity."
---
# 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.

| Name | Type | Description |
| --- | --- | --- |
| `rfkid` | string | Required.<br><br>Identifies the widget being tracked. |
| `entity` | string | Required.<br><br>Name of entity being viewed. |
| `payload` | `WidgetViewPayload` | Required.<br><br>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.<br><br>Phrase searched. |
| `index` | number | Required.<br><br>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.<br><br>ID of the entity. |
| *entityType* | string | Required.<br><br>Name of the entity. |
| *url* | string | URL of the entity page. Typically the detail page of the entity.<br><br>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.

> [!note]
> Dispatch this event verbosely because the SDK cannot infer when this action is happening.

| Name | Type | Description |
| --- | --- | --- |
| `name` | string | Required.<br><br>Describes the type of page viewed.<br><br>`widget`<br><br>`entity page`<br><br>`confirm`<br><br>`cart`<br><br>`category `<br><br>`search`<br><br>`detail`<br><br>`qview`<br><br>`other` |
| `payload` | `PageViewPayload` | Required.<br><br>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.<br><br>ID of the entity. |
| *entityType* | string | Required.<br><br>Name of the entity. |
| *url* | string | URL of the entity page. Typically the detail page of the entity.<br><br>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.

> [!note]
> Dispatch this event verbosely because the SDK cannot infer when this action is happening.

| Argument | Type | Description |
| --- | --- | --- |
| `entity` | string | Required,<br><br>Type of entity. For example, `content`. |
| `payload` | `PageViewPayload` | Required.<br><br>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.<br><br>ID of the entity. |
| *entityType* | string | Required.<br><br>Name of the entity. |
| *url* | string | URL of the entity page. Typically the detail page of the entity.<br><br>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. |