Skip to content

Custom Tags and Global Context

This document covers the capabilities related to HarmonyOS custom tags and global context.

Add Global Context

import { FTSDK } from '@guancecloud/ft_sdk/src/main/ets/components/FTSDK';

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 a field with the same name exists in the SDK global variables and in RUM or Log, the field in RUM or Log will overwrite the one in the SDK global variables.