trackkit / index / PageContext
Interface: PageContext
Defined in: types.ts:126
Page-level context computed by the facade at send-time.
This is the canonical representation of “where and when” an event happened. Providers derive their own payloads from this.
Properties
url
url:
string
Defined in: types.ts:133
Normalised, masked URL to report (pathname + search + hash).
Any PII-stripping and hash/router normalisation should already have been applied (see FacadeOptions.urlTransform).
title?
optionaltitle:string
Defined in: types.ts:136
Current document title, if available.
hostname?
optionalhostname:string
Defined in: types.ts:139
Hostname of the page (e.g. "example.com").
referrer?
optionalreferrer:string
Defined in: types.ts:149
Referrer to report.
- First pageview: the external referrer (e.g.
document.referrer) after your policy has stripped/normalised it. - SPA navigations: previous same-origin URL, or
''if none or if your policy removes it.
userId?
optionaluserId:string
Defined in: types.ts:157
Application-level user identifier.
This is optional; many providers don’t support user IDs in a privacy-preserving way. If you set it, prefer a stable, anonymised ID.
viewportSize?
optionalviewportSize:object
Defined in: types.ts:160
Viewport size in CSS pixels at send-time.
width
width:
number
height
height:
number
screenSize?
optionalscreenSize:object
Defined in: types.ts:163
Screen size in CSS pixels at send-time.
width
width:
number
height
height:
number
language?
optionallanguage:string
Defined in: types.ts:170
Browser language at send-time.
Typically derived from navigator.language.
timestamp?
optionaltimestamp:number
Defined in: types.ts:177
When the facade created this context (ms since epoch).
Used by some providers and internal diagnostics for ordering and timing.
meta?
optionalmeta:Readonly<Record<string,unknown>>
Defined in: types.ts:185
Optional bag for future, provider-agnostic additions.
Avoid PII; keep this small to preserve a stable ABI. Provider-specific fields should not go here – they belong in the provider payload.