Initialize the Datadog RUM browser SDK to capture page views, user interactions, and Core Web Vitals
domain: docs.datadoghq.com · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗
Steps
Install @datadog/browser-rum via npm or load the CDN snippet; call datadogRum.init() early in your app bootstrap before any navigation occurs
Pass required init options: applicationId, clientToken, site (e.g., datadoghq.com or datadoghq.eu), service, env, version, and sessionSampleRate (0–100)
Enable automatic collection of user interactions and resources by setting trackUserInteractions: true, trackResources: true, and trackLongTasks: true
Call datadogRum.startSessionReplayRecording() after init if you want session replay; control replay volume separately via sessionReplaySampleRate
Use datadogRum.setUser({ id, name, email }) after authentication to attach user identity to all subsequent RUM events for user-scoped analysis
Verify data is flowing in the Datadog RUM > Sessions view; check the browser console for any init errors related to missing applicationId or blocked CSP headers
Known gotchas
The clientToken is not a secret — it is safe to ship in frontend code — but the applicationId must match the RUM application created in Datadog or events will be rejected
If your app uses a Content Security Policy, add the Datadog intake domain to connect-src; the exact domain depends on your site parameter (e.g., browser-intake-datadoghq.com)
sessionSampleRate and sessionReplaySampleRate are independent; a session sampled at 100% for RUM can have 0% replay recording — set both intentionally to control cost
Give your agent this knowledge — and 15,500+ more routes
One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp
Need this verified for your stack — or a route we don't have yet?