menu
Is this helpful?

# Multi-instance

# 1. Create Multiple SDK Instances

If you want to send data to multiple projects, you can use the multi-instance feature.

Multi-instance can be created by initializing the SDK with multiple settings of project information.

//multi-instance initialization
TDConfig tdConfig_1 = new TDConfig(appId_1, serverUrl_2);
TDConfig tdConfig_2 = new TDConfig(appId_2, serverUrl_2);
TDConfig[] tokens = new TDConfig[2];
tokens[0] = tdConfig_1;
tokens[1] = tdConfig_2;
TDAnalytics.Init(tokens);
//multi-instance tracking
Dictionary<string, object> properties = new Dictionary<string, object>(){
    {"product_name", "product name"}
};
//track event with 1st instance
TDAnalytics.Track("product_buy", properties, appId_1);
//track event with 2ed instance
TDAnalytics.Track("product_buy", properties, appId_2);
//if Track without APP ID, it will be reported with 1st instance
TDAnalytics.Track("product_buy", properties);

Distinct ID, account ID, super properties, etc. are not shared across multi-instance and need to be set for each instance.

# 2. Create Light Instance

// initializing instance
TDAnalytics.Init("APPID", "SERVER");
// call CreateLightInstance to creat Lightweight Instance
string lightKey = TDAnalytics.LightInstance();
// Login/Track with lightKey
TDAnalytics.Login("TE2", lightKey);
TDAnalytics.Track("some_event", lightKey);

The Light Instance has the same APP ID, server URL, and some settings as the parent instance, but other information is not shared.