Skip to content

Quick Start

This document provides the shortest path to integrate the UniApp RUM SDK, helping you complete a verifiable data reporting with minimal steps.

Prerequisites

Before starting, please complete the following preparations:

  1. Create UniApp Android and UniApp iOS applications in RUM respectively, and obtain their respective RUM App ID.
  2. Confirm the reporting address and authentication method:
  3. Local environment deployment: Prepare datakitUrl.
  4. Public DataWay: Prepare datawayUrl and clientToken.
  5. Download datakit-uniapp-native-plugin, and prepare GCUniPlugin and GC-JSPlugin.

Integration Steps

  1. Copy GCUniPlugin to the project's nativeplugins, and enable the local plugin in manifest.json.
  2. Copy GC-JSPlugin to the project's uni_modules.
  3. Call sdkConfig in App.vue to complete SDK initialization.
  4. Call rum.setConfig to configure the App ID for Android and iOS.
  5. If automatic collection of Views, errors, or requests is needed, then integrate the corresponding capabilities from GC-JSPlugin.
  6. Enable debug, run the application, and verify if data is reported 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

import { gcViewTracking } from '@/uni_modules/GC-JSPlugin';

gcViewTracking.startTracking();

Verify Integration Success

  1. Keep debug: true enabled and run the application.
  2. Open a View, or initiate a network request via gcRequest.request.
  3. Confirm in the debugging environment that the SDK initialization and data synchronization logs are output normally.
  4. Return to the console and confirm that RUM data for the corresponding platform has appeared in the application.

Next Steps