In the website editor, go to the Settings menu (top right corner) → the Scripts section. Insert Yandex.Metrica code in full in the field Before </head>
<!-- Yandex.Metriсa counter -->
…
<!-- /Yandex.Metriсa counter -->
Apply the changes and publish the website to put them into effect. The code will be added to all website pages.