See this official Matomo doc page: https://matomo.org/faq/how-to/how-do-i-enable-basic-javascript-error-tracking-and-reporting-in-matomo-browser-console-error-messages/#:~:text=Matomo%20offers%20a%20basic%20feature,_paq.