This document introduces advanced configuration options for Web RUM SDK, helping you customize data collection behavior based on your business needs.
Protect Sensitive Data
Mask personally identifiable information and sensitive data
Associate User Sessions
Link user sessions with internal user identifiers
Reduce Data Volume
Lower RUM data collection through sampling
Enrich Context
Add rich contextual information to data
Override Default RUM View Names
Flashduty RUM automatically generates view events when users visit new pages or when URLs change in SPAs. View names are calculated from the current page URL by default, with variable IDs (path segments containing numbers) automatically removed. For example,/dashboard/1234 and /dashboard/9a are normalized to /dashboard/?.
You can manually track view events and specify custom names by setting the trackViewsManually option.
Configure Manual View Tracking
View name, defaults to page URL path
Service name, defaults to the service specified when creating the RUM application
Application version, defaults to the version specified when creating the RUM application
Additional context for the view, applied to the view and its child events
React Router Integration
React Router v6 Example
React Router v6 Example
RumTracker.jsx
Set View Name
Use thesetViewName method to update the current view’s name without starting a new view:
Enrich and Control RUM Data
Using thebeforeSend callback function, you can intercept and modify events before they are sent to Flashduty:
- Enrich events: Add additional context attributes
- Modify events: Change event content or mask sensitive information
- Discard events: Selectively discard specific RUM events
Context Types
Different event types correspond to different contexts:| Event Type | Context |
|---|---|
| View | Location object |
| Action | Triggering Event and handling stack |
| Resource (XHR) | XMLHttpRequest, PerformanceResourceTiming, and handling stack |
| Resource (Fetch) | Request, Response, PerformanceResourceTiming, and handling stack |
| Resource (Other) | PerformanceResourceTiming |
| Error | Error object |
| Long Task | PerformanceLongTaskTiming |
Enrich RUM Events
Add context attributes to events, such as adding response header data to resource events:Modify RUM Event Content
For example, mask email addresses from view URLs:Modifiable Attributes
| Attribute | Description |
|---|---|
view.url | Current page URL |
view.referrer | Previous page URL |
view.name | Current view name |
service | Application service name |
version | Application version |
action.target.name | Interacted element (auto-collected actions only) |
error.message | Error message |
error.stack | Error stack or supplementary information |
error.resource.url | Resource URL that triggered the error |
resource.url | Resource URL |
context | Attributes added via context API or manual event generation |
Discard RUM Events
Returnfalse in beforeSend to discard specific RUM events:
User Sessions
By adding user information to RUM sessions, you can:- Track specific user browsing paths
- Understand which users are most affected by errors
- Monitor performance for key users
User Attributes
The following are optional user attributes; we recommend providing at least one:Unique user identifier
User-friendly name, displayed by default in RUM UI
User email, displayed if no name is provided
User Session API
- Set User
- Get User
- Update Property
- Remove Property
- Clear User
After user session information changes, subsequent RUM events will contain the updated information. After logout (calling
clearUser), the last view still retains user information, but subsequent views and session-level data will not.Sampling
By default, Flashduty RUM collects data from all sessions. You can set the sampling rate via thesessionSampleRate parameter to reduce the number of collected sessions:
User Tracking Consent
To comply with privacy regulations like GDPR and CCPA, Flashduty RUM allows setting user tracking consent state during initialization:| State | Behavior |
|---|---|
"granted" | Start collecting data and send to Flashduty |
"not-granted" | Do not collect any data |
Example: Handling User Consent
Consent state is not synchronized or persisted across tabs. You need to provide the user’s decision during initialization or via
setTrackingConsent.View Context
You can add or modify context for the current view and its child events using these APIs:- Specify When Starting View
- Add/Modify Property
- Replace Context
Error Context
When catching errors, you can attach local context to error objects via thedd_context property:
Global Context
Global context is attached to all RUM events:Context Lifecycle
By default, global context and user context are stored in current page memory:- Not persisted after full page refresh
- Not shared between different tabs or windows
storeContextsAcrossPages option to store context in localStorage:
Micro-frontend Support
Flashduty RUM supports micro-frontend architectures by using stack trace mechanisms to identify event sources. Overrideservice and version attributes in beforeSend based on stack information:
The following events cannot be attributed to specific sources: auto-collected action events, non-XHR/Fetch resource events, view events, CORS and CSP violation events.
Integrate RUM with Distributed Tracing
Integrating RUM with distributed tracing allows you to correlate web application requests with their corresponding backend traces, enabling complete end-to-end tracing.Usage
Use theallowedTracingUrls parameter to configure API service domains for your application:
- NPM
- CDN Sync
- CDN Async
allowedTracingUrls matches full URLs and accepts the following types:
| Type | Description |
|---|---|
| String | Matches any URL starting with this value |
| RegExp | Uses regular expression’s test() method to check for matches |
| Function | Receives URL as parameter, returns true for a match |
Tracing Protocol
Distributed tracing is implemented by adding corresponding header fields:traceparent:
[version]-[trace id]-[parent id]-[trace flags]version: Currently 00trace id: 128-bit trace ID, 32 characters in hexadecimalparent id: 64-bit span ID, 16 characters in hexadecimaltrace flags: Indicates sampling; 01 means sampled, 00 means not sampled
dd=s:[sampling priority];o:[origin]sampling priority: 1 means trace is sampledorigin: Always RUM, indicating collection via RUM SDK