1

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

Idan Adar
  • 44,156
  • 13
  • 50
  • 89
  • Do you get any errors in the server log? What is your build number of MFPF 7.1? – Idan Adar Nov 18 '15 at 06:41
  • Hi @IdanAdar thanks for reply i am not getting any logs for that but can you tell me how to check custom message from analytics console. – Divyanshu Joshi Nov 18 '15 at 07:13
  • Do you get any analytics at all in the analytics console? Are you sure that the analytics JNDI properties and credentials are set correctly? – patbarron Nov 18 '15 at 15:59
  • I am getting debug logs in console but i am unable to create analytics chart of message. How can i create a chart of custom events which i am passing to analytic server by using WLAnalytics.log("Custom event", new JSONObject(json)); – Divyanshu Joshi Nov 24 '15 at 06:45

1 Answers1

3

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'

Chevy Hungerford
  • 1,167
  • 6
  • 19