Custom Tags and BridgeContext¶
Setting Global Tags During Initialization¶
You can pass custom tags via globalContext in sdkConfig or rum.setConfig to distinguish environments, versions, channels, or business scenarios.
var ftModule = uni.requireNativePlugin("GCUniPlugin-MobileAgent");
ftModule.sdkConfig({
datakitUrl: 'your datakitUrl',
globalContext: {
custom_key: 'custom value'
}
});
Adding Custom Tags at Runtime¶
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, which apply to RUM and Log data.
| Field | Type | Required | Description |
|---|---|---|---|
| None | object | Yes | Custom global parameters |
API - appendRUMGlobalContext¶
Adds custom RUM global parameters, which apply only to RUM data.
| Field | Type | Required | Description |
|---|---|---|---|
| None | object | Yes | Custom global RUM parameters |
API - appendLogGlobalContext¶
Adds custom Log global parameters, which apply only to Log data.
| Field | Type | Required | Description |
|---|---|---|---|
| None | object | Yes | Custom global Log parameters |
Adding BridgeContext¶
Supported in SDK version 0.2.4 and above
var ftModule = uni.requireNativePlugin("GCUniPlugin-MobileAgent");
ftModule.appendBridgeContext({
ft_bridge_context: 'ft_bridge_context_value'
});
API - appendBridgeContext¶
Injects context only into RUM and Log data collected by the UniApp side. Data collected by the Native side will not have this context injected.
Purpose: To distinguish data sources or mark specific business scenarios, such as differentiating between data from the host App and the uni mini-program.
| Field | Type | Required | Description |
|---|---|---|---|
| None | object | Yes | UniApp environment parameters |