Skip to content

Customize to Add Additional Data TAG


After initializing the RUM, use the addRumGlobalContext(key:string, value:any) API to add additional TAGs to all RUM events collected from the application.

Add TAG

Download files imported locally (download address)

const { datafluxRum } = require('./lib/dataflux-rum-miniapp.js')
datafluxRum.addRumGlobalContext('<CONTEXT_KEY>', '<CONTEXT_VALUE>');

// Code example
datafluxRum.addRumGlobalContext('isvip', 'xxxx');

datafluxRum.addRumGlobalContext('activity', {
    hasPaid: true,
    amount: 23.42
});

Introduction: (see WeChat official npm introduction method)

const { datafluxRum } = require('@cloudcare/rum-miniapp')
datafluxRum.addRumGlobalContext('<CONTEXT_KEY>', '<CONTEXT_VALUE>');

// Code example
datafluxRum.addRumGlobalContext('isvip', 'xxxx');

datafluxRum.addRumGlobalContext('activity', {
    hasPaid: true,
    amount: 23.42
});

Replace TAG (Override)

Download files imported locally (download address)

const { datafluxRum } = require('./lib/dataflux-rum-miniapp.js')

datafluxRum.setRumGlobalContext({ '<CONTEXT_KEY>': '<CONTEXT_VALUE>' });

// Code example
datafluxRum.setRumGlobalContext({
    codeVersion: 34,
});

Introduction: (see WeChat official npm introduction method)

const { datafluxRum } = require('@cloudcare/rum-miniapp')

datafluxRum.setRumGlobalContext({ '<CONTEXT_KEY>': '<CONTEXT_VALUE>' });

// Code example
datafluxRum.setRumGlobalContext({
    codeVersion: 34,
});

Get All Set Custom TAGs

Introduction: (see WeChat official npm introduction method)

const { datafluxRum } = require('./lib/dataflux-rum-miniapp.js')

const context = datafluxRum.getRumGlobalContext();

Introduction: (see WeChat official npm introduction method)

const { datafluxRum } = require('@cloudcare/rum-miniapp')

const context = datafluxRum.getRumGlobalContext();

Remove the Custom TAG Corresponding to Specific Key

Download files imported locally (download address)

const { datafluxRum } = require('./lib/dataflux-rum-miniapp.js');

const context = datafluxRum.removeRumGlobalContext('<CONTEXT_KEY>');

Introduction: (see WeChat official npm introduction method)

const { datafluxRum } = require('@cloudcare/rum-miniapp')

const context = datafluxRum.removeRumGlobalContext('<CONTEXT_KEY>');

Feedback

Is this page helpful? ×