@kubesense/kubesense-browser-rum
v1.4.0
Published
Kubesense Real User Monitoring (RUM) SDK for the browser — tracks views, actions, resources, errors, Core Web Vitals, plus Session Replay and Profiling.
Maintainers
Readme
Kubesense Browser RUM
Kubesense Real User Monitoring (RUM) lets you visualize and analyze the real-time performance and user journeys of your application's individual users — page views, user actions, resources, errors, long tasks, and Core Web Vitals — together with optional Session Replay and Profiling.
This is the full-featured RUM SDK. If you don't need Session Replay or Profiling,
use the smaller @kubesense/kubesense-browser-rum-slim instead.
Installation
npm install @kubesense/kubesense-browser-rum
# or
yarn add @kubesense/kubesense-browser-rumUsage
Initialize the SDK as early as possible in your application's lifecycle:
import { kubesenseSdk } from '@kubesense/kubesense-browser-rum'
kubesenseSdk.init({
applicationId: '<KUBESENSE_APPLICATION_ID>',
clientToken: '<KUBESENSE_CLIENT_TOKEN>',
kubesenseRumEndpoint: '<KUBESENSE_RUM_ENDPOINT>',
// service: 'my-web-application',
// env: 'production',
// version: '1.0.0',
sessionSampleRate: 100,
sessionReplaySampleRate: 100,
trackResources: true,
trackLongTasks: true,
trackUserInteractions: true,
})Note:
trackUserInteractionsenables automatic collection of user clicks. Sensitive or private data contained in your pages may be used to identify the elements interacted with. See the privacy options in the integration guide.
Sending custom events
// Custom user action
kubesenseSdk.addAction('checkout', { cartValue: 42 })
// Custom error
kubesenseSdk.addError(new Error('Something went wrong'), { source: 'checkout' })
// Identify the current user
kubesenseSdk.setUser({ id: 'u-123', name: 'Jane Doe', email: '[email protected]' })Documentation
The full API — configuration reference, view/action/error tracking, Session Replay, distributed tracing, privacy & consent, feature flags, and more — is documented in the Browser RUM Integration Guide.
