Track custom actions and attach global context in the Datadog RUM Browser SDK
domain: docs.datadoghq.com · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗
Steps
Call datadogRum.addAction(name, context) to record a custom action tied to a specific point in a user journey, with an optional context object.
Call datadogRum.setGlobalContextProperty(key, value) right after datadogRum.init() to attach a property to every RUM event for the rest of the session.
Use getGlobalContext() to inspect the currently attached global context, and removeGlobalContextProperty(key) to remove a single property.
Alternatively call setGlobalContext(object) to replace the entire global context object at once; it is stored under @context on RUM events.
Keep the combined size of global context, user information, and feature flag data under roughly 3KiB, per Datadog's guidance.
Known gotchas
Global context applies going forward from when it's set — calling setGlobalContextProperty partway through a session means events emitted earlier in that same session won't carry the new property.
Exceeding Datadog's recommended ~3KiB combined budget for global context, user info, and feature flags is not hard-blocked by the API, but it can affect RUM data quality and payload size.
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?