Event context
Learn about the event context.
An event context provides additional details about the specific circumstances in which a tracked event occurred, and varies based on its environment type:
-
Web context
Channel-specific data from the browser, such as the page URL and a unique tab identifier. -
Server context
Data related to the backend service that tracks the event.
The fields available in the context object depend on the value of the type field.
Web context
When type is web, the context object includes the following fields:
- urlstring
The URL of the page in which the event occurred.
- tabIdstring
A unique identifier for the tab in UUID format.
This ID is consistent across page loads and refreshes.
- timeZone(optional)string|null
The time zone of the user’s browser, as specified by the IANA Time Zone Database.
For example, America/New_York or America/Sao_Paulo.
- metadata(optional)Record<string,string>
Additional metadata about the application that tracked the event.
For example, the application name, screen resolution, or any other relevant information.
Server context
When type is server, the context object includes the following fields:
- metadata(optional)Record<string,string>
Additional metadata about the application that tracked the event.
For example, the application name, screen resolution, or any other relevant information.
Examples
Below are examples of event contexts:
{ "type": "web", "tabId": "0b032685-0a7e-4cdd-9ff1-9d3af33507a4", "url": "https://www.example.com", "timeZone": "America/New_York", "metadata": { "appVersion": "1.2.3" }}