What is a « Script Error » and why isn’t there more information?
Modern browsers may report errors from scripts loaded from another origin as the generic Script error. message. This is a browser security measure that prevents potentially sensitive cross-origin information from being exposed.
When the browser sanitises a cross-origin error, the information available to Matomo can look like this:
| Error detail | Normal error | Cross-origin error |
|---|---|---|
| Message | Actual error message | Script error. |
| Script URL | Available | Not provided |
| Line / column | Available | 0 / 0 |
| Error details | Available | Not provided |
This does not indicate a Matomo error or a data quality issue. Matomo records the error information provided by the browser. When the browser withholds the error details, Matomo cannot capture the original error message, file, or other diagnostic information.
How to investigate the error
- Open the affected page and check the browser developer console for more details.
- If you own the domain hosting the script, you can configure Cross-Origin Resource Sharing (CORS) so the browser can expose the error details. Add
crossorigin="anonymous"to the<script>element that loads the JavaScript from the other origin. - Configure the server hosting the JavaScript file to return an appropriate
Access-Control-Allow-OriginHTTP response header. - Reload the page and check the browser developer console to confirm the CORS configuration works correctly.
- When configured, the browser can provide the underlying error details, which Matomo Crash Analytics can then capture.
If you do not control the domain hosting the script, the server owner must configure the required CORS header. Without this configuration, the browser will continue to withhold the error details.