menu
Is this helpful?

# デバッキング

SDKを実装する中で、IDEコントローラーでのログを確認すること、またはTEのDebug機能を利用してデバッキングすることが可能です。

# SDKログをプリント

環境変数NODE_DEBUG=tdaを設定すればログのプリント可能です。

ThinkingData.enableLog(true);

# Debug機能

TEのDebug機能を利用して、デバッキングを行えます。Debug機能は以下の2ステップで利用できます。

  1. DebugModeを利用

以下はDebugModeのコード例:

// DebugConsumer: Data is reported one by one. When a problem occurs, the user will be prompted with logs and exceptions;
// it is not recommended to use it in an online environment
// The third parameter identifies whether to enter the warehouse, true indicates the warehouse, and false indicates not to enter the warehouse
let teSDK = ThinkingData.initWithDebugMode('appId', 'serverUrl', {
    dryRun: false, // report data to TE or not
    deviceId: "123456789"
});

let trackEvent = {
    accountId: '2222',
    distinctId: '1111',
    event: 'test_event',
    time: new Date(),
    ip: '202.38.64.1',
    properties: {
        prop_double: 134.1,
    },
    callback(e) {
        if (e) {
            console.log(e);
        }
    }
};

teSDK.track(trackEvent)
  1. TE后台添加Debug设备
  2. TEシステム内でDebugデバイスを追加

Debugモードを本番環境でリリースしてしまうことを避けるため、特定のデバイスのみDebugモードが起動できます。

クライアントでDebugモードを起動し、デバイスIDをTEシステムの「データ管理」→「デバッグモード」で追加した上でDebugモードに起動できます。

Debugモードはデータ収集の質とAppの安定性に影響しますため、データ検証のみお使いください。