This repository demonstrates integrating groundcover's Real User Monitoring (RUM) SDK into a React and Vite application.
-
Install the SDK
npm install @groundcover/browser- Initialize in your app entry point
import groundcover from "@groundcover/browser";
groundcover.init({
cluster: "dev",
environment: "dev",
appId: "app-id",
dsn: "<your-dsn>",
apiKey: "<your api key>",
});The sample app shows how to capture exceptions:
const handleCheckout = async () => {
try {
aFunctionThatThrowsAnError();
} catch (error) {
groundcover.captureException(error);
}
};The sample app shows how to send custom events:
groundcover.sendCustomEvent({
event: "checkout",
attributes: { totalItems: cartTotal }
});| Option | Description |
|---|---|
cluster |
Cluster name (e.g., "dev", "prod") |
environment |
Application environment |
appId |
Application identifier |
dsn |
Data Source Name endpoint URL |
apiKey |
groundcover API key |
export interface SDKOptions {
batchSize: number;
batchTimeout: number;
eventSampleRate: number;
sessionSampleRate: number;
environment: string;
debug: boolean;
tracePropagationUrls: string[];
beforeSend: (event: Event) => boolean;
excludedUrls: [];
}