Exception tracking

Exception tracking allows you to measure the number and type of crashes or errors that occur in your application

is possible to track single exceptions using a try catch

  1. try {
  2. // some code that might crash
  3. } catch (error) {
  4. // handle your error here
  5. // track the error with analytics
  6. // depending on the error you might want to check
  7. // if a `message` property exists or not
  8. const exception = error.message || error
  9. this.$ga.exception(exception)
  10. }

Enable exception auto tracking

It is also possible to just enable the plugin exception auto tracking and the plugin will do everything for you

  1. Vue.use(VueAnalytics, {
  2. id: 'UA-XXX-X',
  3. autoTracking: {
  4. exception: true
  5. }
  6. })

important: the auto tracking script uses Vue.config.errorHandler, if you need to add your handler, do it before installing the plugin or will be overwritten

Error logs

When auto-tracking errors logs are automatically logged in the console, if you want to disable them, you can add this property to your configuration

  1. Vue.use(VueAnalytics, {
  2. id: 'UA-XXX-X',
  3. autoTracking: {
  4. exception: true,
  5. exceptionLogs: false
  6. }
  7. })

Google Analytics docs: exceptions