LiveSession and Bugsnag integration
What is Bugsnag?
Bugsnag is a professional tool to monitor the stability of your app and report errors. Connecting LiveSession with Bugsnag comes with a range of unique benefits, such as:
- Direct access to session recordings from Bugsnag dashboard
- Access to all information in one place
- Ability to see where the error has occurred
How does it work?
With this integration, every new event in Bugsnag gets an extra tab called sessionURL. The tab contains a url label with a link to the session recording.
Every time a new session will start, our code will send an event to Segment with a link to session replay.
Important: Remember that LiveSession only starts recording if it detects activity of user (find out more informations about recording conditions). Because of this, Bugsnag will wait 3 seconds after initializing. If the user doesn’t do anything for more than 3 seconds, the sessionURL tag will be empty.
How can I install this integration?
To install integration, add the code below before your</body>
closing tag:<script type="text/javascript">
var createdSessionURL = "";
Bugsnag.start({
apiKey: "YOUR_API_KEY",
onError: function (event) {
__ls("getSessionURL", function (url, isNewSession) {
createdSessionURL = url;
});
var wait = function wait(ms) {
return new Promise(function (r, j) {
return setTimeout(r, ms);
});
};
return wait(3000).then(function () {
event._metadata.sessionURL.url = createdSessionURL;
return event;
});
},
});
Bugsnag.addMetadata("sessionURL", {
url: createdSessionURL,
});
</script>
To make this integration works you need to LiveSession installed on your website. If you haven't installed our tracking code yet check this article.