# RUM Setup for React Native

The Kloudfuse RUM SDK is available as a package for React Native; include the Kloudfuse RUM SDK dependency in your application.

The Kloudfuse React Native SDK is available as an NPM package.

### Install

1. Use a package manager to install the Kloudfuse React Native SDK.

```console
   $ npm install kf-react-native-sdk
   ```

Copied!

2. Install the pod.

```console
   $ cd ios && pod install
   ```

Copied!

3. Initialize the SDK in the App.

```javascript
   import { KfProvider } from 'kf-react-native-sdk';
   
   //Wrap the content of your App component in a KfProvider component, passing it your configuration:
   
   const config = {
          applicationId: <APPLICATION_ID>,
          clientToken: <CLIENT_TOKEN>,
          env: <ENV>,
          proxy: <KFUSE_RUM_ENDPOINT>,
          sessionSamplingRate: 100,
          serviceName: <SERVICE_NAME>,
          version: 1.0.0,
   };
   
   export default function App() {
          return (
              <KfProvider config={config}>
                  <Navigation />
              </KfProvider>
          );
   }
   ```

javascriptCopied!

The possible configuration options are:

|     |     |
| --- | --- |
|  | After adding new application to RUM, copy the **Integration Code**, and use it to specify the `appId`, `clientToken`, and `service`. See [RUM Add New Application](https://docs.kloudfuse.com/platform/3.2.5/rum-add-application/). |

**applicationId**  
A UUID that uniquely identifies a specific frontend application. All RUM telemetry will be associated with it.

**clientToken**  
A token that identifies valid producers of RUM telemetry. You may supply the value `dummy` if authenticated ingestion is not enabled during Kloudfuse install. When authenticated ingestion is enabled, this value must match one of the configured authentication tokens for RUM. See our _Enable Authenticated Ingestion_ documentation for [AWS S3](https://docs.kloudfuse.com/platform/3.2.5/rum-enable-aws-s3/#step5), [Azure Blob](https://docs.kloudfuse.com/platform/3.2.5/rum-enable-azure-blob/#step5), or [Google GCS](https://docs.kloudfuse.com/platform/3.2.5/rum-enable-google-gcs/#step5).

**proxy**  
The Kloudfuse ingest endpoint for RUM events; its value would be `https://<kfuse-public-endpoint>/ddrumproxy`.

|     |     |
| --- | --- |
|  | Your frontend application **_must not_** restrict `POST` requests to this endpoint. Specifically, when using a `Content-Security-Policy`, your frontend application **_must allow_** requests to this endpoint. |

**service**  
A "friendly" name, unique to the instrumented frontend application.

**env**  
The name that identifies a logical source of RUM events. For example, the test environment or production environment.

**version**  
The string that represents the unique frontend application build, such as 1.0.0.

**sessionSamplingRate**  
The Percentage of user sessions that generate RUM telemetry; valid range is 0 to 100.
