# Debug Mode
Debug mode is designed to facilitate developers to debug code and is only used for data verification during the integration phase. Please note that Debug mode may affect the quality of data collection and the stability of the App, so please do not use it in an online environment.
# I. Turn On Debug Mode
# 1.1 Android SDK
Android SDK instance supports three operating modes, defined in TDConfig, please choose DEBUG
or DEBUG_ONLY
mode:
/**
* Instance run mode, default to NORMAL mode.
*/
public enum ModeEnum {
/* In normal mode, data is cached and reported according to certain caching strategies */
NORMAL,
/* Debug mode, data is reported item by item. Prompt users with logs and exceptions when problems occur */
DEBUG,
/* Debug Only mode, data only checked, not stored. */
DEBUG_ONLY
}
For example, the following code uses Debug mode to complete SDK initialization:
// Get TDConfig instance
TDConfig config = TDConfig.getInstance(mContext, TA_APP_ID, TA_SERVER_URL);
// Set Run Mode to Debug Mode
config.setMode(TDConfig.ModeEnum.DEBUG);
// Initialize SDK
instance = ThinkingAnalyticsSDK.sharedInstance(config);
# 1.2 iOS SDK
iOS SDK instance supports three operation modes, defined in TDConfig
, please choose DEBUG
or DEBUG_ONLY
mode:
/**
Debug Mode
- ThinkingAnalyticsDebugOff : Default Does not open Debug mode
*/
typedef NS_OPTIONS(NSInteger, ThinkingAnalyticsDebugMode) {
/**
Default Does not open Debug mode
*/
ThinkingAnalyticsDebugOff = 0,
/**
Turn on Debug_ Only mode, data only checked will not be stored
*/
ThinkingAnalyticsDebugOnly = 1 << 0,
/**
Debug mode, data is reported one by one. Prompt users with logs and exceptions when problems occur
*/
ThinkingAnalyticsDebug = 1 << 1
};
For example, the following code uses Debug mode to complete SDK initialization:
// Get TDConfig instance
TDConfig *config = [[TDConfig alloc] init];
// Set Run Mode to Debug Mode
config.debugMode = ThinkingAnalyticsDebug;
// Initialize SDK
ThinkingAnalyticsSDK *instance = [ThinkingAnalyticsSDK startWithAppId:@"YOUR_APPID" withUrl:@"YOUR_SERVER_URL" withConfig:config];
# 1.3 Other Client SDK
For instructions on opening other client SDK Debug modes, please refer to the guidelines for each SDK:
# II. Add Debug Devices
In order to prevent Debug mode from going live in the production environment, you need to specify the device to turn on Debug mode. Debug mode can only be enabled for devices with Debug mode enabled on the client and configuration accessed in Data Reporting Management → Debug mode.
The device ID can be obtained in two ways:
- Client side log: After the SDK initialization is completed, the device
DeviceId will be printed
- Get the device ID by calling
getDeviceId
# III. Instructions for Use
After connecting the device, the data reported by the equipment will be displayed in the data list in real time, and the specific cause of the error will be given for checking the data with error.
- **Switch device: **Click to switch the current access device or add a new device;
- **Pause Loading: **If you want to locate a current event for further processing during the test, you can click 'Pause Loading'. The data generated in the pause state (such as the set automatic collection event) will be prompted at the top of the data table. Click 'Start Loading' to switch to the real-time loading state.
- **Search events: **Search filtering only displays specified events or user features.
- **Event tracking comparison: **If you maintain the data reporting scheme information in the data reporting Management → data reporting Scheme Module before testing data, you can choose to open the 'data reporting Comparison', then you can get the difference between the test data and the data reporting scheme during the testing phase and adjust the code in time.
When the data reporting comparison is turned on, the error information based on the data reporting scheme comparison will be added to the error cause (the comparison does not include the preset attributes). Potential errors include:
- Events are not in the data reporting scheme
- Existence is not in the data reporting scheme, but actually has reported attributes
- There is an attribute missing, that is, in the data reporting scheme, but there is no actual reported attribute
- There is an inconsistency between the reported attribute type and the attribute type in the data reporting scheme
- **Empty List: **Click to empty the current data list, and the emptied data will no longer be displayed. The empty operation only empties the log, and does not delete the stored events.
# IV. Best Applications
# 4.1 Debug data reporting in Debug mode
Debug mode is ideal for verifying the correctness of data reporting when new ones are added. Before testing the data reporting, obtain the device ID #device_id
of the device in the TA SDK Id, add the device in Debug mode. data reporting are then triggered in the IDE or on your own devices, while focusing on the data displayed in Debug mode, focusing on whether the data is uploaded and whether it is correct.
# 4.2 Open data reporting Comparison
After uploading the scheme on the 'data reporting Scheme' page, you can choose to open the 'data reporting Comparison', which can get the difference between the test data and the data reporting scheme during the test phase and adjust the data reporting code in time. Note that the check results for this feature do not include the check for preset attributes.