Skip to content

SDK reference

Field-by-field reference for the @siteqwality/rum browser SDK. For install and first-run, see the SDK overview and the RUM quickstart.

import { SiteQwalityRUM } from '@siteqwality/rum';
await SiteQwalityRUM.init({ applicationId: '...', clientToken: '...' });
OptionTypeDefaultDescription
applicationIdstringrequiredThe RUM application ID.
clientTokenstringrequiredThe application’s public client token. Sent as the bearer token on every payload.
servicestringnoneLogical service name, stored in the SDK’s context.
versionstringnoneApp version. Attached to every error event and used for source-map matching.
envstringnoneEnvironment label (prod, staging, …), stored in the SDK’s context.
apiBasestringnoneDeprecated and unused. Remote config is fetched from ingestBase; the option is kept for backwards compatibility.
ingestBasestringhttps://rum.siteqwality.comOverride for the RUM ingest host (event delivery and config fetch).
replayBasestringhttps://replay.siteqwality.comOverride for the replay segment endpoint.

init is idempotent: a second call while an instance exists is a no-op. On init the SDK fetches its server-side config (session filters + privacy settings) from GET {ingestBase}/v1/config, authenticated by the client token, and refreshes it every 5 minutes. The fetch has a 5 second timeout and never throws: on any failure (network error, non-2xx, unexpected response shape) the SDK falls back to safe defaults, meaning no session filters and mask_inputs: true / mask_text: false. A failed refresh keeps the last known config.

Starts the SDK: creates or restores the session, fetches config, starts all collectors, and begins sampling evaluation. Returns a promise; await it if you call other methods immediately after.

FieldTypeDescription
idstringYour internal user ID. Used by custom session filters (has_user).
emailstringUser email.
namestringDisplay name.

All fields optional. User identity attaches to subsequent error and detail events.

Records a custom error alongside auto-captured ones (recorded with error_source: "custom", message, and stack). Custom errors count toward error session filters. The context parameter is accepted for forward compatibility and is not attached to the event today.

Records a custom action with action_type: "custom" and action_target: name. Actions always increment the session’s action count (used by custom filters with min_actions); the individual action event is only shipped when detail capture is active for the session. The context parameter is accepted for forward compatibility and is not attached to the event today.

SignalAlways-onDetail (filter-activated)
Page views, load / DOM-ready timingyes
Web Vitals: lcp_ms, fcp_ms, cls, inp_ms, ttfb_msyes
Error events (message, stack, fingerprinting)yes
Action countyes
Individual click / action eventsyes
Resource timings (url, duration, transfer size)yes
Long tasks (browser longtask entries, with duration)yes
Session replay (rrweb)with capture_replay: true

Detail capture activates when any enabled session filter matches; replay additionally requires capture_replay: true on the matching filter.

Filters are evaluated in the browser every 5 seconds against the running session state (error count, LCP, CLS, page count, action count, user presence). Activation is one-way: once detail or replay capture turns on for a session, it stays on for that session.

filter_typeCondition keysMatches when
errorhas_errorThe session has thrown at least one error.
slow_performancelcp_gt_ms, cls_gtLCP or CLS exceeds the threshold.
customhas_user, min_actionsUser is identified and/or action count reached.
BehaviorValue
StoragesessionStorage key sq_rum_session.
Session IDcrypto.randomUUID().
ExpiryAfter 15 minutes of inactivity, or 4 hours total, a new session starts.

The SDK sends three event streams to ingestBase, each independently batched:

StreamEndpointContents
MeasuresPOST /v1/measureViews and vitals.
Detail eventsPOST /v1/eventsResources, actions, long tasks.
ErrorsPOST /v1/errorsError events.

A batch flushes every 10 seconds, immediately at 50 queued events, and on tab hide / page unload (via navigator.sendBeacon, with the client token as a query parameter since beacons cannot set headers). Delivery is fire-and-forget; failed sends are not retried.

  • rrweb is lazy-loaded only when a replay-enabled filter activates, keeping the base bundle small.
  • Segments flush at 100 rrweb events and at least every 30 seconds, to POST {replayBase}/v1/segments.
  • Input masking (mask_inputs, default on) and text masking (mask_text, default off) come from the application’s privacy settings.
import type {
RumConfig, // init options
UserContext, // setUser argument
RumMeasureEvent, RumDetailEvent, RumErrorEvent, // payload shapes
SessionFilterRule, SdkConfig, // server-fetched config shapes
} from '@siteqwality/rum';