报告来自 Google Analytics analytics.js 异常跟踪的异常 [英] Report for exceptions from Google Analytics analytics.js exception tracking

查看:24
本文介绍了报告来自 Google Analytics analytics.js 异常跟踪的异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Google Universal Analytics 有一个命中类型的异常

Google Universal Analytics has a hit type of exception

ga('send', 'exception', {
  'exDescription': 'DatabaseError'
});

我原以为只需转到 Google Analytics(分析)控制台,就能找到与事件"级别相同的异常报告,但无处可见.

I was expecting to be able to just go to the Google Analytics console and find an exeption report at the same level as 'events' however it's nowhere to be seen.

Android 和 iOS API 说崩溃和异常数据主要在崩溃和异常报告中提供,但我找不到任何该名称的报告.

The Android and iOS APIs say Crash and exception data is available primarily in the Crash and Exceptions report but I can't find any report by that name.

推荐答案

想通了.我不知道他们为什么不把它做成内置报告,但也许有一天.

Figured it out. I'm not sure why they don't make this a built in report but maybe someday.

我在仪表板中制作了一个自定义小部件,Exception Description 用于维度,崩溃"用于指标:

I made a custom widget in a dashboard with Exception Description for dimension and 'Crashes' for the metric:

这给了我这样的报告:

您还可以转到 Customization 选项卡并创建自定义报告,为您提供错误表,然后将其添加到您的仪表板.

You can also go to Customization tab and create a custom report to give you a table of errors, and then add it to your dashboard.

与此全局异常处理程序一起使用

Used with this global exception handler

if (typeof window.onerror == "object")
{
    window.onerror = function (err, url, line)
    {
        if (ga) 
        {
           ga('send', 'exception', {
               'exDescription': line + " " + err
           });
        }
    };
}

您可以将此处理程序放在 Javascript 初始化的任何位置 - 这取决于您如何配置所有 JS 文件.或者,您可以将它放在靠近 html body 标签顶部的 <script> 标签内.

You can put this handler anywhere in the initialization of your Javascript - which will depend upon how you have all your JS files configured. Alternatively you can just put it inside a <script> tag near the top of your html body tag.

这篇关于报告来自 Google Analytics analytics.js 异常跟踪的异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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