# RUM Setup for Flutter

The Kloudfuse RUM SDK for Flutter enables you to collect real user monitoring data from Flutter applications. By installing the SDK as a plugin dependency and initializing it in your application, you can track user interactions, performance metrics, and errors across your Flutter app.

The Kloudfuse RUM SDK is available as a plugin for Flutter; include the Kloudfuse RUM SDK dependency in your application.

The Kloudfuse Flutter SDK is available as a Flutter plugin.

## Install

1. Add the following code your `pubspec.yaml` file:

```yaml
   dependencies:
        kf_sdk:
   ```

2. Fetch the SDK:

```console
   $ flutter pub get
   ```

3. Initialize the SDK:

```javascript
   import 'package:kf_sdk/kf_sdk.dart';

void main() async {
        final configuration = KfConfiguration(
          applicationId: '<APPLICATION_ID>',
          clientToken: '<CLIENT_TOKEN>',
          customEndpoint: '<KFUSE_RUM_ENDPOINT>',
          env: '<ENV>',
          sessionSamplingRate: 100,
          service: '<APPLICATION_NAME>',
          env: 'production',
          version: '1.0.0',
        );

await KfSdk.runApp(configuration, KfTrackingContent.granted, () async {
          runApp(MyApp());
        });
   }
   ```

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/4.0.2/signals/rum/add-application/). |

### configuration options

- **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/4.0.2/signals/rum/enable-aws-s3/#step5), [Azure Blob](https://docs.kloudfuse.com/platform/4.0.2/signals/rum/enable-azure-blob/#step5), or [Google GCS](https://docs.kloudfuse.com/platform/4.0.2/signals/rum/enable-google-gcs/#step5).
- **customEndpoint**: The Kloudfuse ingest endpoint for RUM events.
  `https://<kfuse-public-endpoint>/ddrumproxy`
- **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.
