Creating and installing tags
Creating a tag
Alert
A single user can create no more than 100,000 tags.
Step 1. Log in to Yandex
If you don’t have an account, please register.
Step 2. Add a tag in Yandex Metrica
On the tag list page, add a tag. A page for new tag creation will open.
Step 3. Enter the main tag settings
-
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 not specified, the value of the Site URL field is used here.
-
Site URL. Main website domain. 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/
. Don't specify the URL for a specific file or page section using the “#” symbol: this will cause an error in the input field. Additionally, parameters passed in the URL are ignored (the part of the URL after the "?" symbol).Note
To add a Cyrillic domain, use Cyrillic characters. For example,
сайт.рф
. Don’t use Punycode.More information about the URL structure
https://<host>/<path>?<params>#<fragment>
<host>
: Site domain.<path>
: Path that can have a hierarchical structure. The structure is indicated using slashes “/”.<params>
: Block of parameters separated from the path by a question mark “?”.<fragment>
: Fragment of page content that is separated from the parameters and the path with a “#”.
-
Time zone and Currency. Statistics will be collected according to the selected time zone. If you change the time zone in the settings, the timestamps in historical data won't change. The selected currency will be used by default to display revenue. You'll be able to change the currency in the settings later.
-
-
Specify additional settings:
Session Replay, scroll map, form analytics
The Session Replay, scroll map, form analytics option enables session recording and builds a click map and link map.
Additional site addresses
This can be useful if:
- The same site responds from different addresses with the same installed tag.
- You want to get statistics for multiple sites using a single tag.
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/
. Don't specify the URL for a specific file or page section using the “#” symbol: this will cause an error in the input field. 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 tag code was also copied.
The Including subdomains option allows you to include subdomains of the main site and additional sites for filtration (subdomain.example.com
, other.subdomain.example.com
, ...).
Code snippet settings
Enable the options you need under Code snippet settings.
“Don't save full IP addresses of site users” option
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.
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.
- Accept the terms of the User Agreement.
- Click Continue.
Step 4. Complete your profile
Based on your profile data, Yandex Metrica will recommend you optimal settings and tools. Specify your site type, one or more industries, your CMS and CRM, and your roles in the project. A single user can have different sets of roles for different tags.
Installing a tag
Tip
To install the tag, we recommend contacting the employee who is responsible for website support.
You can install the tag with or without a CMS system.
Installing a tag on a site with a CMS
- In Yandex.Metrica, go to Settings and click Copy on the Tag tab.
- Add the copied code to the file that generates the header for all the site’s pages.
Official Yandex Metrica plugins are available for popular CMS platforms:
They can install the tag 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 tag on a site without a CMS
-
In Yandex.Metrica, go to Settings and click Copy on the Tag tab.
-
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
orbody
elements and as close to the top of the page as possible: the completeness and correctness of data calculations depend on this.
Note
Place the noscript
element with its contents in the body
element.
After installation, the tag will be available on the My tags page. The tag immediately starts collecting data.
You can also install a counter using a tag management system, and you can install multiple counters at once.
You can edit the tag 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 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 |
Provides overall statistics for all the sites. You can:
|
When users move between different sites, it is registered in a single session. |
|
Provides separate statistics for each site. You can:
|
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
-
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
-
Add the tag code to the HTML code of the pages of these sites.
Different tags
- In the Yandex Metrica interface, create multiple tags (one for each address).
- Add the tags to the HTML code of the pages of these sites.
- To view statistics, set up a report on a group of tags in the Yandex Metrica interface.
Learn more
Required information.
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.
CMS (content management system) is a program for managing site content. A CMS is used for uploading and removing texts, images, or videos on a website without needing any programming skills.