Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Report for exceptions from Google Analytics analytics.js exception tracking

Google Universal Analytics has a hit type of exception

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

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.

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.

like image 354
Simon_Weaver Avatar asked Feb 12 '14 04:02

Simon_Weaver


1 Answers

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

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

enter image description here

Which gives me a report like this:

enter image description here

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.

enter image description here

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            });         }     }; } 

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.

like image 163
Simon_Weaver Avatar answered Oct 01 '22 14:10

Simon_Weaver