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:

clientId
string

The client ID Croct uses to recognize the visitor across requests, in the form of a UUID.

userToken
string

The user token representing the current identity, in the form of a signed JWT.

uri
string

The URL of the current request.

clientAgent
string|null

The user agent of the visitor’s browser.

Is null when the request has no user-agent header.

referrer
string|null

The referrer URL of the request.

Is null when the request has no referer header.

clientIp
string|null

The IP address of the visitor.

Is null when no forwarding header is present.

preferredLocale
string|null

The resolved preferred locale, in BCP‑47 form. For example, en-US.

Is null when no locale was resolved.

previewToken
string|null

The active content preview token.

Is null when the visitor is not previewing content.