Tracking browser console errors?

Heya, I am trying to figure out if it’s possible to track JS / resource error that are normally printed to browser consoles?

It would be great to track issues with javascript and missing resources, on lying thing I found was from Github:

_paq.push([‘enableJSErrorTracking’]);

However to make this work Matomo script needs to be loaded prior to anything else, which is not recommended. Also AFAIK it only tracks JS errors, but no errors regarding missing resources as fonts, images etc.

Anyone knows if this is possible to achieve?

Source: New: Automatic Javascript Error Tracking with Piwik! · Issue #4977 · matomo-org/matomo · GitHub

If I remember correctly from my readings, you can push to the _paq array at anytime after the script is loaded. So, why not load just the script and the one push. And, then push everything else after the page has loaded?

Roddy

Another thought on this subject. The Matomo tracking script is coded to load asycrhonically. Placing the Matomo script in the <head> tag may slow the overall loading of the page, but it will not interfere with the normal order in which the HTML is loaded.

Further, if I have understood asynchronic loading properly, the Javascript and HTML will load simultaneously, and no script tag will be run until it is completely loaded, anyway.

Roddy

The basic JavaScript error tracking and reporting in Matomo (browser console error messages) is now documented @ https://matomo.org/faq/how-to/how-do-i-enable-basic-javascript-error-tracking-and-reporting-in-matomo-browser-console-error-messages/