UniApp Application Access¶
Prerequisites¶
Note: If you have activated the RUM Headless service, the prerequisites have been automatically configured for you. You can directly proceed with application access.
- Install DataKit;
- Configure the RUM Collector;
- Configure DataKit to be accessible via the public network and install the IP Geolocation database.
Application Access¶
- Go to RUM > Create Application > Android/iOS;
- Create two separate applications for UniApp Android and UniApp iOS to receive RUM data from the Android and iOS platforms respectively;
- Enter the corresponding Application Name and Application ID for each platform's application;
- Choose the application access method:
- Public DataWay: Directly receives RUM data without installing the DataKit collector.
- Local Environment Deployment: Receives RUM data after meeting the prerequisites.
Installation¶
Local Usage¶
Source Code: https://github.com/GuanceCloud/datakit-uniapp-native-plugin
Demo: https://github.com/GuanceCloud/datakit-uniapp-native-plugin/Hbuilder_Example
Structure of the downloaded SDK package:
|--datakit-uniapp-native-plugin
|-- Hbuilder_Example // Example project for the GCUniPlugin plugin
|-- uni_modules
|-- GC-JSPlugin // ⭐️ GC-JSPlugin JS Plugin Package ⭐️
| |-- js_sdk // Folder containing js files
|-- View/GCPageMixin.js // js for view auto-capture, used together with GCWatchRouter.js
|-- View/GCWatchRouter.js // js for view auto-capture, used together with GCPageMixin.js
|-- View/GCPageViewMixinOnly.js // js for view auto-capture, GCPageViewMixinOnly.js used alone
|-- Request/GCRequest.js // js for resource and trace, provides APM and network request monitoring capabilities
|-- Error/GCErrorTracking.js // js for error auto-capture, supports collecting uni.onError, console.error
| |-- index.js
| |-- package.json // Plugin configuration file
|-- nativeplugins // Local plugins folder for the example project
|-- GCUniPlugin // ⭐️ GCUniPlugin Native Plugin Package ⭐️
| |-- android // Contains dependency libraries and resource files for the android plugin
| |-- ios // Contains dependency libraries and resource files for the ios plugin
| |-- package.json // Plugin configuration file
|-- UniPlugin-Android // Main Android project for plugin development
|-- UniPlugin-iOS // Main iOS project for plugin development
Configure the GCUniPlugin folder into the "nativeplugins" directory of your uni_app project. You also need to go to the "App Native Plugin Configuration" section in the manifest.json file, click "Select Local Plugin", and choose the GCUniPlugin plugin from the list:
Configure the GC-JSPlugin folder into the "uni_modules" directory of your uni_app project.
Note: After saving, you need to submit for cloud packaging (making a custom debugger also counts as cloud packaging) for the plugin to take effect.
For more details, refer to: Using Local Plugins in HBuilderX, Custom Debugger
Marketplace Plugin Method¶
(Not provided)
Uni Mini Program SDK Installation¶
Development Debugging and wgt Release Usage¶
-
When developing and debugging the uni mini program SDK, you need to integrate GCUniPlugin using the Local Usage method.
-
When the uni mini program SDK is packaged into a wgt package for use by a host App, the host App needs to import the dependency libraries of GCUniPlugin (including the Native SDK libraries) and register the GCUniPlugin Module.
Operations required for the host App:
iOS
-
Add GCUniPlugin dependency libraries
In the Xcode project, select the project name in the left directory, go to
TARGETS -> Build Phases -> Link Binary With Libaries, click the "+" button, in the pop-up window clickAdd Other -> Add Files..., then open theGCUniPlugin/ios/dependency library directory, selectFTMobileSDK.xcframeworkandGC_UniPlugin_App.xcframeworkin the directory, and click theopenbutton to add the dependency libraries to the project.When SDK Version < 0.2.0: In
TARGETS -> General -> Frameworks,Libaries,and Embedded Content, findFTMobileSDK.xcframeworkand change the Embed method toEmbed & sign. -
Register GCUniPlugin Module:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
....
// Register GCUniPlugin module
[WXSDKEngine registerModule:@"GCUniPlugin-MobileAgent" withClass:NSClassFromString(@"FTMobileUniModule")];
[WXSDKEngine registerModule:@"GCUniPlugin-RUM" withClass:NSClassFromString(@"FTRUMModule")];
[WXSDKEngine registerModule:@"GCUniPlugin-Logger" withClass:NSClassFromString(@"FTLogModule")];
[WXSDKEngine registerModule:@"GCUniPlugin-Tracer" withClass:NSClassFromString(@"FTTracerModule")];
return YES;
}
Android
-
Add GCUniPlugin dependency libraries
-
Method 1: Add
ft-native-[version].aar,ft-sdk-[version].aar, andgc-uniplugin-[last-version].aarfrom theGCUniPlugin/android/folder to thelibsfolder of your project, and modify thebuild.gradlefile to add dependencies. - Method 2: Use the Gradle Maven remote repository for configuration. The configuration method can refer to the UniAndroid-Plugin project configuration.
dependencies {
implementation files('libs/ft-native-[version].aar')
implementation files('libs/ft-sdk-[version].aar')
implementation files('libs/gc-uniplugin-[last-version].aar')
implementation 'com.google.code.gson:gson:2.8.5'
}
- Register GCUniPlugin Module:
public class App extends Application {
@Override
public void onCreate() {
super.onCreate();
try {
// Register GCUniPlugin module
WXSDKEngine.registerModule("GCUniPlugin-Logger", FTLogModule.class);
WXSDKEngine.registerModule("GCUniPlugin-RUM", FTRUMModule.class);
WXSDKEngine.registerModule("GCUniPlugin-Tracer", FTTracerModule.class);
WXSDKEngine.registerModule("GCUniPlugin-MobileAgent", FTSDKUniModule.class);
} catch (Exception e) {
e.printStackTrace();
}
......
}
}
Mixed Usage of UniApp SDK and Native SDK¶
-
When performing the above operation to add GCUniPlugin dependency libraries, the Native SDK has already been added to the host project, so you can directly call Native SDK methods.
-
SDK Initialization
For mixed usage, you only need to initialize the Native SDK within the host App. No initialization configuration is needed within the uni mini program; you can directly call the methods provided by the UniApp SDK.
The SDK initialization method within the host App please refer to iOS SDK Initialization Configuration, Android SDK Initialization Configuration.
Note: Please ensure the SDK initialization is completed within the host App before loading the uni mini program to ensure the SDK is fully ready before calling any other SDK methods.
-
Additional Configuration for Android Integration:
Configure the Gradle Plugin ft-plugin to collect App startup events, network request data, and Android Native related events (page navigation, click events, Native network requests, WebView data).
-
Distinguishing data collected by uni mini program and Native:
Supported in SDK 0.2.4 and above
You can add BridgeContext in the uni mini program to filter or correlate data for specific scenarios based on the set key-value pairs.
For example: You can filter by
wgt_id:wgt_id_1to view data collected by the uni mini program.
SDK Initialization¶
Basic Configuration¶
// Configure in App.vue
<script>
var ftModule = uni.requireNativePlugin("GCUniPlugin-MobileAgent");
export default {
onLaunch: function() {
ftModule.sdkConfig({
'datakitUrl': 'your datakitUrl',
'debug': true,
'env': 'common',
'globalContext': {
'custom_key': 'custom value'
}
})
}
}
</script>
<style>
</style>
| Parameter Name | Parameter Type | Required | Parameter Description |
|---|---|---|---|
| datakitUrl | string | Yes | URL address for local environment deployment (Datakit) reporting. Example: http://10.0.0.1:9529. Port defaults to 9529. The device installing the SDK must be able to access this address. Note: Choose one between datakitUrl and datawayUrl. |
| datawayUrl | string | Yes | URL address for public Dataway reporting. Obtain from the [RUM] application. Example: https://open.dataway.url. The device installing the SDK must be able to access this address. Note: Choose one between datakitUrl and datawayUrl. |
| clientToken | string | Yes | Authentication token, must be used together with datawayUrl. |
| debug | boolean | No | Sets whether to allow printing Debug logs. Default false. |
| env | string | No | Environment. Default prod. Any string, recommended to use a single word like test. |
| service | string | No | Sets the name of the belonging business or service. Default: df_rum_ios, df_rum_android. |
| globalContext | object | No | Adds custom tags. |
| offlinePakcage | boolean | No | Only supported on Android. Whether to use offline packaging or uni mini program. Default false. For details, see Difference between Android Cloud Packaging and Offline Packaging. |
| autoSync | boolean | No | Whether to automatically sync data to the server after collection. Default YES. When NO, use the flushSyncData method to manage data synchronization manually. |
| syncPageSize | number | No | Sets the number of entries per sync request. Range [5,). Note: A larger number of request entries means data synchronization consumes more computing resources. Default is 10. |
| syncSleepTime | number | No | Sets the sync interval time. Range [0,5000], default is not set. |
| enableDataIntegerCompatible | boolean | No | Recommended to enable when coexistence with web data is needed. This configuration handles web data type storage compatibility issues. Enabled by default in versions 0.2.1 and later. |
| compressIntakeRequests | boolean | No | Deflate compression for uploaded sync data. Disabled by default. Supported in SDK version 0.2.0 and above. |
| enableLimitWithDbSize | boolean | No | Enable using db to limit data size. Default 100MB, unit Byte. Larger database means more disk pressure. Disabled by default. Note: After enabling, the Log configuration logCacheLimitCount and RUM configuration rumCacheLimitCount will become invalid. Supported in SDK version 0.2.0 and above. |
| dbCacheLimit | number | No | DB cache size limit. Range [30MB,), default 100MB, unit byte. Supported in SDK version 0.2.0 and above. |
| dbDiscardStrategy | string | No | Sets the data discard rule in the database. Discard strategies: discard discard new data (default), discardOldest discard old data. Supported in SDK version 0.2.0 and above. |
| dataModifier | object | No | Modify a single field. Supported in SDK 0.2.2 and above. See example here. |
| lineDataModifier | object | No | Modify a single piece of data. Supported in SDK 0.2.2 and above. See example here. |
RUM Configuration¶
var rum = uni.requireNativePlugin("GCUniPlugin-RUM");
rum.setConfig({
'androidAppId':'YOUR_ANDROID_APP_ID',
'iOSAppId':'YOUR_IOS_APP_ID',
'errorMonitorType':'all', // or 'errorMonitorType':['battery','memory']
'deviceMonitorType':['cpu','memory']// or 'deviceMonitorType':'all'
})
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| androidAppId | string | Yes | appId, applied for in Monitoring. |
| iOSAppId | string | Yes | appId, applied for in Monitoring. |
| samplerate | number | No | Sampling rate. Value range [0,1]. 0 means no collection, 1 means full collection. Default is 1. Scope: all View, Action, LongTask, Error data under the same session_id. |
| sessionOnErrorSampleRate | number | No | Sets the error collection rate. When a session is not sampled by samplerate, if an error occurs during the session, data from 1 minute before the error can be collected. Value range [0,1]. 0 means no collection, 1 means full collection. Default is 0. Scope: all View, Action, LongTask, Error data under the same session_id. Supported in SDK 0.2.2 and above. |
| enableNativeUserAction | boolean | No | Whether to track Native Action, Button click events. Recommended to disable for pure uni-app applications. Default false. Not supported in Android cloud packaging. |
| enableNativeUserResource | boolean | No | Whether to enable automatic Native Resource tracking. Default false. Not supported in Android cloud packaging. Since uniapp network requests on iOS are implemented using system APIs, enabling this will collect all iOS resource data. Please disable manual collection on iOS at this time to prevent duplicate data collection. |
| enableNativeUserView | boolean | No | Whether to enable automatic Native View tracking. Recommended to disable for pure uni-app applications. Default false. |
| errorMonitorType | string/array | No | Error monitoring supplement types: all, battery, memory, cpu. Not set by default. |
| deviceMonitorType | string/array | No | Page monitoring supplement types: all, battery (only Android supported), memory, cpu, fps. Not set by default. |
| detectFrequency | string | No | Page monitoring frequency: normal (default), frequent, rare. |
| globalContext | object | No | Custom global parameters. Special key: track_id (used for tracing function). |
| enableResourceHostIP | boolean | No | Whether to collect the IP address of the requested target domain name. Scope: only affects default collection when enableNativeUserResource is true. iOS: Supported on >= iOS 13. Android: A single Okhttp has an IP caching mechanism for the same domain name. Under the same OkhttpClient, and if the server IP does not change, it will only be generated once. |
| enableTrackNativeCrash | boolean | No | Whether to enable monitoring of Android Java Crash and OC/C/C++ crashes. Default false. |
| enableTrackNativeAppANR | boolean | No | Whether to enable Native ANR monitoring. Default false. |
| enableTrackNativeFreeze | boolean | No | Whether to collect Native Freeze. |
| nativeFreezeDurationMs | number | No | Sets the threshold for collecting Native Freeze stutters. Value range [100,), unit milliseconds. iOS default 250ms, Android default 1000ms. |
| rumDiscardStrategy | string | No | Discard strategy: discard discard new data (default), discardOldest discard old data. |
| rumCacheLimitCount | number | No | Local cache maximum RUM entry count limit [10_000,), default 100_000. |
Log Configuration¶
var logger = uni.requireNativePlugin("GCUniPlugin-Logger");
logger.setConfig({
'enableLinkRumData':true,
'enableCustomLog':true,
'discardStrategy':'discardOldest'
})
| Parameter Name | Parameter Type | Required | Parameter Description |
|---|---|---|---|
| samplerate | number | No | Sampling rate. Value range [0,1]. 0 means no collection, 1 means full collection. Default is 1. |
| enableLinkRumData | boolean | No | Whether to link with RUM data. |
| enableCustomLog | boolean | No | Whether to enable custom logs. |
| discardStrategy | string | No | Log discard strategy: discard discard new data (default), discardOldest discard old data. |
| logLevelFilters | array |
No | Log level filter. The array needs to contain log levels: info, warning, error, critical, ok. |
| globalContext | object | No | Custom global parameters. |
| logCacheLimitCount | number | No | Local cache maximum log entry count limit [1000,). Larger logs mean greater disk cache pressure. Default 5000. |
Trace Configuration¶
var tracer = uni.requireNativePlugin("GCUniPlugin-Tracer");
tracer.setConfig({
'traceType': 'ddTrace'
})
| Parameter Name | Parameter Type | Required | Parameter Description |
|---|---|---|---|
| samplerate | number | No | Sampling rate. Value range [0,1]. 0 means no collection, 1 means full collection. Default is 1. |
| traceType | string | No | Trace type: ddTrace (default), zipkinMultiHeader, zipkinSingleHeader, traceparent, skywalking, jaeger. |
| enableLinkRUMData | boolean | No | Whether to link with RUM data. Default false. |
| enableNativeAutoTrace | boolean | No | Whether to enable native network auto-tracing for iOS NSURLSession, Android OKhttp. Default false. Not supported in Android cloud packaging. Since uniapp network requests on iOS are implemented using system APIs, enabling this will automatically trace network requests initiated by uniapp on iOS. Please disable manual trace on iOS at this time to prevent incorrect association between traces and RUM data. |
RUM User Data Tracking¶
Action¶
API - startAction¶
Starts a RUM Action.
RUM will bind Resource, Error, LongTask events that this Action might trigger. Avoid adding multiple times within 0.1s. Only one Action can be associated with a View at the same time. If a previous Action hasn't ended, a new one will be discarded. Does not interfere with Actions added by the addAction method.
| Parameter Name | Parameter Type | Required | Parameter Description |
|---|---|---|---|
| actionName | string | Yes | Event name. |
| actionType | string | Yes | Event type. |
| property | object | No | Event context (optional). |
API - addAction¶
Adds an Action event. This type of data cannot associate Error, Resource, LongTask data and has no discard logic.
| Parameter Name | Parameter Type | Required | Parameter Description |
|---|---|---|---|
| actionName | string | Yes | Event name. |
| actionType | string | Yes | Event type. |
| property | object | No | Event context (optional). |
View¶
- Automatic Collection
Method 1 (Recommended):
Import and call the collection method in the project's main.js. Configuration code is as follows:
import {
gcViewTracking
} from '@/uni_modules/GC-JSPlugin'
// Enable View auto-collection
gcViewTracking.startTracking();
Method 2:
App.vue + first page combination configuration. Refer to the example project Hbuilder_Example/App.vue, Hbuilder_Example/pages/index/index.vue in the SDK package's GCUniPlugin plugin.
// step 1. Add GC-JSPlugin locally to your project's uni_modules directory.
// step 2. Add Router monitoring in App.vue, as follows:
<script>
import {gcWatchRouter} from '@/uni_modules/GC-JSPlugin';
export default {
mixins:[gcWatchRouter], //<--- Notice
}
</script>
// step 3. Add pageMixin to the first displayed page of the application, as follows:
<script>
import {gcPageMixin} from '@/uni_modules/GC-JSPlugin';
export default {
data() {
return {}
},
mixins:[gcPageMixin], //<--- Notice
}
</script>
Method 3:
Only monitor specific pages, applied to each page that needs monitoring. Refer to the example project Hbuilder_Example/pages/rum/index.vue in the SDK package's GCUniPlugin plugin.
// Add GC-JSPlugin locally to your project's uni_modules directory.
<script>
import {gcPageViewMixinOnly} from '@/uni_modules/GC-JSPlugin';
export default {
data() {
return {
}
},
mixins:[gcPageViewMixinOnly], //<--- Notice
methods: {}
}
</script>
- Manual Collection
// Manually collect View lifecycle
// step 1 (optional)
rum.onCreateView({
'viewName': 'Current Page Name',
'loadTime': 100000000,
})
// step 2
rum.startView('Current Page Name')
// step 3
rum.stopView()
API - onCreateView¶
Creates a page load time record.
| Field | Type | Required | Description |
|---|---|---|---|
| viewName | string | Yes | Page name. |
| loadTime | number | Yes | Page load time (nanosecond timestamp). |
API - startView¶
Enters a page.
| Field | Type | Required | Description |
|---|---|---|---|
| viewName | string | Yes | Page name. |
| property | object | No | Event context (optional). |
API - stopView¶
Leaves a page.
| Field | Type | Required | Description |
|---|---|---|---|
| property | object | No | Event context (optional). |
Error¶
- Automatic Collection
// Add GC-JSPlugin locally to your project's uni_modules directory.
import { gcErrorTracking } from '@/uni_modules/GC-JSPlugin'
gcErrorTracking.startTracking()
- Manual Collection
API - addError¶
Adds an Error event.
| Field | Type | Required | Description |
|---|---|---|---|
| message | string | Yes | Error message. |
| stack | string | Yes | Stack information. |
| state | string | No | App running state (unknown, startup, run). |
| type | string | No | Error type. Default uniapp_crash. |
| property | object | No | Event context (optional). |
Resource¶
- Automatic Collection
The SDK provides the calling method gcRequest.request, which inherits the network request method of uni.request and can be used as a replacement for uni.request.
Replacement Method
+ import {gcRequest} from '@/uni_modules/GC-JSPlugin';
- uni.request({
+ gcRequest.request({
//...
});
Usage Example
// Add GC-JSPlugin locally to your project's uni_modules directory.
import {gcRequest} from '@/uni_modules/GC-JSPlugin';
gcRequest.request({
url: requestUrl,
method: method,
header: header,
filterPlatform:["ios"],
timeout:30000,
success(res) {
console.log('success:' + JSON.stringify(res))
},
fail(err) {
console.log('fail:' + JSON.stringify(err))
},
complete() {
console.log('complete:' + JSON.stringify(err))
}
});
| Extra Field | Type | Required | Description |
|---|---|---|---|
| filterPlatform | array | No | When the enableNativeUserResource feature is enabled, uniapp on iOS will automatically collect network request data initiated through system APIs. To avoid duplicate data collection, you can add the parameter filterPlatform: ["ios"] when using gc.request to disable manual data collection on the iOS platform. |
- Manual Collection
Manually call startResource, stopResource, addResource to implement. You can refer to the implementation of GCRequest.js.
API - startResource¶
HTTP request starts.
| Field | Type | Required | Description |
|---|---|---|---|
| key | string | Yes | Unique request identifier. |
| property | object | No | Event context (optional). |
API - stopResource¶
HTTP request ends.
| Field | Type | Required | Description |
|---|---|---|---|
| key | string | Yes | Unique request identifier. |
| property | object | No | Event context (optional). |
API - addResource¶
| Parameter Name | Parameter Type | Required | Parameter Description |
|---|---|---|---|
| key | string | Yes | Unique request identifier. |
| content | content object | Yes | Request related data. |
content object¶
| Prototype | Parameter Type | Parameter Description |
|---|---|---|
| url | string | Request URL. |
| httpMethod | string | HTTP method. |
| requestHeader | object | Request headers. |
| responseHeader | object | Response headers. |
| responseBody | string | Response result. |
| resourceStatus | string | Request result status code. |
Logger Log Printing¶
var logger = uni.requireNativePlugin("GCUniPlugin-Logger");
logger.logging({
'content':`Log content`,
'status':status
})
API - logging¶
| Field | Type | Required | Description |
|---|---|---|---|
| content | string | Yes | Log content, can be a JSON string. |
| status | string | Yes | Log level. |
| property | object | No | Event context (optional). |
Log Levels¶
| String | Meaning |
|---|---|
| info | Info |
| warning | Warning |
| error | Error |
| critical | Critical |
| ok | Ok |
Tracer Network Trace¶
- Automatic Collection
Using the gc.request method for requests will automatically add Propagation Headers. Refer to Resource.
- Manual Collection
//Example using uni.request for network requests
var tracer = uni.requireNativePlugin("GCUniPlugin-Tracer");
let key = Utils.getUUID();//Refer to Hbuilder_Example/utils.js
var header = tracer.getTraceHeader({
'key': key,
'url': requestUrl,
})
uni.request({
url: requestUrl,
header: header,
success() {
},
complete() {
}
});
API - getTraceHeader¶
Gets the request headers needed for trace, which should be added to the HTTP request headers.
| Field | Type | Required | Description |
|---|---|---|---|
| key | string | Yes | Unique request identifier. |
| url | string | Yes | Request URL. |
Return type: object
User Information Binding and Unbinding¶
var ftModule = uni.requireNativePlugin("GCUniPlugin-MobileAgent");
ftModule.bindRUMUserData({
'userId':'Test userId',
'userName':'Test name',
'userEmail':'test@123.com',
'extra':{
'age':'20'
}
})
ftModule.unbindRUMUserData()
API - bindRUMUserData¶
Binds user information:
| Field | Type | Required | Description |
|---|---|---|---|
| userId | string | Yes | User ID. |
| userName | string | No | User name. |
| userEmail | string | No | User email. |
| extra | object | No | User's extra information. |
API - unbindRUMUserData¶
Unbinds the current user.
Shut Down SDK¶
API - shutDown¶
Shuts down the SDK.
Clear SDK Cache Data¶
API - clearAllData¶
Clears all data that has not yet been uploaded to the server.
Active Data Synchronization¶
API - flushSyncData¶
When sdkConfig.autoSync is configured as true, no additional operation is needed; the SDK will perform automatic synchronization.
When sdkConfig.autoSync is configured as false, you need to actively trigger the data synchronization method to synchronize data.
WebView Data Monitoring¶
WebView data monitoring requires integrating the Web Monitoring SDK into the WebView access page.
Android only supports offline packaging and uni mini programs.
Data Masking¶
If you want to fully mask a field, it is recommended to use dataModifier, which performs better. If you need detailed rule replacement, lineDataModifier is recommended.
Single Field Modification (dataModifier)
- Function: Modifies the value of a single field in the data.
- Parameter format:
{key: newValue} - Example:
{'device_uuid': 'xxx'}will replace thedevice_uuidfield value of the target data with "xxx".
Single Data Line Modification (lineDataModifier)
- Function: Modifies the specified field value in a certain type of data.
- Parameter format:
{measurement: {key: newValue}} - Example:
{'view': {'view_url': 'xxx'}}will modify theview_urlfield value of allviewtype data to "xxx". measurementdata type list:- RUM data:
view,resource,action,long_task,error - Log data:
log
var ftModule = uni.requireNativePlugin("GCUniPlugin-MobileAgent");
ftModule.sdkConfig({
datakitUrl: 'your datakitUrl',
debug: true,
dataModifier: { 'device_uuid':'xxx'},
lineDataModifier:{ 'resource' :{'response_header':'xxx'},
'view' :{'view_url':'xxx'},
}
})
Add Custom Tags¶
var ftModule = uni.requireNativePlugin("GCUniPlugin-MobileAgent");
ftModule.appendGlobalContext({
'ft_global_key':'ft_global_value'
})
ftModule.appendRUMGlobalContext({
'ft_global_rum_key':'ft_global_rum_value'
})
ftModule.appendLogGlobalContext({
'ft_global_log_key':'ft_global_log_value'
})
API - appendGlobalContext¶
Adds custom global parameters. Affects RUM and Log data.
| Field | Type | Required | Description |
|---|---|---|---|
| None | object | Yes | Custom global parameters. |
API - appendRUMGlobalContext¶
Adds custom RUM global parameters. Affects RUM data.
| Field | Type | Required | Description |
|---|---|---|---|
| None | object | Yes | Custom global RUM parameters. |
API - appendLogGlobalContext¶
Adds custom Log global parameters. Affects Log data.
| Field | Type | Required | Description |
|---|---|---|---|
| None | object | Yes | Custom global Log parameters. |
Add BridgeContext¶
Supported in SDK 0.2.4 and above.
var ftModule = uni.requireNativePlugin("GCUniPlugin-MobileAgent");
ftModule.appendBridgeContext({
'ft_bridge_context': 'ft_bridge_context_value'
});
API - appendBridgeContext¶
Only injects into RUM and log data collected by UniApp. Data collected by the Native end is not injected.
Purpose: Distinguish data sources or mark specific scenarios.
| Field | Type | Required | Description |
|---|---|---|---|
| None | object | Yes | UniApp environment parameters. |
FAQ¶
Using the Plugin Development iOS Main Project UniPlugin-iOS¶
Download the UniApp Offline Development SDK¶
According to the version number of the uni-app development tool HBuilderX, download the SDK package required for developing the plugin.
SDK package structure description:
|--iOSSDK
|-- HBuilder-Hello // uni-app offline packaging project
|-- HBuilder-uniPluginDemo // uni-app plugin development main project (project needed for this document)
|-- SDK // Dependency libraries and resource files
Drag the dependency libraries and resource files SDK folder into the UniPlugin-iOS folder. The directory structure after dragging should be as follows.
|-- UniPlugin-iOS
|-- HBuilder-uniPluginDemo // uni-app plugin development main project (project needed for this document)
|-- SDK // Dependency libraries and resource files
For more details, refer to iOS Plugin Development Environment Configuration.
Project Configuration¶
- Architectures Settings
Because the simulator provided by Xcode 12 supports the arm64 architecture, and the framework provided by uni_app supports the arm64 real device and x86_64 simulator. So,
Set Excluded Architectures to Any iOS Simulator SDK: arm64.
- Other Linker Flags
- Framework Search Paths
$(inherited)
"${PODS_CONFIGURATION_BUILD_DIR}/FTMobileSDK"
"${PODS_CONFIGURATION_BUILD_DIR}/GC-UniPlugin-App"
$(DEVELOPER_FRAMEWORKS_DIR)
$(PROJECT_DIR)/../SDK/libs
$(PROJECT_DIR)
Using the Plugin Development Android Main Project UniPlugin-Android¶
Project Configuration¶
For detailed dependency configuration, refer to the Demo. For more Gradle extension parameter configurations, refer to Android SDK.
|-- UniPlugin-Android
|-- app
|--build.gradle
// ---> Configure ft-plugin
// apply:'ft-plugin'
|-- uniplugin_module
|-- src
|-- main
|-- java
|-- com.ft.sdk.uniapp
|-- build.gradle
//---> Configure dependencies
//implementation 'com.cloudcare.ft.mobile.sdk.tracker.agent:ft-sdk:xxxx'
//implementation 'com.google.code.gson:gson:xxxx'
//implementation 'com.cloudcare.ft.mobile.sdk.tracker.agent:ft-native:xxxx'
|-- build.gradle
//---> Configure repo
// maven {
// url 'https://mvnrepo.jiagouyun.com/repository/maven-releases'
// }
//
//--> Configure buildScrpit
// classpath 'com.cloudcare.ft.mobile.sdk.tracker.plugin:ft-plugin:xxxx'
Difference Between Android Cloud Packaging and Offline Packaging¶
Android cloud packaging and offline packaging use two different integration logics. Offline packaging integration is the same as the Guance Android SDK integration method, using the Android Studio Gradle Plugin method. Cloud packaging cannot use the Android Studio Gradle Plugin, so it can only implement some functions through the internal code of the Guance UniApp Native Plugin. Therefore, the offline packaging version has more configurable options than the cloud packaging version. The offlinePakcage parameter in the SDK configuration is used to distinguish these two situations.
Others¶
- Android Privacy Review
- iOS Other Related
- Android Other Related
- Native Symbol File Upload
- Terms of Service
- Privacy Policy
- Help Center
- Contact Us
Version History¶
| Version | Date | Description |
|---|---|---|
| 1.0.0 | 2023-01-01 | Initial release |
| 1.0.1 | 2023-01-15 | Bug fixes |
| 1.1.0 | 2023-02-01 | New features added |
Related Links¶
Support¶
If you encounter any issues or have questions, please: 1. Check our FAQ section 2. Search our Knowledge Base 3. Submit a support ticket 4. Join our community Discord
Contributing¶
We welcome contributions! Please see our: * Contributing Guidelines * Code of Conduct * Development Setup
License¶
This project is licensed under the MIT License.
Acknowledgments¶
- Thanks to all our contributors
- Built with Awesome Tool
- Inspired by Great Project
Additional Resources¶
Stay Updated¶
Enterprise Support¶
For enterprise customers: * Enterprise Features * SLAs * Custom Development * Dedicated Support
