Logging JavaScript errors in Google AnalyticsBlog

Google Analytics allows you to easily capture and log errors that appear in the browser console.


ON Jun 30, 2020

If we use Google Analytics on a daily basis to collect statistics about users visiting our site, we can easily capture and log errors (and not only) that will appear in the browser console.

I think that everyone is well aware of the value of ‘front-line’ information directly from the user’s device. We can write unit tests, check all possible scenarios, but there may always be a configuration that we did not foresee.

When using Google Analytics, it is enough to send an exception event using the send command when catching an error (using the functionality provided by the framework or using the try / catch block). Details of the implementation can be found in the documentation on page dedicated to this functionality.

to our newsletter