Custom Tags¶
This document describes the capabilities related to global context, custom tags, and user extension fields for the C++ SDK.
SDK Global Tags¶
You can append common fields to all data via addGlobalContext in FTSDKConfig:
Independent Tags for RUM and Log¶
In addition to SDK global tags, you can also append tags separately in RUM and Log configurations:
FTRUMConfig rumConfig;
rumConfig.addGlobalContext("track_id", "test_track_id");
FTLogConfig logConfig;
logConfig.addGlobalContext("log_source", "cpp_demo");
Among them:
track_idcan be used for correlation with tracing capabilities.- Fields with the same name in RUM and Log will override the fields with the same name in the SDK global variables.
User Extension Fields¶
When binding a user, you can add extra attributes via UserData:
UserData uc;
uc.init("username", "1001", "[email protected]");
uc.addCustomizeItem("ft_key", "ft_value");
sdk->bindUserData(uc);
Naming Rules¶
To avoid field conflicts, it is recommended to uniformly add a business prefix to custom tags, such as df_tag_name, demo_user_type. For detailed explanation, please read Conflict Field Description.