Web Vitals Metrics Overview
Flashduty RUM supports the following Core Web Vitals metrics:| Metric | Full Name | Description |
|---|---|---|
| LCP | Largest Contentful Paint | Measures loading performance of main page content |
| INP | Interaction to Next Paint | Measures overall interaction responsiveness |
| CLS | Cumulative Layout Shift | Measures visual stability |
| FCP | First Contentful Paint | Measures first content rendering time |
| FID | First Input Delay | Measures page interaction performance (auxiliary metric) |
| TTFB | Time to First Byte | Measures server response speed (auxiliary metric) |
Metric Calculation Methods
LCP - Largest Contentful Paint
LCP - Largest Contentful Paint
Calculation Method: Time from page load start (
navigationStart) to when the largest visible content element (such as images, text blocks) finishes rendering.Use Case: Monitor main page or critical page content loading speed, identify resource loading bottlenecks.FCP - First Contentful Paint
FCP - First Contentful Paint
Calculation Method: Measures the time from when the user first navigates to the page to when any part of the page content is rendered on the screen.Use Case: Used to measure perceived loading speed, helps assure users that something is happening.
INP - Interaction to Next Paint
INP - Interaction to Next Paint
Calculation Method: Measures the delay from all user interactions (clicks, taps, keyboard input) to the next frame rendering.Use Case: Evaluate overall page interaction responsiveness, optimize high-latency interaction scenarios.
CLS - Cumulative Layout Shift
CLS - Cumulative Layout Shift
Calculation Method: Calculates the score of all unexpected layout shifts (shift distance × impact area).Use Case: Identify page jumping issues caused by dynamic content or ads.
FID - First Input Delay
FID - First Input Delay
Calculation Method: Time difference from when the user first interacts to when the browser processes the event.Use Case: Optimize response speed of interaction-intensive pages (such as forms, navigation menus).
Monitoring Single Page Applications (SPA)
For single page applications, the RUM Browser SDK distinguishes betweeninitial_load and route_change navigation types through the loading_type attribute.
- History SPA
- Hash SPA
If an interaction on the page causes the URL to change without a full page refresh, the RUM SDK starts a new
view with loading_type:route_change.RUM uses the History API to track URL changes.Custom Performance Monitoring
Component-Level Performance Measurement
Use thecustomVital API to monitor the performance of specific components or interactions, suitable for:
- Critical component rendering time
- User interaction response time
- Business process duration
Performance Timing Records
Use theaddTiming API to record key time points, suitable for:
- Critical element loading (such as first screen images)
- First user interaction (such as first scroll)
- Business milestone timestamps
Important Notes
Naming Conventions
- Avoid spaces and special characters in metric names
- Use descriptive naming (e.g.,
login_form_render) - Maintain naming consistency
Performance Impact Control
- Control the number of custom metrics
- Avoid frequent timing
- Set reasonable sampling rates
Frequently Asked Questions
Abnormal Page Load Time
Abnormal Page Load Time
- Check slow-loading resources (images, scripts)
- Investigate third-party script blocking
- Analyze long-running JavaScript
Inaccurate Activity State Determination
Inaccurate Activity State Determination
- Confirm if there are frequent background requests
- Check handling of long connections or streaming requests
- Use
excludedActivityUrlsto exclude interference
Custom Metrics Issues
Custom Metrics Issues
- Verify metric names comply with conventions
- Ensure timers start and stop correctly
- Check timestamp accuracy in async scenarios
Empty Web Vitals Metrics
Empty Web Vitals Metrics
| Reason | Description |
|---|---|
| Background Page | Page opened in new tab or unfocused window, causing INP and LCP to not be collected |
| SPA Route Change | Core Web Vitals metrics are not re-collected during loading_type:route_change |
| Integration Method | Page finished loading before SDK was fully initialized |
| Page Lifecycle | Page was closed or navigated away before metric collection completed |
| Browser Compatibility | Older browser versions don’t support certain Web Vitals APIs |
| No Page Content | Page has no measurable content elements (such as blank pages) |