Features

The Raygun4ReactNative provider offers a range of features to further customize the Real User Monitoring experience for your project's specifications.


The RaygunClient offers some advanced features during initialization to configure the Real User Monitoring experience. When you initialise the RaygunClient you will pass a RaygunClientOptions object to specify how your client will function:

export type RaygunClientOptions = {
  apiKey?: string;
  version?: string;
  enableCrashReporting?: boolean;
  disableNativeCrashReporting?: boolean;
  disableUnhandledPromiseRejectionReporting?: boolean;
  enableRealUserMonitoring?: boolean;
  disableNetworkMonitoring?: boolean;
  customCrashReportingEndpoint?: string;
  customRealUserMonitoringEndpoint?: string;
  logLevel?: LogLevel;
  onBeforeSendingCrashReport?: BeforeSendHandler;
  ignoredURLs?: string[];
  ignoredViews?: string[];
  maxErrorReportsStoredOnDevice?: number;
  maxBreadcrumbsPerErrorReport?: number;
};

This structure offers a wide range of customization options. Real User Monitoring related customization is outlined below (See here for Crash Reporting related advanced initialization options).

You can specify the version of your application by providing a version identifier string during initialization and this will be reflected on your Raygun Dashboard.

const options: RaygunClientOptions = {
  enableRealUserMonitoring: true,
  version: "_YOUR_PROJECT_VERSION_"
};

RaygunClient.init(options);

By default, the RaygunClient will detect and monitor the user's network activity. This can be disabled by toggling disableNetworkMonitoring during initialization.

const options: RaygunClientOptions = {
  enableRealUserMonitoring: true,
  disableNetworkMonitoring: true
};

RaygunClient.init(options);

If you want to reroute the Real User Monitoring timing events being captured to a custom endpoint you can provide a URL for them to be transmitted to before being sent to Raygun.

const options: RaygunClientOptions = {
  enableRealUserMonitoring: true,
  customRealUserMonitoringEndpoint: "https://myRealUserMonitoringEndpoint.com"
};

It is possible to provide a list of URLs on initialization that the RaygunClient will ignore when network monitoring the application.

const options: RaygunClientOptions = {
  enableRealUserMonitoring: true,
  ignoredURLs: ["http://ignoreME.com", "http://ignoreMeToo.com"]
};

When crash reports are sent the RaygunClient will automatically identify the user being affected as an anonymous User object:

type User = {
  identifier: string;
  isAnonymous?: boolean;
  email?: string;
  firstName?: string;
  fullName?: string;
  uuid?: string;
};

However, if you want to customize this data, you can using the RaygunClient.setUser(...) function to specify more information about each user. The current user can also be accessed using the RaygunClient.getUser() function.

const user: User = {
  identifier: 'Ronald Raygun',
  isAnonymous: false,
  email: 'ronald@raygun.com',
  firstName: 'Ronald',
  fullName: 'raygun',
  uuid: 'uuid'
}

RaygunClient.setUser(user);
console.log(RaygunClient.getUser());
//{"email": "ronald@raygun.com", "firstName": "Ronald", "fullName": "raygun", "identifier": "Ronald Raygun", "isAnonymous": false, "uuid": "uuid"}

// Alternatively
RaygunClient.setUser({identifier: "_NEW_IDENTIFIER_"});
console.log(RaygunClient.getUser());
//{"identifier": "_NEW_IDENTIFIER_"}

// Reset to an anonymous user
RaygunClient.setUser(null);
console.log(RaygunClient.getUser());
//{"identifier": "_UNIQUE_DEVICE_GUID_", "isAnonymous": true}

This user value is shared between Crash Reporting reports and Real User Monitoring timing events.


Tags allow you to attach an array of strings to all timing events being sent to provide more context. Tags are displayed on the Raygun dashboard so that timing events can be better categorized and filtered.

This can be done using the RaygunClient.setTags(...) function to attach the specified tags to every timing event sent from that point onwards. You can also access the current tags using the RaygunClient.getTags() method.

RaygunClient.setTags("_YOUR_FIRST_TAG_", "_ANOTHER_TAG_");
console.log(RaygunClient.getTags()); //["_YOUR_FIRST_TAG_", "_ANOTHER_TAG_"]

These tags are shared between Crash Reporting reports and Real User Monitoring timing events.


This provider is open source and available at the Raygun4ReactNative repository.