Exception Tracking

This guide describes how to send exceptions using analytics.js. Exception tracking allows you to measure the number and type of crashes or errors that occur on your property.


Exception hits can be sent using the send command and specifying a hitType of exception. The send command has the following signature for the exception hit type:

ga('send', 'exception', [fieldsObject]);

Exception fields

The following table summarizes the exception fields:

Value Type Required Description
exDescription string no A description of the exception.
exFatal boolean no true if the exception was fatal.


The following command wraps some logic that may fail in a try/catch block. If there's an error, it sends an exception hit to Google Analytics:

try {
  // Runs code that may or may not work.
} catch(err) {
  ga('send', 'exception', {
    'exDescription': err.message,
    'exFatal': false