Flashduty Docs
中文EnglishRoadmapAPI官网控制台
中文EnglishRoadmapAPI官网控制台
  1. Applications
  • Introduction
  • On-call
    • Getting Started
      • Quick start
      • FAQ
      • Product Comparison
    • Incidents
      • What is an Incident
      • View Incidents
      • Handle Incidents
      • Escalations and Assignments
      • Custom Fields
      • Custom Actions
      • Alert Noise Reduction
      • Past Incidents
      • Outlier Incidents
    • Configure On-call
      • Channels
      • Integrate Alerts
      • Alert Noise Reduction
      • Escalation Rules
      • Label Enrichment
      • Schedules
      • Templates
      • Service Calendars
      • Preferences
      • Alert Routing
      • Silence and Inhibition
      • Filters
      • Notification Bots
      • Alert Pipeline
    • Advanced Features
      • Referencing Variables
      • Dynamic Assignment
      • Insights
    • Integrations
      • Alerts integration
        • Standard Alert Integration
        • Email Integration
        • Nightingale/FlashCat Integration
        • Prometheus Integration
        • Grafana Integration
        • Zabbix Integration
        • Uptime Kuma Integration
        • Alibaba Cloud ARMS Integration
        • Alibaba Cloud Monitor CM Event Integration
        • Alibaba Cloud Monitor CM Metrics Integration
        • Alibaba Cloud SLS Integration
        • AWS CloudWatch Integration
        • Azure Monitor Integration
        • Baidu Cloud BCM Integration
        • Huawei Cloud CES Integration
        • Influxdata Integration
        • Open Falcon Integration
        • PagerDuty Integration
        • Tencent BlueKing Integration
        • Tencent Cloud CLS Integration
        • Tencent Cloud Monitor CM Integration
        • Tencent Cloud EventBridge
        • OceanBase Integration
        • Graylog Integration
        • Skywalking Integration
        • Sentry Integration
        • Jiankongbao Integration
        • AWS EventBridge Integration
        • Dynatrace Integration
        • Huawei Cloud LTS Integration
        • GCP Integration
        • Splunk Alert Events Integration
        • AppDynamics Alert Integration
        • SolarWinds Alert Events Integration
        • Volcengine CM Alert Events Integration
        • Volcengine CM Event Center Integration
        • Volcengine TLS Integration
        • OpManager Integration
        • Meraki Integration
        • Keep Integration
        • ElastAlert2 Alert Integration
        • StateCloud Alert Events
        • Guance Alert Events
        • Zilliz Alert Events
        • Huawei Cloud APM Alerts
        • zstack integration
      • Change integration
        • Standard Change Event
        • Jira Issue Events
      • IM integration
        • Feishu (Lark) Integration Guide
        • Dingtalk Integration
        • WeCom Integration
        • Slack Integration
        • Microsoft Teams Integration
      • Single Sign-On
        • Authing Integration
        • Keycloak Guide
        • OpenLDAP Guide
      • Webhooks
        • Alert webhook
        • Incident webhook
        • Costom action
  • RUM
    • Getting Started
      • Introduction
      • Quick start
      • FAQ
    • Applications
      • Applications
      • SDK Integration
      • Advanced Configuration
      • Analysis Dashboard
    • Performance Monitoring
      • Overview
      • Metrics
      • Performance Analysis
      • Performance Optimize
    • Error Tracking
      • Overview
      • Error Reporting
      • Issues
      • Source Mapping
      • Error Grouping
      • Issue States
      • Issue Alerting
    • Others
      • Terminology
      • Data Collection
      • Data Security
  • Platform
    • Teams and Members
    • Permissions
    • Single Sign-On
  • Terms
    • Terms of Service
    • User Agreement/Privary Policy
    • SLA
    • Data Security
  1. Applications

SDK Integration

Integration Methods#


Here we provide three integration methods, you can choose the most suitable approach based on your project requirements:
NPM
This method is recommended for modern web applications. The RUM SDK is bundled with the rest of your frontend JavaScript code. It has no impact on page load performance. However, the SDK might miss errors, resources, and user actions triggered before the SDK initialization.
CDN async
This method is recommended for web applications with performance goals. The RUM browser SDK is loaded asynchronously from our CDN, ensuring the SDK download doesn't impact page load performance. However, the SDK might miss errors, resources, and user actions triggered before the SDK initialization.
CDN sync
This method is recommended to collect all RUM events. The RUM browser SDK is loaded synchronously from our CDN, ensuring the SDK loads first and collects all errors, resources, and user actions. This method might impact page load performance.

