Skip to main content

Real User Monitoring (RUM)

Oodle RUM gives you end-to-end visibility into how real users experience your web and React Native apps: load performance, JavaScript errors and crashes, user interactions, and full session replay. Choose your platform below. The rest of this page describes the browser SDK; the React Native SDK has its own page, React Native RUM.

Installation​

npm install @oodle-ai/rum

Quick Start​

Add the following to your application entry point (e.g. main.ts, App.tsx, or a layout component):

import { OodleRum } from '@oodle-ai/rum';

OodleRum.init({
instanceId: '<YOUR_INSTANCE_ID>',
apiKey: '<YOUR_RUM_API_KEY>',
endpoint: 'https://<YOUR_COLLECTOR>.oodle.ai',
service: 'my-frontend',
env: 'production',
version: '1.0.0',
sessionReplay: true,
sessionSampleRate: 100,
replaySampleRate: 100,
privacyLevel: 'mask-user-input',
allowedTracingUrls: [
'https://api.yourapp.com',
],
});

API Key​

RUM uses a dedicated API key with the RUM role. This key is embedded in client-side JavaScript and is visible to end users. It is restricted to writing RUM events and replay segments only — no read access to any other data.

Create a RUM API key from Settings → API Keys → Create API Key and select the RUM role.

Configuration Options​

OptionTypeDefaultDescription
instanceIdstringrequiredYour Oodle instance ID
apiKeystringrequiredRUM API key
endpointstringrequiredCollector URL (*.oodle.ai)
servicestringrequiredApplication name
envstring—Environment (production, staging)
versionstring—Application version
sessionReplaybooleantrueEnable session recording
sessionSampleRatenumber100% of sessions to capture
replaySampleRatenumber100% of sessions to record replay
privacyLevelstring'mask-user-input'Privacy masking level
allowedTracingUrlsarray—URLs to inject traceparent
openTelemetryboolean | object—Enable OTel browser tracing
tagsobject—Custom key-value tags on every event
viewUrlQueryParamsstring[]—Query parameters to keep in view_url
forwardNetworkHeadersobject—Capture request and response headers for matching URLs: { urls }
forwardNetworkBodiesobject—Capture request and response bodies for matching URLs: { urls, maxBodySize }, maxBodySize default 65536 characters
flushIntervalMsnumber5000How often queued events are sent, in ms
replayFlushIntervalMsnumber5000How often replay data is sent, in ms
replayIdlePauseMsnumber300000Pause replay recording after this long without user activity (5 min); it resumes on the next interaction
replayIdleExpireMsnumber900000End the replay after this long without user activity (15 min); the next interaction starts a new one
shouldSendDatafunction—Called before each send. While it returns false, data is held (up to 5 min) and retried. Not checked for the last send when the page is closed
urlPathPatternsstring[]—Route templates that mask names and IDs in URL paths
maskUrlPathfunction—Your own rewrite of URL paths
referrerUrlstring'path''path', 'origin' or 'none'
stripQueryStringsstring'events''all' also removes query strings from replay and trace URLs
consoleLevelsstring[]['error', 'warn']Console levels to record; [] for none
errorMessagesstring'full''full', 'scrub' or 'none'
actionTextstring'mask' with privacyLevel: 'mask', else 'full''mask' sends no element text with clicks
userAgentstring'full''none' sends no user agent string
userInfostring'full''full', 'id' or 'none'
redactHeadersarray—More captured header names never sent
redactBodyKeysarray—More captured body keys whose values are replaced
beforeSendNetworkfunction—Change or remove captured headers and bodies
beforeSendfunction—Change or drop any event

Each linked option is described in Data Privacy, with every value and an example.

OpenTelemetry Browser Tracing​

The SDK supports full OpenTelemetry auto-instrumentation, linking browser requests to backend traces end-to-end.

You do not install other packages: the OpenTelemetry packages are dependencies of @oodle-ai/rum. The SDK loads them in separate chunks only when openTelemetry is on, so an app without tracing does not download them.

Enable in config​

OodleRum.init({
// ... base config ...
allowedTracingUrls: [
'https://api.yourapp.com',
],
openTelemetry: { enabled: true },
});

Unhandled promise rejections​

RUM records unhandled promise rejections with tracing on. Tracing uses zone.js, though, and while it is on the browser's unhandledrejection event does not fire for most promises, so any listener your app adds for that event misses them.

How it works​

  1. The SDK initializes an OpenTelemetry WebTracerProvider with a BatchSpanProcessor that exports spans to your Oodle collector via OTLP HTTP (/v1/traces).
  2. @opentelemetry/auto-instrumentations-web automatically creates spans for page loads, fetch/XHR requests, and user interactions.
  3. For URLs matching allowedTracingUrls, the traceparent header is injected into outgoing requests — your backend picks up the same trace_id and the full trace appears in Oodle's Traces UI.

