1

嗨,我是 Mobile First 分析的新手。我创建了一个 Mobile First 本机 android 项目,现在我想将分析与它集成。我提到了用于分析的代码片段。

WLAnalytics.setContext(this); // 在我的活动 WLAnalytics.enable() 的 onCreate 方法中;

String json = "any";
try {

    WLAnalytics.log("Custom event", new JSONObject(json));


} catch (JSONException e) {
    e.printStackTrace();
}
WLAnalytics.send();

我遵循下面提到的文章

https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-6-3/moving-production/operational-analytics/

https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-7-0/moving-production/operational-analytics/#clientLogs

4

1 回答 1

3

尝试这个:

WLAnalytics.setContext(this);

WLAnalytics analytic = new WLAnalytics();
try {
    analytic.log("this", new JSONObject("{\"android\" : \"message\"}"));
} catch(Exception e){

}
analytic.send();

您没有创建 JSON 消息。我的键是'android',我的值是'message'

于 2015-11-24T17:55:27.440 回答