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:
- In Real User Monitoring (RUM), create separate React Native Android and React Native iOS applications, and obtain the corresponding
App IDvalues. - Confirm the reporting endpoint and authentication method:
- Local deployment: Prepare
datakitUrl -
Public DataWay: Prepare
datawayUrlandclientToken -
Install
@cloudcare/react-native-mobilein your project. -
If you need to collect Android native startup, network request, or WebView data, also configure the Android
ft-plugin.
Integration Steps¶
- Install the React Native SDK.
- Initialize
FTMobileConfigwhen the app starts. - Initialize
FTRUMConfigand pass the Android and iOSApp IDvalues. - Optional: Initialize
FTLogConfigandFTTraceConfig. - Enable debug logs, run the app, and trigger a page open, tap, or network request.
- 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.jsto 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¶
- Keep
debug: trueenabled and run the app. - Open a page, tap a button, or make a network request.
- Check the debug logs to confirm that SDK initialization and data synchronization have completed successfully.
- 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¶
- For complete installation and integration instructions, continue reading App Access.
- For information about all initialization parameters, see SDK Initialization.
- For detailed RUM, Log, and Trace configurations, see RUM Configuration, Log Configuration, and Trace Configuration.
- If you need to integrate WebView monitoring, see WebView Data Monitoring.
- If you need to integrate Session Replay, see Session Replay.
- If your project uses hybrid native and React Native development, see Hybrid Native and React Native Development.