Tracking browser console errors?


#1

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


(Roddy A. Stegemann) #2

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


(Roddy A. Stegemann) #3

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