EmberJS

Installation

It’s as easy as:

$ ember install ember-cli-raygun

Optionally you can pass Raygun API Key:

$ ember install ember-cli-raygun --api_key='YOUR-RAYGUN-API-KEY'

Now set your Raygun API Key (available under “Application Settings” in your Raygun Account) in config/environment.js

// config/environment.js
var ENV = {
  // ...
  raygun: {
    apiKey:  "YOUR-RAYGUN-API-KEY",
    enabled: (environment === "production")
  }
  // ...

The default blueprint (which runs during ember install ember-cli-raygun) will add the above config in your app’s config/environment.js file.

You can now track and fix your errors once you deploy your app. (By default Ember CLI Raygun is disabled unless your environment is set to “production” - you can configure that behaviour in config/environment.js)


User tracking

Add the following in your application route:

// app/routes/application.js
// ...
  beforeModel: () {
    this.setRaygunUser();
  },

  setRaygunUser: () {
    // assuming you have a currentUser property available...
    Raygun.setUser(
      this.get("user.id"),
      false,
      this.get("user.email"),
      this.get("user.fullName"),
      this.get("user.firstName"),
    );    
  },
// ...

On this page: