Setting up Ionic 2 monitoring is easy

This short and simple guide will get you familiar in integrating Atatus with Ionic 2 apps
and start tracking error and performance.

Ionic 2

Install Setup Code

Copy & paste this code into the <head> tag of your html to start using Atatus on your Ionic 2 app. Please make sure that you add it before other script tags as well.

<script src="//dmc1acwvwny3.cloudfront.net/atatus.js"> </script>
<script type="text/javascript"> atatus.config('YOUR_API_KEY').install(); </script>
Replace the YOUR_API_KEY string with the API Key that is assigned for your project.

Create a custom error handler

// /src/app/atatus.handler.ts
import { IonicErrorHandler } from 'ionic-angular';
declare var atatus: any;

class AtatusErrorHandler extends IonicErrorHandler {
  handleError(error:any) : void {
    super.handleError(error);

    if (atatus) {
      // Send the error to Atatus
      atatus.notify(error.originalError || error);
    }
  }
}

export default AtatusErrorHandler;

Replace "IonicErrorHandler" with "AtatusErrorHandler" in the providers section of @NgModule

// /src/app/app.module.ts
import { ErrorHandler } from '@angular/core';
import AtatusErrorHandler from './atatus.handler';

@NgModule({
    // ...
    providers: [{provide: ErrorHandler, useClass: AtatusErrorHandler}]
})

export class AppModule { }

Send an event

Just reload your page now. That's it! You've sent your first event.