Real-time debugging
During SDK integration, you can debug in real time by viewing the SDK logs in the IDE console or by using the Debug feature of AE.
1. Print SDK logs
TDAnalytics.EnableLogType(TDLogType.LogTxt);
After you enable logging, filter the ThinkingAnalytics logs in the IDE to observe the SDK's data reporting.
2. Enable Debug mode
Enabling Debug mode takes the following two steps:
- Enable Debug mode on the client
The following sample code enables Debug mode on the client:
// Get the TDConfig instance
TDConfig config = new TDConfig();
config.appid = TA_APP_ID;
config.server_url = TA_SERVER_URL;
/*
Set the run mode to Debug mode
NORMAL mode: Data is cached and reported according to a caching strategy. NORMAL is the default mode. Recommended for the production environment
Debug mode: Data is reported one record at a time. Problems are reported to the user through logs and exceptions. Not recommended for the production environment
DebugOnly mode: Data is only validated and not stored. Not recommended for the production environment
*/
config.mode = TDMode.Debug;
// Initialize the SDK
TDAnalytics.Init(config);
- Add the Debug device in AE
To prevent Debug mode from going live in the production environment, only specified devices can enable Debug mode. A device can enable Debug mode only if Debug mode is enabled on the client and the device ID has been added on the Data > Tracking > Debugger page in AE. To add a device, click Add test device in the upper-right corner of the page, click New device in the Select device drawer, and enter the device ID.
You can get the device ID in the following three ways:
- The #device_id property in the event data in AE
- Client logs: The SDK prints the DeviceId after initialization completes
- Call the instance API: Get the device ID
Debug mode may affect data collection quality and App stability. Use it only to verify data during integration, and don't use it in the production environment.

