Android Google Analytics(分析)异常记录 [英] Android Google Analytics Exception logging

查看:134
本文介绍了Android Google Analytics(分析)异常记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为Android使用



另外,如果上次报告的生成已过时,您还可以点击右下角的刷新报告按钮





如果上述任何一项都没有,则等待24小时GA生成报告:)


I'm using Google Analytics SDK v4 for Android to record the exceptions. I followed the sample app but I could see no exceptions getting registered in the dashboard.

I wrote the code as below

/*exception tracking */
// Get tracker.
Tracker t2 =
  ((MyApp) this.getApplication()).getTracker(TrackerName.APP_TRACKER);

// Build and send exception.
int a = 0;
String exceptionStr = "";

try{
  int b = a/0;
}catch(Exception ex){
  exceptionStr = ex.toString();
}finally{
  t2.send(new HitBuilders.ExceptionBuilder()
          .setDescription(exceptionStr + ":" + "In Main screen")
          .setFatal(true)
          .build());

  GoogleAnalytics.getInstance(this.getApplicationContext()).dispatchLocalHits();

  Log.v("Manual logging", "finished for analytics");
}

"Manual logging", "finished for analytics" is showing up in the logcat window but when I check the analytics there is nothing registered.

BTW the user screen flow etc working just fine with the SDK. Just the exception logging is not working.

解决方案

This works for me but I'm using advanced crash report implementation.

Go to Behavior --> Crashes & Exceptions

In the top right drop-down (below date range selector), select "Faster Response, less Precision" option instead of the default "Slower Response, Greater Precision":

Also, additionally, you can click on the "Refresh Report" button in the lower right corner if the last reported generated is stale:

If none of the above work, then wait for 24 hours for GA to generate the reports :)

这篇关于Android Google Analytics(分析)异常记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