Advanced Configuration
Overview
Override Default RUM View Names
/dashboard/1234
and /dashboard/9a
are normalized to /dashboard/?
.trackViewsManually
option and specify custom names for views as well as associated services and versions.Configure Manual View Tracking
trackViewsManually
to true
:
startView
method for each new page or route change (for single-page applications) to start a view. RUM data will begin collecting when the view starts. You can add context to the view and its child events.Parameter Description
Example: Manually Track Checkout Page View
checkout
as the view name and associating it with the purchase
service, version 1.2.3
:
React Router Integration
1.
trackViewsManually
to true
during initialization (as above).2.
useLocation
and matchRoutes
APIs from react-router-dom
.
Set View Name
setViewName
method to update the current view's name without starting a new view. The changed view name affects the view and its child events (from the moment of the call onwards).
Enrich and Control RUM Data
beforeSend
callback function, you can intercept and modify events before they are sent to FlashDuty, supporting the following operations:beforeSend
callback accepts two parameters:Context Types
Location
object.Event
and handling stack.XMLHttpRequest
, PerformanceResourceTiming
, and handling stack.Request
, Response
, PerformanceResourceTiming
, and handling stack.PerformanceResourceTiming
.Error
object.PerformanceLongTaskTiming
.Enrich RUM Events
beforeSend
callback. For example, add data from response headers to resource events:
event.context
will be recognized by the RUM SDK.Modify RUM Event Content
beforeSend
, for example, masking email addresses from view URLs:
Modifiable Properties
beforeSend
:addError
, addAction
).Discard RUM Events
false
in beforeSend
, you can discard specific RUM events (except view events):
User Sessions
User Attributes
User Session API
Set User Session
Get User Session
Add/Override User Properties
Remove User Properties
Clear User Session
clearUser
), the last view will still retain user information, but subsequent views and session-level data will not.Sampling
sessionSampleRate
parameter to set a sampling rate (percentage) to reduce the number of sessions collected. For example, to collect 90% of sessions:
User Tracking Consent
trackingConsent
) during initialization. Available values:setTrackingConsent
API:"granted"
to "not-granted"
: Stops the RUM session, and data is no longer sent."not-granted"
to "granted"
: If there is no active session, a new session is created and data collection resumes.setTrackingConsent
.Example: Handling User Consent
View Context
startView
: Specify context when starting a view.setViewContextProperty
: Add or modify a context property for the current view.setViewContext
: Replace the context for the current view.Example: Add View Context
Example: Replace View Context
Error Context
dd_context
property, and the RUM SDK will automatically merge it into the final error event context.
Global Context
Context Lifecycle
storeContextsAcrossPages
option stores context in localStorage
, supporting:Example:
Limitations:
localStorage
data exceeds the user session lifecycle.trackSessionAcrossSubdomains
option, as localStorage
is only shared within the same domain.localStorage
capacity is limited to 5 MiB, so ensure that the total of application data, FlashDuty context, and other third-party data is within this range.Micro-frontend Support
service
and version
properties from application file paths and filenames.Usage
service
and version
properties in beforeSend
based on stack information:
service
property.Limitations
Connect RUM and Traces
Usage
allowedTracingUrls
initialization parameter with the list of internal, first-party origins called by your browser application.
<scheme>://<host>[:<port>]/<path>[?<query>][#<fragment>]
). It accepts the following types:https://api.example.com
matches https://api.example.com/v1/resource
.Considerations
applicationId
and clientToken
to avoid data upload failures.startView
logic at the framework routing level.