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 a 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 the employee who is responsible for website 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.

Official Yandex.Metrica plugins are available for the most popular CMS programs, which can install the counter code automatically. In most cases, all you need to do is install the plugin and log in.

If you use multiple CMSs on the same website (for instance, you have one for the site content and another that runs a forum), you need to add the counter code to all of them.

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. 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 starts being collected immediately. 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.

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 employee who is responsible for website support.

  • The counter is blocked by the Adblock Plus extension.
  • The domain is blocked in the hosts file on your OS.