Skip to main content
The SDK is a singleton: initialize once, then import the same orwel instance anywhere (import orwel from 'orwel' or import { orwel } from 'orwel'). On the server (no window) every method is a no-op, so imports are safe in SSR code.

Methods

init options

monitor options

All default to true when you call monitor() with no options.

form options

Validation

The SDK validates inputs at runtime and throws descriptive errors:
  • apiKey must start with orwel_ and be at least 20 characters.
  • config, traits and properties must be objects.
  • Event codes match ^[a-z0-9_]+$ and are at most 50 characters.
  • Emails inside properties and traits must be valid addresses. Pass a valid one or omit the field.

Storage

One instance. Never re-initialize. Import orwel from your wrapper module everywhere; the visitor and session are managed for you and persist across reloads.