RUM SDK supports multiple integration methods. Choose the one that best fits your project requirements.
Integration Methods
We provide three integration methods:| Method | Recommended For | Features |
|---|---|---|
| NPM | Modern web apps | Bundled with frontend code, no impact on page load |
| CDN Async | Performance-focused apps | Async loading, doesn’t affect page performance |
| CDN Sync | Complete data collection | Sync loading, captures all events |
Integration Code
- NPM Package
- CDN Async
- CDN Sync
Add Then initialize in your app entry file:
@flashcatcloud/browser-rum to your package.json:Initialization Parameters
Required Parameters
Application ID, obtained from the application management page
Client Token, obtained from the application management page
Service name, used to distinguish different services
Optional Parameters
Environment identifier, such as
production, staging, etc.Application version number
Percentage of sessions to track: 100 for all, 0 for none
Percentage of sessions with Session Replay enabled
Initial user tracking consent state, see User Tracking Consent
Whether to manually control view creation, see Override Default View Names
Whether to automatically collect user interactions
Whether to enable resource event collection
Whether to enable long task event collection
Whether to enable cross-session anonymous user ID collection
Session replay privacy policy:
allow collects all data except passwords, mask-user-input hides user input field content, mask-all hides all textList of request URLs for injecting tracing headers, see Integrate RUM with Distributed Tracing
Percentage of requests to trace
Optional proxy URL, e.g.,
https://www.proxy.com/pathWhether to compress requests sent to Flashduty, done in Worker thread
Whether to store context in localStorage for cross-page persistence
Use Cases
Custom User Identification
UseflashcatRum.setUser() to add identification attributes for the current user:
Adding Custom Tags
After initializing RUM, use thesetGlobalContextProperty API to add additional tags to all RUM events:
Sending Custom Actions
Use theaddAction API to create RUM actions with context attributes:
Custom Error Reporting
You can attach local context to error objects via thedd_context property:
Verification
Check Network Requests
Open browser developer tools and check if there are data upload requests to
https://browser.flashcat.cloud/api/v2/rum in the Network panel.View Console Data
Access the Flashduty console to verify that RUM application data is displaying correctly.