NPM Package Integration#

Add @flashcatcloud/browser-rum to your package.json file
Then initialize in your application entry file:

CDN Asynchronous Integration#

Add the following code snippet to the head tag of each HTML page you want to monitor.

CDN Synchronous Integration#

Add the following code snippet to the beginning of the head tag in each HTML page you want to monitor (before any other script tags).
You can check for loading issues with window.FC_RUM if the RUM browser SDK fails to load.

Initialization Parameters#

ConfigurationTypeRequiredDescription
applicationIdStringYesApplication ID, obtained from the application management page
clientTokenStringYesClient Token, obtained from the application management page
serviceStringYesService name, used to distinguish different services
envStringNoEnvironment identifier, such as production, staging, etc.
versionStringNoApplication version
trackingConsent"granted" | "not-granted"NoSet initial user tracking consent status. See user tracking consent. Default: granted
trackViewsManuallyBooleanNoAllows you to control RUM view creation. See override default RUM view names. Default: false
trackUserInteractionsBooleanNoEnable automatic collection of user actions. Default: true
trackResourcesBooleanNoEnable collection of resource events. Default: true
trackLongTasksBooleanNoEnable collection of long task events. Default: true
trackAnonymousUserBooleanNoEnable cross-session collection of anonymous user IDs. Default: true
enablePrivacyForActionNameBooleanNoSee mask action names. Default: false
actionNameAttributeStringNoSpecify your own attribute to use for naming actions. Default: false
sessionSampleRateNumberNoPercentage of sessions to track: 100 for all, 0 for none. Only tracked sessions send RUM events. Default: 100
silentMultipleInitBooleanNoIf the RUM browser SDK is already initialized on the page, initialization will silently fail. Default: false
proxyStringNoOptional proxy URL, for example: https://www.proxy.com/path
allowedTracingUrlsArrayNoList of request URLs for injecting tracing headers. For more information, see Connect RUM and Traces
traceSampleRateNumberNoPercentage of requests to trace: 100 for all, 0 for none. Default: 100
excludedActivityUrlsArrayNoList of request origins to ignore when calculating page activity
compressIntakeRequestsBooleanNoCompress requests sent to the FlashDuty intake to reduce bandwidth usage when sending large amounts of data. Compression is done in a Worker thread. Default: false
storeContextsAcrossPagesBooleanNoStore global context and user context in localStorage to preserve them across user navigation. Default: false
allowUntrustedEventsBooleanNoAllow capturing [untrusted events][https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted], for example in automated UI tests. Default: false

Use Cases#

Custom User Identification#

Use flashcatRum.setUser(<USER_CONFIG_OBJECT>) to add identifying attributes (such as ID, name, email) for the current user

Adding Custom Tags#

After initializing RUM, use the setGlobalContextProperty API to add additional tags to all RUM events collected from your application

Sending Custom Actions#

Use the addAction API to create RUM actions. Name your action and attach context properties in the form of a JavaScript object.
The following example creates a checkout action with details about the user's cart when they click the checkout button.

Custom Error Addition#

You can attach a dd_context property directly to error instances, and the RUM SDK will automatically detect this property and merge it into the final error event context.

Validation#

After integration, you can validate whether the integration was successful through the following steps:
1.
Open browser developer tools and check if there are data reporting requests to https://browser.flashcat.cloud/api/v2/rum in the Network panel
2.
Visit the Flashduty console to check if RUM application data is displayed normally
3.
Trigger some user interactions to verify if data collection is working properly

Further Reading#

RUM Application Management: Learn how to create and manage RUM applications
RUM SDK Advanced Configuration: Learn how to configure advanced features of the SDK
RUM Analysis Dashboard: View and analyze RUM data

添加官方技术支持微信

在这里,获得使用上的任何帮助,快速上手FlashDuty

微信扫码交流
上一页
Applications
下一页
Advanced Configuration
Built with