Quick Start¶
This document provides the shortest integration path for the UniApp RUM SDK, helping you complete a verifiable data upload with minimal steps.
Prerequisites¶
Before you begin, complete the following:
- In Real User Monitoring (RUM), create a UniApp Android app and a UniApp iOS app, and obtain their respective
RUM App IDs. - Confirm the upload URL and authentication method:
- On-premise deployment: Prepare
datakitUrl. -
Public DataWay: Prepare
datawayUrlandclientToken. -
Download the datakit-uniapp-native-plugin and prepare
GCUniPluginandGC-JSPlugin.
Integration Steps¶
- Copy
GCUniPlugininto your project’snativepluginsdirectory, and enable the local plugin inmanifest.json. - Copy
GC-JSPlugininto your project’suni_modulesdirectory. - In
App.vue, callsdkConfigto initialize the SDK. - Call
rum.setConfigto configure theApp IDfor Android and iOS. - To automatically collect pages, errors, or requests, integrate the corresponding capabilities in
GC-JSPlugin. - Enable
debug, run the app, and verify that data is uploaded successfully.
Minimal Initialization Example¶
<script>
var ftModule = uni.requireNativePlugin("GCUniPlugin-MobileAgent");
var rum = uni.requireNativePlugin("GCUniPlugin-RUM");
export default {
onLaunch: function() {
ftModule.sdkConfig({
datawayUrl: "https://open.dataway.url",
clientToken: "client-token",
debug: true,
env: "common"
});
rum.setConfig({
androidAppId: "YOUR_ANDROID_APP_ID",
iOSAppId: "YOUR_IOS_APP_ID"
});
}
}
</script>
Automatic View Collection Example¶
The following is the Vue 2 calling method; for Vue 3, call gcViewTracking.startTracking(app). For the full example, see RUM View Auto-collection.
Automatic Resource Collection Example¶
Start the global collector before the first call to uni.request. Subsequent requests do not need to replace the original method:
import { gcResourceTracking } from '@/uni_modules/GC-JSPlugin';
gcResourceTracking.startTracking();
uni.request({
url: 'https://example.com/api'
});
If iOS has already enabled native Resource collection via rum.setConfig({ enableNativeUserResource: true }), call gcResourceTracking.startTracking({ enableIOS: false }) instead to avoid duplicate collection. For full details, see RUM Resource Auto-collection.
Verify Integration Success¶
- Keep
debug: trueenabled and run the app. - Open a page, or after enabling
gcResourceTracking, initiate a network request using standarduni.request. - Verify in the debug environment that SDK initialization and data sync logs are output normally.
- Return to the console and confirm that RUM data for the corresponding platform appears in the application.
Next Steps¶
- For the complete installation guide and FAQ, continue reading App Integration.
- For SDK initialization parameters, see SDK Initialization.
- For detailed configuration of RUM, Log, and Trace, see RUM Configuration, Log Configuration, and Trace Configuration.
- For custom tags, collection rules, or masking capabilities, refer to the corresponding advanced topics.