Advanced options​

openTelemetry: {
enabled: true,
tracesEndpoint: 'https://custom-collector/v1/traces',
customAttributes: {
'team.name': 'frontend',
},
}

Session Replay​

Session replay records a pixel-perfect reproduction of the user's browser session using rrweb.

Privacy levels​

LevelBehavior
allowNo masking
mask-user-inputMask input fields, textareas
maskMask all text content

Sampling​

Use replaySampleRate to control costs. For example, set replaySampleRate: 10 to record 10% of sessions.

Images, fonts and stylesheets​

A replay draws your pages in an isolated frame on the replay host of your Oodle region. That host has no access to your Oodle session. The browser of the person who opens the replay loads your images, stylesheets and fonts from your servers, as the browser of your user did. Serve them over HTTPS from hosts that this person can reach.

Browsers load a font from another site only when the font's host allows that site with CORS. If your font host sends Access-Control-Allow-Origin: *, your fonts show in replays with no change. If it allows only your own sites, also allow the replay host of your region:

Oodle UI that you sign in toReplay host to allow
https://us1.oodle.aihttps://us1-session-replay.oodle.ai
https://eu1.oodle.aihttps://eu1-session-replay.oodle.ai
https://ap1.oodle.aihttps://ap1-session-replay.oodle.ai

For example, a font host for a customer on us1 sends:

Access-Control-Allow-Origin: https://us1-session-replay.oodle.ai

Images and stylesheets need no CORS change.

Data Privacy​

note

The options in this section need @oodle-ai/rum 0.6.0 or later.

Some data is always kept out, whatever the settings: query strings in event URLs, credential, session and IP address headers and fields in captured network data, and the text of elements masked in session replay. The options below send less. Each one is off by default.

DataSent by defaultOption
URL pathsAs in the address barurlPathPatterns, maskUrlPath
Query strings on replay and span URLsKeptstripQueryStrings
ReferrerOrigin and pathreferrerUrl
Console outputErrors and warningsconsoleLevels
Error and console messagesAs writtenerrorMessages
Clicked element textSentactionText
User agent stringSentuserAgent
User name and emailSentuserInfo
Captured headers and bodiesNot captured unless enabledredactHeaders, redactBodyKeys, beforeSendNetwork
Anything else in an eventSentbeforeSend

A configuration that sends as little as possible:

OodleRum.init({
// ... base config ...
privacyLevel: 'mask',
urlPathPatterns: [
'/projects/:project/tables/:table',
'/projects/:project/*',
],
referrerUrl: 'none',
consoleLevels: ['error'],
errorMessages: 'none',
actionText: 'mask',
userAgent: 'none',
stripQueryStrings: 'all',
userInfo: 'id',
// Only if forwardNetworkHeaders or
// forwardNetworkBodies is set:
beforeSendNetwork: () => null,
});

If an option gets a value it does not accept, the SDK uses its most private setting and logs a console warning.

Option reference​

Every option is set in OodleRum.init(). Each entry below lists what the option controls, every value it accepts, and an example.

urlPathPatterns​

Masks parts of URL paths, such as project or table names, before they are sent. Applies to view_url, view_url_path, referrer_url, network request URLs, the session replay page URL and trace spans.

ValueWhat it does
Not set (default)Paths are sent as they are in the browser.
Array of route templatesA path that matches a template is sent as the template. The first matching template wins. A path that matches none is sent unchanged.

How a template is written:

