Skip to content

Quick Start

This document provides the shortest integration path for the React Native RUM SDK to help you complete verifiable data reporting with minimal steps.

The app supports Agent automatic integration and manual integration. The following steps describe the minimum configuration for manual integration.

Prerequisites

Before you begin, complete the following preparations:

  1. In Real User Monitoring (RUM), create separate React Native Android and React Native iOS applications, and obtain the corresponding App ID values.
  2. Confirm the reporting endpoint and authentication method:
  3. Local deployment: Prepare datakitUrl
  4. Public DataWay: Prepare datawayUrl and clientToken

  5. Install @cloudcare/react-native-mobile in your project.

  6. If you need to collect Android native startup, network request, or WebView data, also configure the Android ft-plugin.

Integration Steps

  1. Install the React Native SDK.
  2. Initialize FTMobileConfig when the app starts.
  3. Initialize FTRUMConfig and pass the Android and iOS App ID values.
  4. Optional: Initialize FTLogConfig and FTTraceConfig.
  5. Enable debug logs, run the app, and trigger a page open, tap, or network request.
  6. Confirm in the console and the Guance platform that data has been reported successfully.

Install the SDK

For installation methods, refer directly to App Access.

Minimal Initialization Example

import {
  FTMobileReactNative,
  FTReactNativeRUM,
  FTMobileConfig,
  FTRUMConfig,
  ErrorMonitorType,
  DeviceMetricsMonitorType,
  DetectFrequency,
} from '@cloudcare/react-native-mobile';
async function sdkInit() {
  // For local deployment, use { datakitUrl: 'http://10.0.0.1:9529' }
  const config: FTMobileConfig = {
    datawayUrl: 'https://open.dataway.url',
    clientToken: 'client_token',
    debug: true,
  };
  await FTMobileReactNative.sdkConfig(config);

  const rumConfig: FTRUMConfig = {
    androidAppId: 'android_app_id',
    iOSAppId: 'ios_app_id',
    enableAutoTrackUserAction: true,
    enableAutoTrackError: true,
    enableNativeUserResource: true,
  };
  await FTReactNativeRUM.setConfig(rumConfig);
}

Complete SDK initialization before registering the app in the top-level index.js to ensure initialization is complete before calling other SDK methods.

import App from './App';

async function initSDK() {
  await sdkInit();
}

initSDK();
AppRegistry.registerComponent('main', () => App);

Optional: Initialize Log and Trace

import {
  FTReactNativeLog,
  FTReactNativeTrace,
  FTLogConfig,
  FTTraceConfig,
} from '@cloudcare/react-native-mobile';
async function setupExtraModules() {
  const logConfig: FTLogConfig = {
    enableCustomLog: true,
    enableLinkRumData: true,
  };
  await FTReactNativeLog.logConfig(logConfig);

  const traceConfig: FTTraceConfig = {
    enableNativeAutoTrace: true,
  };
  await FTReactNativeTrace.setConfig(traceConfig);
}

Verify the Integration

  1. Keep debug: true enabled and run the app.
  2. Open a page, tap a button, or make a network request.
  3. Check the debug logs to confirm that SDK initialization and data synchronization have completed successfully.
  4. Return to the Guance console and confirm that the corresponding RUM data appears in the application.

If you need further troubleshooting, see Troubleshooting.

Next Steps

Feedback

Is this page helpful?