React Native Application Access¶
Collect metrics from React Native applications to analyze application performance visually.
Reading Path¶
- First-time access: start with Select an Access Method; for manual access, see Quick Start
- Full integration: continue reading this document
- Parameter details: see SDK Initialization, RUM Configuration, Log Configuration, and Trace Configuration
- Custom capabilities: see Custom Tags Usage, Custom Data Collection Rules, and Data Collection Masking
- Advanced scenarios: see the dedicated pages under the "Advanced Scenarios" group
- Troubleshooting: see Troubleshooting
Prerequisites¶
Note
If the RUM Headless service is enabled, the prerequisites have been configured automatically and you can access the application directly.
When deploying in a local environment, complete the following data receiver configuration; when using the public DataWay, you do not need to deploy DataKit yourself.
- Install DataKit;
- Configure the RUM Collector;
- Configure DataKit to be publicly accessible and install the IP geolocation database.
Application Access¶
Note
The current React Native version supports only the Android and iOS platforms.
- Go to RUM > Create Application > React Native;
- Create two applications, one for React Native Android and one for React Native iOS, so that RUM data from the Android and iOS platforms can be received separately;
- Enter the corresponding application name and application ID for each platform's application;
- In "Select an Access Method", choose Agent Automatic Access or Manual Access, then complete "Access Configuration".
Select an Access Method¶
On the application configuration page, select "Agent Automatic Access" or "Manual Access", then complete "Access Configuration". For existing applications, you can go directly to the configuration page to continue the access.
| Access Method | Use Cases | Entry Point |
|---|---|---|
| Agent Automatic Access | Want a coding assistant to analyze the project and complete the SDK integration | Copy the prompt generated in the console and hand it to the coding assistant in the application code repository |
| Manual Access | Want to install the SDK and configure parameters yourself | Confirm the data reporting method, then follow this document and Quick Start to complete the configuration |
Agent Automatic Access¶
- On the current application's configuration page, select "Agent Automatic Access".
- Copy the complete prompt from "Access Configuration", ensuring it uses the current application's access information.
- Open the coding assistant in the application code repository, paste the prompt, and let the Agent analyze the project and complete the SDK configuration according to the access guide.
- Build and run the application, trigger operations such as page views, and confirm in the current application's Explorer that data is received.
When using a cross-platform framework, tell the Agent the framework and target platforms, and provide the application information for each platform separately.
If the page indicates that your personal API Key or temporary authorization code is not ready, complete it as prompted, then copy the prompt again.
Manual Access¶
On the application configuration page, select "Manual Access" and confirm the data reporting method:
- Public DataWay: receives RUM data directly; no need to install the DataKit Collector.
- Local environment deployment: receives RUM data after the prerequisites are met.
Follow Installation and Quick Start below to complete SDK installation, initialization, and verification. If an SDK configuration already exists, review and reuse it first to avoid duplicate initialization.
Installation¶
Source Code: https://github.com/TrueWatchTech/datakit-react-native
Demo: https://github.com/TrueWatchTech/datakit-react-native/example
In the project directory, run the following command in the terminal:
This adds the following dependency to the package's package.json:
Additional Android Integration Configuration:
-
Configure the Gradle Plugin ft-plugin to collect app launch events and network request data, as well as Android Native events (page navigation, click events, Native network requests, and WebView data).
-
You also need to configure the TrueWatch Android Maven repository address in Gradle for both the Plugin and the AAR. For configuration details, see build.gradle in the example.
Initialization Notes¶
For a minimal initialization example, see Quick Start.
For complete FTMobileConfig parameter descriptions, see SDK Initialization.
Detailed Configuration Entry Points¶
Advanced Scenarios¶
- Custom Tags Usage
- Custom Data Collection Rules
- Data Collection Masking
- Dynamic Configuration
- Symbol File Upload
- SourceMap Version Matching for Hot Updates
- WebView Data Monitoring
- Visitor ID
- Hybrid Development with Native and React Native
- Manual Android Resource Configuration