In a templateMatchesSent as
projects (plain text)Exactly that segment (case-sensitive)The segment
:projectAny one segment:project
/* at the endAll remaining segments*

A template without /* matches only paths with the same number of segments.

Example:

urlPathPatterns: [
'/projects/:project/tables/:table',
'/projects/:project/*',
'/api/projects/:project/*',
],
Path in the browserSent as
/projects/acme/tables/salaries/projects/:project/tables/:table
/projects/acme/settings/billing/projects/:project/*
/api/projects/acme/tables/salaries/rows/api/projects/:project/*
/settings/settings (no match)

List your API routes too, because network request URLs use the same templates.

A path that matches no template is sent unchanged, including a not-found page or a route added after you wrote the list. After the specific routes of each section, add a catch-all that ends in /*, so those paths are masked too:

urlPathPatterns: [
'/projects/:project/tables/:table',
'/projects/:project',
'/projects/:project/*', // any other path under a project
],

maskUrlPath​

Rewrites URL paths with your own function, for rules a template cannot express. Applies wherever urlPathPatterns applies, and runs after it.

ValueWhat it does
Not set (default)No extra rewriting.
(path: string) => stringGets each path and returns the path to send. If it throws or does not return a string, the SDK sends /:redacted, so a bug in the function never sends the raw path.

Example:

maskUrlPath: (path) =>
path.replace(/\/users\/[^/]+/, '/users/:id'),
Path in the browserSent as
/users/jane/profile/users/:id/profile

referrerUrl​

Controls referrer_url, the page the user came from.

ValueWhat it does
'path' (default)Sends the origin and path. Query strings are always removed. urlPathPatterns applies to the path.
'origin'Sends only the origin.
'none'Sends referrer_url empty.

Example:

referrerUrl: 'origin',
Referrer'path''origin''none'
https://app.example.com/projects/acme?token=1https://app.example.com/projects/acmehttps://app.example.comempty

stripQueryStrings​

Controls where query strings are removed. Event URLs (view_url, referrer_url, network request URLs) never have them.

ValueWhat it does
'events' (default)The session replay page URL and the url.full attribute on trace spans keep the full query string.
'all'The replay page URL keeps only the parameters in viewUrlQueryParams, like view_url. Span url.full has no query string.

Example:

stripQueryStrings: 'all',
viewUrlQueryParams: ['traceId'],
URLReplay page URL sentSpan url.full sent
https://app.example.com/traces?traceId=abc&token=s3crethttps://app.example.com/traces?traceId=abchttps://app.example.com/traces

consoleLevels​

Controls which console calls are recorded as console events.

ValueWhat it does
['error', 'warn'] (default)Records console.error and console.warn.
['error']Records console.error only.
['warn']Records console.warn only.
[]Records no console output.

A level that is not listed is not intercepted at all.

Example:

consoleLevels: ['error'],

errorMessages​

Controls the message text of errors and console events: error_message, the message line at the top of error_stack, and console_message.

ValueWhat it does
'full' (default)Sends messages as written.
'scrub'Replaces quoted strings, URLs, emails, UUIDs, long hex IDs and numbers of 4 or more digits. Errors of the same kind still group together. Unquoted words are kept.
'none'Sends no message text.

In every mode, error_type and the stack frames are sent, so stacks still map to source.

Example:

errorMessages: 'scrub',
Message'full''scrub''none'
Table 'salaries' not found for [email protected]UnchangedTable '?' not found for <email>empty

Use 'none' if your messages can name records without quotes, because 'scrub' keeps unquoted words.

actionText​

Controls the clicked element's text in click events (action_text and action_target).

ValueWhat it does
'full'Sends the element's text, aria-label or title.
'mask'Sends only the tag, id and classes.
Not set (default)'mask' when privacyLevel is 'mask', otherwise 'full'.

Elements masked or hidden in session replay (data-oodle-privacy="mask" or "hidden") never have their text sent, whatever the value.

Example:

actionText: 'mask',
Clicked element'full''mask'
<button id="delete-btn">Delete table salaries</button>button[Delete table salaries]button#delete-btn

To give an element a name of your choice, set data-oodle-action-name on it or on an ancestor. The name is sent instead of the element's text, with either value, because you wrote it to be sent:

Clicked elementSent as
<button data-oodle-action-name="Delete table">Delete table salaries</button>button[Delete table]

userAgent​

Controls the full browser user agent string.

ValueWhat it does
'full' (default)Sends the full string in user_agent.
'none'Sends user_agent empty. browser_name, os_name and device_type are still sent, so you can still filter by browser and device.

Example:

userAgent: 'none',

userInfo​

Controls which fields from OodleRum.identify() are sent on every event.

ValueWhat it does
'full' (default)Sends user_id, user_name and user_email.
'id'Sends user_id only. user_name and user_email are empty.
'none'Sends none of the three.

user_status (identified or anonymous) is sent in every mode.

Example:

userInfo: 'id',

redactHeaders​

Header names that are never sent, on top of the built-in list. Applies to request and response headers captured by forwardNetworkHeaders.

ValueWhat it does
Not set (default)Only the built-in list is removed (see below).
Array of stringsRemoves headers with these names. Matching ignores case.
Array with RegExpsRemoves headers whose lowercase name matches. Strings and RegExps can be mixed.

These headers are always removed, whatever the settings: any header whose name contains token, secret, auth, cookie, passw, api-key, apikey, access-key, session, csrf, xsrf, client-ip, real-ip or connecting-ip, and the forwarded and *-forwarded-for headers. That covers, for example, authorization, cookie, x-api-key, x-auth-token, x-session-id, x-forwarded-for, x-real-ip and cf-connecting-ip.

Example:

redactHeaders: ['x-debug-client-ip', /^x-internal-/],
Captured headerSent?
x-forwarded-for: 203.0.113.7No (built-in)
x-debug-client-ip: 203.0.113.7No (built-in: contains client-ip)
x-internal-shard: 4No (matches /^x-internal-/)
x-request-id: req-123Yes

redactBodyKeys​

Body keys whose values are replaced with [REDACTED], on top of the built-in list. Applies to JSON bodies, at any depth, and to form-encoded bodies captured by forwardNetworkBodies.

ValueWhat it does
Not set (default)Only the built-in keys are redacted (see below).
Array of stringsAlso redacts these keys. Matching ignores case, -, _ and ., so 'employee-id' matches employeeId and employee_id.
Array with RegExpsAlso redacts keys that match, tested against the key as written.

The built-in redaction always runs, whatever the settings:

KindRedacted
CredentialsKeys containing passw, secret, token (not token counts and limits such as total_tokens or max_tokens), apikey, accesskey, privatekey, authorization, credential
Payment and ID dataKeys containing cardnumber, creditcard, cvv, cvc, securitycode, socialsecurity, and the keys ssn and pan
IP addressesKeys containing ipaddr, clientip, remoteaddr, remoteip, and the keys ip, ipv4, ipv6
Card numbersAny payment card number in the body, found by its checksum

Example:

redactBodyKeys: ['email', 'phone', /^salary/],
Captured bodySent as
{"user":{"email":"[email protected]","ip":"203.0.113.7","plan":"pro"}}{"user":{"email":"[REDACTED]","ip":"[REDACTED]","plan":"pro"}}

beforeSendNetwork​

A function that changes or removes the headers and bodies captured by forwardNetworkHeaders and forwardNetworkBodies, before they are sent. It runs once for each request that captured something.

It gets one object:

FieldContents
urlThe request URL as it is sent (no query string, path masked). Read only.
method, statusThe request method and response status (0 if the request failed). Read only.
requestHeaders, responseHeadersCaptured headers, as { name: value } with lowercase names.
requestBody, responseBodyCaptured bodies, as strings.
What the function doesWhat is sent
Changes the object and returns nothingThe changed headers and bodies.
Returns a new objectThe headers and bodies in that object.
Returns nullNo headers or bodies for that request.
Throws or returns a promiseNo headers or bodies for that request. The SDK logs one console warning. The function must be synchronous.

In every case, the request's timing event (URL, method, status and duration) is still sent. The built-in redaction, redactHeaders and redactBodyKeys are applied first, so the function never sees those values.

Example: replace IP addresses in bodies, and send nothing captured for one endpoint:

beforeSendNetwork: (capture) => {
const ip = /\b\d{1,3}(\.\d{1,3}){3}\b/g;
if (capture.responseBody) {
capture.responseBody =
capture.responseBody.replace(ip, '<ip>');
}
if (capture.url.endsWith('/auth/token')) {
return null;
}
},
Response bodySent as
{"viewer":{"origin":"203.0.113.7"}}{"viewer":{"origin":"<ip>"}}

beforeSend​

A function called with every event before it is sent: views, actions, errors, console, network requests, long tasks, custom events and tab visibility. Use it for anything the other options do not cover. It runs after all of them, so it sees each event as it would be sent.

What the function doesWhat is sent
Changes the event and returns nothingThe changed event.
Returns a new objectThat object.
Returns null or falseNothing. The event is dropped.
Throws or returns a promiseNothing. The event is dropped, and the SDK logs one console warning. The function must be synchronous.

session_id, event_type and timestamp cannot be changed. Session replay data does not pass through beforeSend; use privacyLevel and the replay markers for replay.

Example: drop console events from one library, and remove a field from custom events:

beforeSend: (event) => {
if (
event.event_type === 'console' &&
String(event.console_message).includes('[vendor]')
) {
return null;
}
delete event.custom_event_properties;
},

User Identification​

OodleRum.identify({
id: 'user-123',
name: 'Jane Doe',
email: '[email protected]',
});

Custom Events​

OodleRum.trackEvent('purchase_completed', {
orderId: 'ORD-456',
amount: 99.99,
currency: 'USD',
});

Feature Flags​

OodleRum.addFeatureFlag('new-checkout', 'enabled');

Content Security Policy​

If your app uses CSP, add the collector domain to connect-src:

connect-src 'self' https://<YOUR_COLLECTOR>.oodle.ai;

Troubleshooting​

CORS errors on traced requests​

If you see CORS errors after enabling allowedTracingUrls, your backend must allow the traceparent header:

Access-Control-Allow-Headers: traceparent

Tracing does not start​

If the OpenTelemetry chunks fail to load, the SDK logs a warning and continues without tracing. RUM data is unaffected.

Privacy options have no effect​

The privacy options need @oodle-ai/rum 0.6.0 or later. Run npm ls @oodle-ai/rum to check the installed version. The SDK logs a console warning for an option value it does not accept, and for a urlPathPatterns entry it ignores.

No data appearing​

  1. Check the browser console for SDK errors
  2. Verify the API key has the RUM role
  3. Confirm endpoint points to your collector
  4. Allow 2–5 minutes for data to propagate

Support

If you need assistance or have any questions, please reach out to us through: