Skip to main content

Multiple instances

Last updated 10/03/2026

This SDK supports multiple instances. The instance that is initialized using the method described above is called the main instance, and instances created using the method described in this section are called sub-instances.

Multiple instances share device-related preset properties (including the device ID). No other properties are shared, including:

  • #distinct_id distinct ID
  • #account_id account ID
  • Super properties and dynamic super properties
  • Events timed by timeEvent

By creating a sub-instance, you can report data to another project, or report data with a different set of user IDs.

//Initialize configuration 1
var config_1 = {
appId: "app-id-1",
serverUrl: "https://youserverurl.1.com"
};
TDAnalytics.init(config_1);

//Initialize configuration 2
var config_2 = {
appId: "app-id-2",
serverUrl: "https://youserverurl.2.com"
};
TDAnalytics.init(config_2);

//Report an event to configuration 1 (if app-id is not passed, data is reported to configuration 1 by default)
TDAnalytics.track('event_from_appid_1');
//Report an event to configuration 1 (app-id-1 specified)
TDAnalytics.track('event_from_appid_1',{},'app-id-1');
//Report an event to configuration 2 (app-id-2 specified)
TDAnalytics.track('event_from_appid_2',{},'app-id-2');
Was this page helpful?