Real-time debugging
The SDK Debug mode is only for debugging during integration. Never use it in the production environment.
Prints logs
TDLog::$enable = true;
Real-time debugging
During SDK integration, you can use the AE Debug feature for real-time debugging. To use the Debug feature, complete the following two steps:
- Use TDDebugConsumer
The following sample code uses TDDebugConsumer:
try {
// Must match the test device ID set in AE
$deviceId = "123";
$debugConsumer = new TDDebugConsumer("SERVER_URL", "APP_ID", 1000, $deviceId);
// Whether test data is written to the AE database. true: written; false: not written. The default is true
$debugConsumer->setDebugOnly(false);
$te = new TDAnalytics($debugConsumer);
} catch (Exception $e) {
echo $e;
}
- Add a Debug device in the AE backend
To prevent Debug mode from going live in the production environment, Debug mode can only be enabled on specified devices. Debug mode can be enabled only on devices that have Debug mode enabled on the client and whose device IDs have been added on the Data → Tracking → Debugger page in the AE backend. 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.
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.

