Skip to content

Data Collection Masking

For full-field masking, use dataModifier for better performance; for fine-grained replacement on specific data types, use lineDataModifier.

Do not perform complex or high-latency operations in the data modification logic, as this will affect the SDK data writing performance.

Single Field Modification (dataModifier)

  • Purpose: Modifies a single field value in the data.
  • Parameter Format: { key: newValue }.
  • Example: { device_uuid: 'xxx' } replaces the device_uuid field of the target data with xxx.

Single Line Data Modification (lineDataModifier)

  • Purpose: Modifies specified field values in a specific type of data.
  • Parameter Format: { measurement: { key: newValue } }.
  • Example: { view: { view_url: 'xxx' } } replaces the view_url field of all View data with xxx.

Supported data types for measurement:

  • RUM: view, resource, action, long_task, error;
  • Log: log.

Normal uni-app Configuration

import { mobileAgent } from '@/uni_modules/GC-UniPlugin';

mobileAgent.sdkConfig({
    datakitUrl: 'YOUR_DATAKIT_URL',
    dataModifier: {
        device_uuid: 'xxx'
    },
    lineDataModifier: {
        resource: {
            response_header: 'xxx'
        },
        view: {
            view_url: 'xxx'
        }
    }
});

The uni mini-program does not call sdkConfig(). To apply masking to all data from the host app's SDK, configure masking during host initialization. If you only need to modify JS-collected data from the uni mini-program, you can process business tags in the collection parameters or BridgeContext first.

Feedback

Is this page helpful?