ibm-mobilefirstmobilefirst-analytics

MobileFirst 7.1 analytics unable to capture custom messages


Hi I am new to the Mobile First analytic . I Created one Mobile First native android project and now i want to integrate analytics with that. I am mentioning code snippet using for analytics.

WLAnalytics.setContext(this); // Inside onCreate Meathod of my activity WLAnalytics.enable();

String json = "any";
try {

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


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

and i followed below mentioned article for that

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


Solution

  • Try this:

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

    You are not creating a JSON message. My key is 'android' and my value is 'message'