Skip to content

trackkit / index / PageContext

Interface: PageContext

Defined in: types.ts:43

Page-level context computed by the facade at send-time.

Properties

url

url: string

Defined in: types.ts:45

Normalized, masked URL to report (pathname+search+hash).


title?

optional title: string

Defined in: types.ts:48

Current document title (optional).


hostname?

optional hostname: string

Defined in: types.ts:51

Hostname of the page (e.g., 'example.com').


referrer?

optional referrer: string

Defined in: types.ts:58

Referrer to report:

  • first pageview: document.referrer (external only, after your policy)
  • SPA navigations: previous same-origin URL, or '' if none/app policy strips

userId?

optional userId: string

Defined in: types.ts:65

User identifier to report. This is optional; many providers don’t support it. If provided, it should be a stable, anonymized user ID.


viewportSize?

optional viewportSize: object

Defined in: types.ts:68

Viewport size in CSS pixels at send-time.

width

width: number

height

height: number


screenSize?

optional screenSize: object

Defined in: types.ts:71

Screen size in CSS pixels at send-time.

width

width: number

height

height: number


language?

optional language: string

Defined in: types.ts:77

Language of the browser at send-time. Useful for providers that support localization.


timestamp?

optional timestamp: number

Defined in: types.ts:83

When the facade created this context (ms since epoch). Helps providers that batch or order events.


meta?

optional meta: Readonly<Record<string, unknown>>

Defined in: types.ts:89

Optional bag for future, strictly provider-agnostic additions (e.g., language). Avoid PII; keep this small to preserve a stable ABI.