How to create and install a tag

Creating a tag

Restriction. A single user can create no more than 100,000 tags.

Training video. Creating a code snippet.

Watch the video

Step 1. Log in to Yandex

If you don't have an account, register.

Step 2. Add a tag in Yandex Metrica

On the page with the list of tags, add a tag. The tag setup page opens .

Step 3. Enter the main tag settings

  1. Fill in the information:

    • Tag name. The specified name is shown on the My tags page and in the upper menu for switching between tags. If it is not set, Website address is used instead.
    • Site URL.* The main domain of the site. This information is required. Don't include the prefix of the schema or protocol (http://, https://).

      In this field, you can enter the site's path in the URL structure. For example, example.com/category/. However, don't specify the URL for a specific file or page section (using the “#” symbol), or you will get an error. Additionally, parameters passed in the URL are ignored (the part of the URL after the “?” symbol).

      More information about the URL structure

      https://<host>/<path>?<params>#<fragment>

      • <host> — Site domain.
      • <path> — A path that can have a hierarchical structure. The structure is indicated using slashes “/”.
      • <params> — The section of parameters that is separated from the path by a “?”.
      • <fragment> — A fragment of the content on a page that is separated from the parameters and path with a “#”.
  2. Accept the Terms of use.
  3. Click Create a tag.

* Required information.

You can also:

Enable automatic goals

To do this, enable the option Automatically track clicks to phone number, email, and form submission in the tag settings. If you created a tag recently, this option is already enabled.

Learn more about automatic goals

Enable session recording, heat maps, and form analysis.
To do this, set the option Session Replay, scroll map, form analysis to On. This option also enables the click map and link map.

Learn more about Session Replay

Learn more about form analytics

Add additional site addresses

This can be useful if:

  • The same site with the same installed tag responds from different addresses.
  • You want to get statistics for multiple sites using the same tag.
  • You want to get notifications about site availability checks.

Clicks between all of the set addresses are interpreted as internal clicks.

In this field, you can enter the site's path in the URL structure. For example, example.com/category/. However, don't specify the URL for a specific file or page section (using the “#” symbol), or you will get an error. Additionally, parameters passed in the URL are ignored (the part of the URL after the “?” symbol).

If reports show data on page views that don't belong to your site addresses and you don't need this data, select Receive data only from specified addresses.

This situation can arise in the following cases:

  • Someone initialized a tag with your number on their own site (probably by mistake).
  • Your site's pages were being viewed via a proxy service.
  • There is an almost exact copy of your pages on other domains. When copying content, the code snippet was also copied.

The Including sub-domains option lets you include subdomains of the main site and additional sites for filtration (subdomain.example.com, other.subdomain.example.com, ...).

Subscribe to notifications

Yandex Metrica can send you news and recommendations about working with tags. To receive notifications, enter the email address in the Notification email section. Learn more about setting up notifications

Enable the option “Don't save full IP addresses of site users”

Yandex Metrica normally stores the entire depersonalized IP address of the user. If this option is enabled, the system registers an incomplete address. For example, 192.0.2.2 changes to 192.0.2.0. This means that location detection will not be as precise. Learn more

To enable the option, open the Additional data processing conditions section.

Confirm your acceptance of the Yandex Metrica data processing agreement

This is necessary if your company is registered in the EU or Switzerland, or if you are required to comply with the General Data Protection Regulation (GDPR) for other reasons. Learn more

To accept the agreement, open the Additional data processing conditions section.

Step 4. Specify additional tag settings

Under Additional settings, turn on the options you need.

Installing a tag

Tip. To install the tag, we recommend contacting the employee who is responsible for website support.

Training video. Installing a tag on a site

Watch the video
Installing a tag on a site with a CMS
  1. In Yandex Metrica, go to Settings and click Copy on the Tag tab.
  2. Add the copied code to the file that generates the header for all the site's pages.

Official Yandex Metrica plugins , which can install code snippets automatically, are available for the most popular CMS programs. 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 code snippet to all of them.

Installing a tag on a site without a CMS
  1. In Yandex Metrica, go to Settings and click Copy on the Tag tab.
  2. If all the pages on your site are manually-created separate files, add the tag code to the HTML for all website pages. We recommend placing it inside the head or body elements and as close to the top of the page as possible — the completeness and correctness of data calculations depend on this.
Note. Put the noscript element and contents in the body element.

*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 tag will be available on the My tags page. The tag immediately starts collecting data.

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

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

Collecting statistics on different domains and subdomains

Yandex Metrica provides several ways to do this:

Method Advantages Special considerations
A single tag for all addresses
Provides overall statistics for all the sites. You can:
  • Set up multi-step goals with steps that are related to different sites.
  • View Session Replay recordings, click maps, link maps, and scroll maps.

When users move between different sites, it is registered in a single session.

Different tags for each address
Provides separate statistics for each site. You can:
  • Get data on traffic sources.
  • Configure goals.
  • View Session Replay recordings, click maps, link maps, and scroll maps.
To view cumulative statistics for all the sites, you need to set up a report for a group of tags. This does not allow you to track goals or view Session Replay recordings and data from click maps, link maps, and scroll maps.
Tip. To get the most information possible about the sites, use both of these methods together.
Single tag
  1. In the Yandex Metrica interface, go to Settings (the Tag tab) and enter all the addresses that you want to track in these fields:

    • Site URL
    • Additional addresses
  2. Add the code snippet to the HTML code of the pages of these sites.
Different tags
  1. In the Yandex Metrica interface, create multiple tags (one for each address).
  2. Add the tags to the HTML code of the pages of these sites.
  3. To view statistics, set up a report for a group of tags in the Yandex Metrica interface.

If you were unable to independently check the tag, follow the recommendations below.

This might happen for the following reasons:

  • The tag is installed incorrectly. For example, the CMS modified the code snippet. Reinstall the tag or contact the support service for your CMS.
  • Broken scripts are preventing the Yandex Metrica tag from working on the site. You can check this in the browser console.

This means that information is being transmitted to Yandex Metrica. However, the data might not be shown in reports for any of the following reasons:

  • Data is sent to a tag with a different number.
  • The Filters tab in the tag settings has overly strict filters defined. Remove unneeded filters.
  • The Filters tab in the tag settings has the Don't count my sessions filter enabled. This means that the tag doesn't register your own sessions. Try accessing the site with your browser in “incognito” mode.