Skip to main content

Multiple instances

Last updated 10/03/2026

1. Feature overview​

You can create SDK instances with multiple APP IDs, which we call multiple instances for short. With multiple instances, you can report data to different projects.

2. Create multiple instances​

To create multiple SDK instances, initialize the SDK with different APP IDs:

// Initialize the SDK
TDAnalytics.init(this, TA_APP_ID, TA_SERVER_URL);
TDAnalyticsAPI.track("some_event",properties, TA_APP_ID);

TDAnalytics.init(this, ANOTHER_TA_APP_ID, TA_SERVER_URL);
TDAnalyticsAPI.track("some_event",properties, ANOTHER_TA_APP_ID);

TDAnalytics.init(this, TA_APP_ID, TA_SERVER_URL, NAME);
TDAnalyticsAPI.track("some_event",properties, NAME);

Note that each SDK instance must have a different APP ID, and most data is not shared between instances. For details, see Section 4, Data sharing between instances.

3. Create light instances​

You can use light instances to create multiple instances under the same APPID

//First, create an SDK instance
TDAnalytics.init(this, TA_APP_ID, TA_SERVER_URL);
//Call lightInstance on the instance created earlier to create a light instance
String uuid = TDAnalytics.lightInstance();
TDAnalyticsAPI.login("anotherAccount",uuid);
TDAnalyticsAPI.track("some_event",properties,uuid);

A child light instance has the same APPID, data receiving URL, and some settings as its parent instance, but other information is not shared. For details, see Section 4, Data sharing between instances.

4. Data sharing between instances​

Most APIs are called on instance objects, so most data and settings are not shared among instances with different APPIDs, or between a parent instance and its light instances. However, some data and settings take effect for all instances. The following describes whether each type of data and setting is shared among instances:

  1. Account information
  • Distinct ID #distinct_id generated by the system by default: shared
  • Distinct ID #distinct_id set by calling identify: not shared
  • Account ID #account_id set by calling login: not shared
  1. Event tracking track and user property operations user_set, user_setOnce, user_add, and user_delete: not shared
  2. Super properties setSuperProperties and dynamic super properties setDynamicSuperPropertiesTracker: not shared
  3. Whether SDK configuration is shared among instances:
  • Reporting strategy (the reporting interval and the amount of data in each batch): shared, determined by the project data of the APPID that is instantiated first
  • Network conditions for uploading setNetworkType: shared
  • Logging of uploaded data EnableTrackLogging: shared
  1. Auto-tracked events
  • We recommend enabling auto-tracked events on only one instance

  • Auto-tracked events can be reported to multiple APP IDs

  • Whether auto-tracking settings are shared among instances:

    • Set the view ID setViewID: not shared
    • Custom view properties setViewProperties, etc.: not shared
    • Ignore auto-tracked events on a page ignoreAutoTrackActivity, etc.: not shared
    • Ignore click events of a view type ignoreViewType: not shared
    • Ignore a view ignoreView: not shared
    • All annotations: you can set the appId parameter to specify the instance that an annotation applies to. If you don't set it, the configuration is shared by all instances. For example:
@ThinkingDataIgnoreTrackAppViewScreen(appId = "debug-appid")
  1. Record event duration timeEvent: not shared
Was this page helpful?