Manually report errors in Crash Analytics
Crash Analytics supports automatic crash reporting where available and also lets your application report additional errors manually. You can use both approaches together.
When enabled, Crash Analytics automatically records unhandled JavaScript exceptions and unhandled Promise rejections on websites that use the Matomo JavaScript tracker.
No additional Crash Analytics tracking code is required. Once Crash Analytics is enabled, supported JavaScript errors are automatically reported.
Manual crash reporting
Some applications detect or handle errors before they become unhandled exceptions. Because these errors are handled by the application, Crash Analytics does not record them automatically. You can report these errors manually to:
- report caught exceptions.
- report business logic failures that do not generate JavaScript errors.
- report server-side exceptions.
- report exceptions from mobile applications.
You can manually report these errors using one of the following methods.
| Method | Best suited for |
|---|---|
| JavaScript tracker | Web applications where you can modify the source code. |
| Matomo Tag Manager | Websites that already expose error information through the data layer. |
| Tracker SDKs | Server-side and mobile applications. |
| HTTP Tracking API | Platforms or languages without an official Tracker SDK. |
JavaScript tracker
Web applications can report crashes using the Crash Analytics methods provided by the Matomo JavaScript tracker. This is the recommended approach when you can modify your application’s code and want to report application-specific errors.
For implementation details and code examples, refer to the developer guide on manual JavaScript reporting.
Matomo Tag Manager
Websites using Matomo Tag Manager can also report crashes using a Custom HTML tag. Use this approach when your application exposes error information through the data layer for Matomo Tag Manager to process.
Tracker SDKs
Applications can report crashes using a supported Matomo Tracker SDK. Supported Tracker SDKs provide methods for manually reporting exceptions and application errors. For example:
- PHP:
doTrackPhpThrowable() - Android:
TrackHelper.exception()
Native Android and iOS crashes are not detected automatically. Applications must explicitly report exceptions using the appropriate Tracker SDK. Refer to the developer guide on Tracking application and server-side crashes.
HTTP Tracking API
If your application cannot use an official Matomo Tracker SDK, you can send crash reports directly using the HTTP Tracking API. This allows applications written in any language or runtime environment to report exceptions to Crash Analytics.