Metrica

Creating and installing a counter

To create a counter, follow these steps:

  1. Log in to the service. If you don't have an account, register.
  2. Click Add counter. The counter setup page opens.

Yandex.Metrica provides a range of features for evaluating website performance: user behavior analysis, achievement of business goals, and filtering out robot visits. To get this information, you need to configure the counter. On the counter setup page, note the following sections:

Installing a counter

Tip. To install the counter, we recommend contacting your webmaster or other person responsible for site support.
Installing a counter on a site with a CMS
  1. In the Yandex.Metrica interface, go to the Settings section (on the Counter code tab) and click Copy.
  2. Add the copied code to the file that generates the header for all the site‘s pages
    [no-highlight[

    If you don‘t place the counter code on all the site‘s pages, Yandex.Metrica will interpret a user as appearing on the site and then disappearing — statistics will show distorted data.

    ]no-highlight]
    .

Official Yandex.Metrica plugins are available for the most popular CMS programs. Plugins allow you to install the counter code automatically, so you only need to install the plugin and log in.

It is common for a single website to use multiple CMSs. For example, one CMS manages the site content, and another is used for a forum. In this case, the counter code must be added to each CMS.

Installing a counter on a site without a CMS
  1. In the Yandex.Metrica interface, go to the Settings section (on the Counter code tab) and click Copy.
  2. If this is not a large site and all the pages are separate files created manually, add the saved code to the HTML code of every page on the site
    [no-highlight[

    If you don‘t place the counter code on all the site‘s pages, Yandex.Metrica will interpret a user as appearing on the site and then disappearing — statistics will show distorted data.

    ]no-highlight]
    . We recommend inserting it as close to the top of the page as possible — the accuracy and completeness of data calculation depends on this.

*CMS is a Content Management System, a program for managing website content. A CMS is used for uploading and removing texts, images, or videos on a website without needing any programming skills.

After installation, the counter will be available on the My counters page. Data collection starts immediately after you install the counter code. A few minutes after you have installed the code, the My counters page shows the verification status for whether the counter is correctly installed.

Note. If your site uses CSP (Content Security Policy), we recommend using a special method to install the counter, such as in a separate JS file. This method meets the content security policy requirements.

You can also install a counter using a tag management system, and you can install multiple counters at once.

You can edit the counter code (for example, enable or disable collecting certain data). However, you will need to replace the code on all the site's pages. After a counter is edited, all previously accumulated data is not recalculated.

Verifying a counter

To check whether the counter code is correctly installed, append the ym_debug parameter with the value 1 to the page address in the browser's address bar, and reload the page.

http://example.com/?_ym_debug=1

If the counter code is installed correctly, it begins transmitting data. You will see this data in your browser console.

The browser console usually opens with the keyboard shortcut Ctrl + Shift + J ( + + J for Mac).

If there is no data in the console, this may be caused by the following:

  • The counter is not installed on the site.
  • The counter is installed incorrectly.
  • Other scripts are blocking the Yandex.Metrica counter on the site. You can check this in the browser console.

    To fix errors, contact the webmaster or other person responsible for your site support.

  • The counter is blocked by the Adblock Plus extension.
  • The mc.yandex.ru domain is blocked in the hosts file on your OS.
install metrica on a site
how to install yandex metrica
yandex metrica how to install
install metrica joomla
install metrica wordpress
install metrica bitrix
install metrica opencart