Today I came across an interesting
post about monitoring errors on the site. The described method has a drawback - it is applicable only for React.
After reading the post, I immediately remembered the web viewer. If a person called me,
oh, I clicked somewhere, it jumped out, found a mistake on the site, I would be very happy to see what he did, and not to ask a person a lot of questions, wasting his time.
It turned out that everything is so simple that the implementation of the idea took me only a minute.
The only way to convey the fact of an error on the page - goal.
I created a javascript event and called the target Js Error.
')

Next, I added to the counter code the sending of events when an error occurred.
<script type="text/javascript" > (function (d, w, c) { (w[c] = w[c] || []).push(function() { try { w.yaCounter%id % = new Ya.Metrika({ id:%id %, clickmap:true, trackLinks:true, accurateTrackBounce:true, webvisor:true </script> <noscript><div><img src="https://mc.yandex.ru/watch/%id %" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
At this point, my experiment was successfully completed. If you go to a webcam, you can see the achievement of goals, which means that an error occurred during your current visit.

Of course, for the full analysis of errors this will not be enough. I think it is worth making an error handler that will display information directly on the page if the site is viewed through a web browser. You can also divide mistakes into levels, or even make certain events of particular interest into a separate goal. For monitoring 404, 500 and other errors, you can add a counter to the error template with a separate goal and send it immediately after the initialization of the counter.
Very pleased that along with the recording of user actions, we get a lot of information that can help with further checks.

There are also disadvantages of this method:
- To determine the error you need to view the visit
- The number of goals in the metric is limited. 200 targets available
- Pages on which the counter is not installed will not be monitored.
- The web visitor does not record all visits from users, but only 120 thousand visits per day and stores them for 15 days.
I hope this simple way can be useful to someone.
UPD:
In the comments
altervision suggested that you can pass on the parameters of the visit in the
reachGoal method. This may be enough to send error messages.