是否有方法记录用户 ID,然后按特定用户对异常/崩溃进行排序?当然,我可以将用户 ID 放入 ExceptionParser.getDescription
中,但它只会将困惑的数据串入表中。
最佳答案
您可以发送带有任何分析数据的自定义维度。您需要先在分析网络界面上设置自定义维度。通读this .
然后当您处理您的异常时,您可以发送您的自定义维度(用户 ID)。
例如:
EasyTracker easyTracker = EasyTracker.getInstance(this);
//get google analytics to parse the exception
String parsedException = new StandardExceptionParser(this, null).getDescription(Thread.currentThread().getName(), e);
//get google analytics to build the map data to send, as well as our userId
Map<String, String> exceptionMap = MapBuilder.createException(parsedException, false).set("userId", userId).build();
//send our data!
easyTracker.send(exceptionMap);
在分析网络界面的“崩溃和异常” View 中,您可以添加一个次级维度作为排序依据,在本例中为您定义的自定义维度(用户 ID)。
编辑:附带说明一下,如果您还没有听说过 Crashlytics,它也非常适合用于崩溃报告(而且是免费的!)。它对发送崩溃的自定义数据有类似的支持。
关于android - 将用户 ID 发送到 Google Analytics,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20102388/