RequestContext
Learn about the per-request visitor context resolved by the SDK.
This type describes the per-request visitor context the SDK resolves on the server and exposes under the croct property of the load context. The context helper returns it.
Definition
The type has the following shape:
type RequestContext = { clientId: string, userToken: string, uri: string, clientAgent: string | null, referrer: string | null, clientIp: string | null, preferredLocale: string | null, previewToken: string | null,};Properties
The following list describes the properties:
- clientIdstring
The client ID Croct uses to recognize the visitor across requests, in the form of a UUID.
- userTokenstring
The user token representing the current identity, in the form of a signed JWT.
- uristring
The URL of the current request.
- clientAgentstring|null
The user agent of the visitor’s browser.
Is null when the request has no user-agent header.
- referrerstring|null
The referrer URL of the request.
Is null when the request has no referer header.
- clientIpstring|null
The IP address of the visitor.
Is null when no forwarding header is present.
- preferredLocalestring|null
The resolved preferred locale, in BCP‑47 form. For example, en-US.
Is null when no locale was resolved.
- previewTokenstring|null
The active content preview token.
Is null when the visitor is not previewing content.