Integrating Sitecore with Raygun

Raygun Crash Reporting is an automated error tracking solution that provides insight into your application through various APIs. These APIs easily integrate with .NET and more specifically Sitecore. There are a number of guides on the Raygun website and the solution below outlines the extension point required to enable Raygun and Sitecore xConnect to work together.

Once the Raygun client is correctly configured it can be extended to pass along Sitecore xConnect facets to help identify the users that are experiencing errors.

In older solutions (pre Sitecore 7.5) the Global.asax.cs file was used primarily to enhance the Sitecore application by overriding methods including: Application_Start, Application_Error or Session_End. This is no longer the recommended approach however, in order to integrate Raygun it is still the only option as Raygun specifically requires an HttpApplication object.

Create a Global.asax file with the code shown below taking special note of the IRaygunApplication interface. Raygun will look for an HttpApplication with this interface when attempting to create a RaygunClient and if found runs the GenerateRaygunClient method:

The solution above attempts to get the user information facets out of the current tracker and if found enhances the Raygun identifier as outlined by the Raygun documentation. It is specifically for Sitecore 9.3 however, this could be substituted for any previous version of xConnect or even Sitecore identity claims.