Integrating Raygun Crash Reporting with Sitecore xConnect

Integrate Raygun Crash Reporting with Sitecore xConnect to enhance error reports with user-specific data. This guide explains how to configure Raygun to include Sitecore tracker and xConnect facet information, providing greater visibility into which users are impacted by application errors.

Integrating Raygun Crash Reporting with Sitecore xConnect

Raygun Crash Reporting provides automated error tracking and valuable insights into application health through a set of easy-to-integrate APIs. While Raygun offers extensive documentation for .NET, integrating it with Sitecore—specifically Sitecore xConnect—requires additional configuration.

Once the Raygun client is properly set up, it can be extended to include Sitecore xConnect facets, allowing error reports to include user context and identifying which users are affected by specific errors.


Integration Approach

In older Sitecore solutions (prior to version 7.5), the Global.asax.cs file was commonly used to extend the Sitecore application lifecycle by overriding methods such as Application_Start, Application_Error, and Session_End. While this is no longer the recommended approach, it remains necessary for Raygun integration, as Raygun requires access to an HttpApplication object.

To enable this, create a Global.asax file and implement the IRaygunApplication interface. Raygun looks for this interface to instantiate a RaygunClient and execute the GenerateRaygunClient method.

This implementation retrieves user information from the current Sitecore tracker session. If the necessary xConnect facets are found, it enhances the Raygun error reports with user-specific data such as contact ID, name, and email address, as outlined in the Raygun documentation.

While this solution targets Sitecore 9.3, it can be adapted for earlier versions of xConnect or even Sitecore Identity claims.