Install the @datadog/browser-rum package via npm or load the CDN snippet; initialize DD_RUM.init() before any user interaction fires, supplying applicationId, clientToken, site, service, env, and version fields.
Set trackUserInteractions: true and trackResources: true in the init config to capture click actions and resource timing automatically; set sessionSampleRate and sessionReplaySampleRate independently (0–100).
Call DD_RUM.startSessionReplayRecording() after init if session replay is licensed; omit or set sessionReplaySampleRate to 0 to disable recording while keeping RUM data collection.
Add custom user actions with DD_RUM.addAction('name', contextObject) for events not captured automatically, such as form submissions or business-logic milestones.
Forward handled exceptions and custom error signals with DD_RUM.addError(errorObject, contextObject); include a 'source' field value of 'custom' to distinguish from unhandled browser errors.
Verify data is flowing in the Datadog RUM Explorer (UX Monitoring > Sessions) within a few minutes; use the facet panel to filter by service, env, and version to confirm the correct app is reporting.
Known gotchas
The clientToken used for RUM is different from an API key; it is scoped to browser-safe usage and must be created under Organization Settings > Client Tokens — using an API key in the browser exposes privileged credentials.
Initializing DD_RUM.init() more than once in a single page lifecycle (e.g., in a React StrictMode double-invoke) silently drops the second call; guard with a flag or check DD_RUM.getInternalContext() before calling init.
sessionReplaySampleRate controls only recording; even sessions not recorded still appear in RUM as session entries, so setting sessionSampleRate to a low value also reduces overall RUM event volume and cost.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp