Integration

Smartlook can be easily integrated into Bugsnag:

val errorCallback = OnErrorCallback { event ->
    event.addMetadata("Smartlook", "Smartlook session dashboard URL", Smartlook.instance.user.session.urlWithTimestamp)
    true //report this error
}

Bugsnag.addOnError(errorCallback)
OnErrorCallback errorCallback = event -> {
    event.addMetadata("Smartlook", "Smartlook session dashboard URL", Smartlook.getInstance().getUser().getSession().getUrlWithTimestamp());
    return true;
};

Bugsnag.addOnError(errorCallback);
let config = BugsnagConfiguration.loadConfig()
config.addOnSendError { (event) -> Bool in
    let sessionUrl = Smartlook.instance.user.session.urlWithTimestamp
    event.addMetadata(sessionUrl, key:"Smartlook dashboard session URL")
    return true
}
Bugsnag.start(with: config)
Bugsnag.start({onError: function (event) {
        Smartlook.instance.eventListeners.registerSessionChangedListener(
        	function (sessionUrl) {
            event.addMetadata('Smartlook', {"Dashboard session URL": sessionUrl});
        });
    }
});
class CustomIntegrationListener implements IntegrationListener {
	@override
  void onSessionReady(String? dashboardSessionUrl) {
     //todo add tracking of sessions
  }

  @override
  void onVisitorReady(String? dashboardVisitorUrl) {
    bugsnag.setUser(id: dashboardVisitorUrl, email: '[email protected]', name: 'Bugs Nag');
  }
}

//Put to your init state or some place you want to register this
Smartlook.registerIntegrationListener(CustomIntegrationListener());

Full Bugsnag documentation with examples can be found on the official website.