groundcover’s Real User Monitoring (RUM) SDK allows you to capture front-end performance data, user events, and errors from your web applications.
Start capturing RUM data by installing the in your web app.
This guide will walk you through installing the SDK, initializing it, identifying users, sending custom events, capturing exceptions, and configuring optional settings.
Install the SDK
Copy npm install @groundcover/browser
# or
yarn add @groundcover/browser
Initialize the SDK
Initialization
Copy import groundcover from '@groundcover/browser';
groundcover.init({
apiKey: 'your-api-key',
cluster: 'your-cluster',
environment: 'production',
dsn: 'your-dsn',
appId: 'your-app-id',
});
Configuration Parameters
Your groundcover authentication API key.
Your public groundcover endpoint in the format of example.platform.grcv.io
.
It's your ingress.site
installation value.
Identifier for your cluster; helps filter RUM data by specific cluster.
Environment label (e.g., production
, staging
) used for filtering data.
Custom application identifier set by you; useful for filtering and segmenting data on a single application level later.
Advanced Configuration
You can customize SDK behavior (event sampling, data masking, enabled events). The following properties are customizable:
Copy export interface SDKOptions {
batchSize: number;
batchTimeout: number;
eventSampleRate: number;
sessionSampleRate: number;
environment: string;
debug: boolean;
tracePropagationUrls: string[];
beforeSend: (event: Event) => boolean;
enabledEvents: Array<"dom" | "network" | "exceptions" | "logs" | "pageload" | "navigation" | "performance">;
excludedUrls: [];
}
You can pass the values by calling the init function:
Copy groundcover.init({
apiKey: 'your-api-key',
cluster: 'your-cluster',
environment: 'production',
dsn: 'your-dsn',
appId: 'your-app-id',
options: {
batchSize: 50,
sessionSampleRate: 0.5, // 50% sessions sampled
eventsSampleRate: 0.5,
},
});
Or via the updateConfig function:
Copy groundcover.updateConfig({
batchSize: 20,
});
Identify Users
Link RUM data to specific users:
Copy groundcover.identifyUser({
id: 'user-id',
email: 'user@example.com',
});
Send Custom Events
Instrument key user interactions:
Copy groundcover.sendCustomEvent({
event: 'PurchaseCompleted',
attributes: { orderId: 1234, amount: 99.99 },
});
Capture Exceptions
Manually track caught errors:
Copy try {
performAction();
} catch (error) {
groundcover.captureException(error);
}