目录
此内容是否有帮助?

# 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 DEBUGor DEBUG_ONLYmode:

/**
 * 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 DEBUGor DEBUG_ONLYmode:

/**
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 Buried Point 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.

  1. **Switch device: **Click to switch the current access device or add a new device;
  2. **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.
  3. **Search events: **Search filtering only displays specified events or user features.
  4. **Event tracking comparison: **If you maintain the buried scheme information in the Buried Point Management → Buried Point Scheme Module before testing data, you can choose to open the 'Buried Point Comparison', then you can get the difference between the test data and the buried scheme during the testing phase and adjust the buried code in time.

    When the buried point comparison is turned on, the error information based on the buried point 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 buried scheme
  • Existence is not in the buried scheme, but actually has reported attributes
  • There is an attribute missing, that is, in the buried scheme, but there is no actual reported attribute
  • There is an inconsistency between the reported attribute type and the attribute type in the buried site scheme
  1. **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 Buried Points in Debug mode

Debug mode is ideal for verifying the correctness of buried points when new ones are added. Before testing the buried point, obtain the device ID #device_idof the device in the TA SDK Id, add the device in Debug mode. Buried points 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 Buried Point Comparison

After uploading the scheme on the 'Buried Point Scheme' page, you can choose to open the 'Buried Point Comparison', which can get the difference between the test data and the buried point scheme during the test phase and adjust the buried point code in time. Note that the check results for this feature do not include the check for preset attributes.