How Yandex.Metrica works
The work of NM is carried out using a special counter, which is installed on the site and which collects all information about traffic (where the visitor came from, what actions he performed, what characteristics he possesses, etc.). The counter itself is a small piece of code. It fits into the code of the html page. In practice, it is most often added to the site header (between the opening and closing head tags). This allows it to load immediately upon visiting the page and collect all the information it needs. If the counter is placed, say, at the end of the html document (in the footer), it may not have time to load before the user closes the tab. And he will not collect any data on such a visit. Find out more at https://romi.center/ru/. Why is that bad? Let's take an example. Let's say a user navigated to a site from search. The page took too long to load, he got tired of waiting, so he closed it. The reason for the slow loading is unclear. Perhaps the site contains some "heavy" element (JS fragment or a picture of maximum resolution), or maybe the visitor just has a slow Internet. This is not important. It is important that in such a situation the webmaster will not receive any information about such a transition, since the "Metrica" counter did not have time to load (after all, the entire page content was loaded first). The webmaster believes that everything is fine on his site. Takes no action to optimize performance. And users continue to close the resource over and over again, without waiting for the full page load. If the counter is located at the beginning of the page (in the header), it will record all such visits. And the webmaster will be able to fix all the problems in time.