Custom Tags and Global Context¶
This document covers HarmonyOS custom tags and global context related capabilities.
Adding Global Context¶
import { FTSDK } from '@guancecloud/ft_sdk/Index';
const globalContext = new Map<string, string>();
globalContext.set('platform', 'harmonyos');
globalContext.set('version', '1.0.0');
FTSDK.appendGlobalContext(globalContext);
const rumGlobalContext = new Map<string, string>();
rumGlobalContext.set('user_type', 'vip');
rumGlobalContext.set('channel', 'official');
FTSDK.appendRUMGlobalContext(rumGlobalContext);
Naming Conflict Explanation¶
To avoid conflicts between custom fields and SDK data, it is recommended to add a business prefix to tag names, for example, df_tag_name.
When there are fields with the same name in the SDK global variables and RUM/Log, the fields in RUM/Log will override those in the SDK global variables.