Installing Yandex metrics code on your blog. Where is the best place to put the counter code?

In the second publication in a series of notes about, we will consider in detail the question of how to install a Yandex Metrica counter on a website. This service is very popular in RuNet and is often used as an alternative to the solution from Google. In terms of functionality, they are both more or less similar, so everyone chooses what is more convenient and close to him.

There are 2 fundamentally different ways to implement the task: editing template files and using plugins. Moreover, in the first direction, two more methods can be distinguished - editing the layout via FTP and inside the admin panel itself.

Since in the last article I talked about working with FTP, today we will use the capabilities of the CMS. Also at the end of the post I will give a brief overview of several Yandex.Metrica plugins for WordPress, especially for people who are terrified of touching theme editing.

General algorithm for adding Metrics to a WordPress site, according to which we will act:

  1. Registration in the service itself and general account setup.
  2. Select and activate the analytics tracking options you want and receive the appropriate embed code.
  3. Integration of this code into the connected active template.

In principle, nothing complicated, but for absolute beginners in the topic I highly recommend reading all the notes of the “trilogy”.

Installing Metrics in WordPress (via the admin panel in Footer)

Attention(!) Unlike the previous publication, we will: 1) add code to the footer of our web resource; 2) do this through the WP admin panel. Thus, I will show you another principle of operation, however, if you want, instead of the footer, you can place tracking in the header (header.php). Personally, I don’t see any more than a fundamental difference: previously, analytics was used at the end of the page so as not to interfere with its loading, but now all services work asynchronously, and it is believed that data is loaded a little better from the header (especially when the site is slow).

1. After registering and logging into your Yandex.Metrica account, find the “Add counter” button at the top. When you click on it, the following form will appear:

  • Write a name - any name for display in the system.
  • Enter the address of your website, for example kasinoazov.com (you can add several).
  • Check the box “Accept information only from the specified domain” (so that third-party values ​​do not end up in reports).
  • Set the time zone.
  • If necessary, additionally activate the functions of Webvisor, scroll tracking, etc.

Then you agree to “Accept the terms” of the user agreement and click “Create a counter”.

2. In the next step, you can choose a method for inserting Yandex Metrics code into WordPress and other CMSs - through regular HTML or using existing special solutions. Frankly, the usability here is better than that of Google Analytics.

We need the “HTML” tab, where above the code form you will see an opening block “Additional settings”.

Personally, I always note here:

  • asynchronous output;
  • in one line;
  • informer - if you want to show the counter;
  • alternative CDN - allows you to work correctly from any region where there are certain difficulties, for example, Yandex.Metrica is currently blocked in Ukraine.

After specifying all the parameters, below you will find the code ready for insertion.

3. Now go to the WP admin panel and select the menu item “Appearance” - “Editor”. By default, your current theme will be opened, so all you have to do is click on the name of the desired file - footer.php. You've probably noticed that WP 4.9 introduced syntax highlighting and automatic error checking.

Select the place in the template where exactly you want to install the Yandex Metrics code in the WordPress project. The developers advise adding it to the Header in order to take into account even those users who immediately closed the page, but personally, I put it where I want to display the counter - I don’t want to “tear” the informer and the tracking block into different layout files.

Then click on the “Update file” button and check if everything works well in the frontend + inside the analytics service. If you are going to change the counter settings, then after selecting and saving the appropriate options, you will need to reinstall it in the template.

Yandex Metrics plugins for WordPress

Initially, I found some modules directly in the repository, but as it turned out, the list of proven solutions is on the metrics API page. I think there is no reason to doubt the opinion of the developers, so I will consider their recommendations.

Yandex Metrica

Of all three, Yandex Metrica is the most functional plugin with many features:

  • easy work with different meter parameters;
  • built-in statistics widget for the console;
  • tracking and displaying results based on ;
  • support for i18n translations.

It's completely free. There are 20 thousand downloads, compatibility to the latest version of WP and a very recent update. To install, it is important that you have the wp_footer hook available in your footer.

You can view the status inside the admin panel only in advanced mode, which will require access to the service API. If the data/graph is not displayed, check the counter settings again - sometimes the API is slightly buggy in the new ones.

Yandex Metrica By Konstantin Kovshenin

This module is perfect for most users, because... eliminates the need to edit the template. After installation and activation, a special page of the same name will appear in the system with a form where you need to insert the Yandex.Metrica code for a WordPress site.

The advantage of this approach is that when you change the layout, you do not have to reconnect statistics. The solution has about 30 thousand downloads, but it has not been updated for more than 2 years. Although, on the other hand, this is unlikely to have any effect on its simple functionality.

DL Yandex Metrika

A distinctive feature of the plugin among all others is the ability to see analytics directly through the console. Moreover, there is not just a small widget, but the output of various data in tables and graphs. There are not as many downloads as others - only 3 thousand, but that is probably why the module is new.

Total. The choice of how to install Metrica on WordPress depends entirely on your goals and experience:

  • If you are going to analyze all the reports in detail, then it is better to do this directly in the online service, and simply integrate the corresponding code into WordPress (via the admin panel, FTP or modules).
  • For those who want to view some data in the console, one of the plugins - the first or third from the review - will be useful.
  • Are you doing a project for a customer who plans to change templates frequently? - install the solution from Konstantin Kovshenin, where the entire procedure needs to be performed only once.
  • By the way, sometimes advanced WP themes have a special separate option that allows you to insert HTML into the footer - it’s perfect for statistics.

If you have anything to add about the Yandex Metrics counter on the websiteWordpress, write in the comments. Ask your questions there.

We've released a new book, Social Media Content Marketing: How to Get Inside Your Followers' Heads and Make Them Fall in Love with Your Brand.

Subscribe

How to install Yandex Metrica

You can install the Yandex code on your website completely free of charge. Probably, in most cases, the default settings will be enough, but it is better to immediately approach the issue politely and figure out what and why we are doing in the settings.

We will look at examples for the following control systems:

First of all, register on Yandex and go to Metrica. Fill in all the required fields:

  • Counter name - everything is clear here, an arbitrary name for your counter.
  • Website address - link to your website.

Please note the following points

  • Mirrors. Be sure to register if they exist. A mirror is when your website opens at several addresses, for example, at www.site.ru and at site.ru. Ideally, this should not happen, of course. Such mirror pages must be designed with a 301 redirect. here.
  • Timezone. It is important that it matches the region of the site.
  • Visit time-out. As a rule, always standard, but if you have long videos on the site, then you should increase the session time to the average of your videos.

On the "Counter Code" tab, mark the required items. For each item there is help information nearby; just click on the “?” icon. I would also like to draw your attention to the following points:

  1. Webvisor. This is a tool that allows you to visually track user behavior on certain pages of the site. Helps to study visitor behavior on the site in more depth and detail. Don't forget that it is disabled by default.
  2. Informer. If you want to see current statistics on the site, then leave the checkbox, you can also select the type of informer.
  3. Using visit parameters. This is if in the future you plan to connect tracking of purchases on the site or specific events for your site.

You can configure the type of informer counter yourself:

This is what the Metrica counter will look like in your personal account after you install the Yandex counter on your website:

Where to install the metric counter?

It must be placed inside a tag .... in the HTML code of each page (closer to the end of the page).
Let's look at options for installing a counter in various CMSs.

How to install Yandex Metrica on WordPress

There are two ways to install Metrica on WordPress. The first is to install the Yandex.Metrika plugin and enter the counter number there.

Go to your admin area, select the "Plugins" tab and click "Add New". In the search window, type yandexmetrika:

Select the plugin installation from the list that appears.

When the plugin is installed, enter your meter number in the appropriate line.

Save your changes.

The second way to install the Yandex Metrica counter on WordPress is to do it manually. In the admin panel, open the “Appearance” section and select the “Editor” option. In the window that opens, on the right side of the screen, go to the “Footer” section (footer.php) and place the code that you received during registration in the “Counter Code” section.

Place this piece of code inside the tag .....

How to install metrics on Joomla

In this system we will use the Joomla Yandex module. Metrics. Open the admin panel of your site, select “Extensions” - “Module Manager” in the top panel and click “Create” in the upper right corner.

Then in the window that opens, select the “Custom HTML code” option. Fill in the fields: title - write any word; Below in the “Show title” field, select “No”; "Enabled" - select "Yes"; "Access" - "Everything".

Scrolling down the page, insert the counter code into the custom text window:

Save the changes. Voila! Joomla metrics have been added.

How to install metrics on Bitrix

Go to the admin panel of the site, in the left column select the “Settings” menu item. In the list that opens, select “Product Settings” - “Sites” - “Site Templates”. On the right side we see the templates that were created for our site.

To install Yandex Metrica on Bitrix, select a template and open it. We are interested in the text field, this is where the code is placed.

That's it, Yandex Metrica Bitrix is ​​installed. After saving the changes, the counter will be displayed on every page of the site.

How to Set a Metric on Wix

To add Yandex Metrica to Wix, follow the link, click “Add”, select our site, click “Open site”.

Then, click "Connect". Enter your username and password and click "Login". In this windowselect "Allow".

We create a counter in the application. Wix developers advise creating a new counter, since if you connect an existing one to an account that may have been registered in an older version, they will not be able to be responsible for the correctness of its operation.

When creating a new counter in your Yandex account, fill in the following information: “counter name” and “site domain”.

After installing Metrics on Vicks, you can view statistics of visitors, visits and site views by selecting the period and schedule of interest.

Questions that arise regarding Yandex Metrica

Let's look at the most popular questions that Metrica users have:

What to do if the meter does not work?

You can get a detailed answer to this question in. It examines several problems and ways to solve them.

Do I still need to perform any actions after making changes to the counter settings?

If you have made changes to the Metrica interface, be sure to reinstall the counter code toeveryonesite pages. If you use several different CMS, then do not forget to update the Metrica code in each management system.

Why is it more practical to place the counter code at the top of the page?

In fact, you can place the code anywhere on the page, as long as it is in tags ..., but if you place the counter at the beginning of the code after the tag , it will load faster and send viewer data.

This article covers the main questions about installing Metrica. We hope that after reading you will not have any difficulties on the topic of how to install the Yandex Metrica counter on your website.

So that you never have a question, after or several months of SEO promotion, how to find out the effectiveness, you need to install Yandex.Metrica on the site in advance.

In addition, after installing Metrics, Yandex will collect additional information about your site and its visitors, thus the site’s position in search engines may improve. The instructions are relevant for 2019 and take into account all the latest Metrica updates. In general, there are only advantages, so let’s move from words to action.

Installing a Yandex.Metrica counter on a website

To start installation, go to the website metrika.yandex.ru, and log in through your Yandex account. If you don’t have an account, just register a new email, it won’t take more than a minute.

Creating a counter

Step 1. After you have visited the Metrica website, click “Add counter”. Next you need to decide on the name of the counter. If in the future there will be many projects, in order not to get confused in them, it is better to name the counter with the website address or the name of the company.

Settings

Step 2. Indicate the address of the website where the counter is installed, the time zone in which you are located or in which it is more convenient to receive data.

If you need to collect data from subdomains, click the plus sign next to “Additional addresses” and add the address of the site on the subdomain. But it’s better to create a separate counter for each subdomain.

Step 3. We include the collection of additional data about site visits. Webvisor, scroll map and analytics of forms on the site. Turn the switch to the “On” position.

Afterwards, check the box to accept the user agreement (read it first by opening the link). And click the “Create counter” button.

Step 4. Additional settings. The counter installation window will open, where we click on the “Advanced settings” item.

A list of additional counter settings will open. Let's briefly look at each of them.


How to install Yandex.Metrica code on a website

Step 5. After that, copy the Metrica code. To do this, click the “Copy code” button or select the code manually and copy it by pressing the “ctrl+c” key combination. Next, we’ll look at how to install the Yandex.Metrica code on different types of sites.

HTML

You will receive a code that needs to be placed on all pages of the site, between the tags . To do this, open the site’s file system on your hosting, find all the files of the site’s pages. If you have a one-page site, then most likely this is a file index.htm l or index.php.

Open the file for editing. Finding the section - it is always at the very beginning of the page. Set the course and press paste “ctrl+v”.

Save the changes made.

Installing Metrica on WordPress, Joomla and other CMS

Or any other CMS. If you use any of the popular CMS, such as WordPress or Joomla, to manage your site, the installation process will not differ fundamentally. On the contrary, it will become a little simpler; you will only need a superficial understanding of how your engine works.

Using an FTP connection or through the file manager in the administrative panel, you need to find the file responsible for the page title. For example, in all WordPress themes this file is called header.php, which actually contains the section of the site containing . And then everything is simple - insert the counter code there. The advantage is that you will not need to insert code manually on each page of the site; the management system will do it for you.

Congratulations! We have successfully figured out how to install Yandex Metrica on a website, now you can see everything that happens on your website! We will talk about analyzing standard reports, setting goals and other ways to work with web analytics in the following publications.

Hi all! At the request of my readers, I continue my topic about web analytics, about the most popular tools for assessing traffic that many bloggers use. I have prepared for my readers a detailed step-by-step manual for installing the Yandex Metrica counter code on your website, made a special video and visual pictures on working with important functions and parameters. With the help of this guide, any blogger can easily create their account in this web tool system. And for connoisseurs of my SEO cheat sheets, I have prepared a small surprise - a selection of ready-made high-quality search queries on the Yandex Metrica topic, distributed according to general topics.

Installing Yandex Metrics on your website

To use useful Metrica tools, you first need to create your account in the Yandex search engine. I won’t write here how to do this - I’m sure that almost all Runet bloggers have it, and perhaps not even one. When you log in with your username and select Yandex Metrica from the services offered. You will be taken to the following screen where you will be invited to take a closer look at this service:

Like any web analytics system, Yandex Metrica collects various parameters and measurements using its special counter. So you and I will have to install it on our website, taking into account a different number of parameters for a clearer and more detailed assessment of visits. By clicking the “Get Counter” button, we are taken to a special questionnaire with five tabs:

On the first page we must fill in the following fields:

  • Name. We indicate the name of our counter. Usually this is either the name of our site, or we simply write “my blog.”
  • Website address. We indicate the URL of our blog domain (home page address). To avoid data loss, be sure to indicate the main mirror of our web resource.
  • Notification checkbox. Place a check mark next to the item about receiving meter health messages via email or SMS. I always choose the first option because I am confident in the performance of my hoster.
  • Region selection. An important element in setting basic settings for the correct collection of visit statistics. Find your region and select.
  • Checkbox for accepting the terms and conditions. A standard version of the user agreement stating that we use the Yandex Metrica service, agreeing to follow certain rules.

After all the procedures described above, click the “Continue” button to the next tab, where we will be asked to select the basic counter settings:

First we need to indicate the presence of the following additions in our counter:

  • Webvisor. A unique tool that allows us to analyze the behavior of visitors to our blog. We see all the actions that blog readers take. An extremely necessary thing that more than one self-respecting webmaster cannot do without.
  • Hit map. A special analytical tool for measuring and displaying statistics on clicks on page elements of our site. Using it, you can see all the transitions across all elements of the web resource.
  • External links, file downloads and report using the “Share” button. An important element, without which we will not have data on transitions from external links. Also thanks to it we can see statistics on the use of “likes” for social networks.
  • Accurate bounce rate. A bounce is an action by a visitor to our website in which he spent less than 15 seconds on one page. Therefore, this module is also relevant for our counter.
  • Informer. An additional graphic block that shows data on traffic to our site for the current day. You can choose one of the proposed options, which can be customized in appearance. You can also select the advanced option, which opens an additional window with visit statistics. Not a required module, but very attractive.
  • Asynchronous code. By checking the checkbox in this position, the output we get is improved code that does not block or affect .

After checking all the necessary modules in the tab (I advise you to select everything except the informer - it is optional), we will then see a special html code. We will install it at the very end, but for now let’s move on to the next tab “Webvisor”. On this page we must specify the webvisor settings for specific data collections. If you have a regular blog, then you can skip this tab. If you manage an online store or website that provides various information to registered users, you need to enable the “Record page content” setting. It allows you to show in a special player exactly the version of the page that is visible to a particular visitor to the web resource.

The next important tab for defining the Yandex Metrics counter is the page with goals:

Here we can set up our account for collecting visit data so that it can show us special reports for various purposes. These can range from “measuring the number of pages viewed under different conditions” to “downloading files from pages on our sites” (for example, downloading free materials). If the goals are already known, then they should be registered immediately when installing the meter. If not, you can always add them at any time.

The same circumstances are generally true for the additions in the last tab. Here you can add filtering for your counter based on various parameters that we already receive as a result of data collection. You can also specify the required operations (a kind of filter option) and refine the resulting report. For novice bloggers who do not have specific goals and objectives for assessing traffic to their young site at the beginning of their journey, this tab will remain a closely guarded secret for now. The only thing they can do here right away is to check the box next to the sentence “ignore my visits.”

But for advanced webmasters, SEO specialists and analysts, this tab, like the previous one with goals, is the main place for setting the initial and final statistics parameters. First, goals are set, filters are set to exclude garbage from reports, and they use various operations to correct the data. And only then they are analyzed.

Installing code in the body of your blog

After we have gone through all the tabs and selected the settings and additions necessary for work, we need to save them. To do this, simply click the save button. And now all we have to do is install a ready-made counter on our blog.

There is only one installation rule here - the counter code must be embedded inside the tag . To do this, you first need to find the place where the first tag is located. Then, after it, we put our counter code (usually placed immediately after the opening body tag). The informer code can no longer be placed in any place, but only in the designated place. For example, in the footer or in the sidebar widget. I don’t put an informer on my blog - it doesn’t take up space, and it doesn’t spoil the overall design of my blog with an archaic insert. If I need to find out traffic, I simply open an account in Yandex Metrica and look at the general summary.

For blogs on CMS WordPress, the installation scheme for the counter (not the informer) will be as follows:

  1. Go to the administrative panel of your blog and select the “editor” element from the left menu. I have it in the “Design” submenu.
  2. Then I look for the file that contains the tag I need . In my case (as in most) this is the header.php file. By the way, in the same file I also have an installed counter for the Google Analytics service.
  3. I copy my counter code received in the Yandex Metrica system and put it immediately after the tag. I save the file. The counter is installed!

Bonus video tutorial for all readers

To better understand the topic of this article, I made a special video in which you will see with your own eyes how you can install the Yandex Metrica counter code step by step. And don’t forget, when you watch it, turn on HD mode - I make all my latest videos in the best quality so that you can see the smallest details in the picture.

Bonus for readers of my SEO cheat sheets

For this article, I have prepared for you a selection of the highest quality keywords on the Yandex Metrica topic. All of them are sorted, analyzed and grouped into different topics for possible future posts of yours. I explained what the parameters of the collected search queries mean in the cheat sheet itself. I wrote in my free book about blog promotion how to implement these keywords into the body of the post.

Sincerely, Your Maxim Dovzhenko

Hello dear readers of the blog site. Today I want to talk in more detail about how to create a Yandex Metrics counter. On the pages of my blog I have already touched on the topic of the need, and also told, but this article will be devoted specifically to the collection of visit statistics using Yandex.

Thanks to the installed Yandex counter, you can analyze information on the number of visitors, the time a user spent on your resource, the age of visitors, and much more. The Yandex search engine has created a specialized service for this called Yandex.Metrica, and the metric counter is a specific tool that allows you to collect this information. In addition to this service, the search engine has a service that allows each webmaster to track the number of indexed pages, view indicators such as the number of backlinks to the site and a lot of other important information. I highly recommend registering your project with this service.

Let's return to the topic of our article and first register in the search engine. In order to register, you just need to create your own mailbox, and this account will allow you to use all Yandex services.

Creating a Yandex metrics counter

The first thing we need is to add a Yandex counter. To do this, follow the link http://metrika.yandex.ru/list? and click the “Add counter” button, after which we get to the creation page, where you need to enter basic information. In the figure below I have shown an example of filling out all the required fields with fictitious information.

After you enter the information and accept the terms of the agreement, you must click the “Create” button. This action will take you to a new page where we will further configure the main functions.

How to set up a Yandex metrics counter

The settings page contains several sections, I will try to talk about each of them in detail.

Basics

In the main section, information will be visible, including number, name, site domain and time zone.

You can change the information, but whenever you change, be sure to click the “Save” button. a thread"

You also have the ability to add additional domains, which are used to monitor resource availability, filter persistent data from reports, and collect statistics on internal clicks.

Counter code

Here you can configure the main functions of the Yandex Metrics counter by changing the code. I’ll tell you about the main parameters without going into unnecessary ones:

Webvisor – Allows you to analyze the behavior of project visitors.

Hash – Hash tracking in the browser address bar.

A hash is a unique file name, independent of how it was named.

Asynchronous code – Allows the installed Yandex metrics counter not to affect the site loading speed.

Informer – When installing the code on a site with basic settings, it will be invisible to everyone. Checking the box next to this item will make it visible and the function for setting up the graphical display of the informer will appear (can be seen in the figure below).

Webvisor

In this section, you can enable a web viewer that allows you to record the contents of pages along with the actions of visitors, which will later allow you to view which links were followed by internal navigation, and view all the actions of the visitor on the pages of your project. This section has several settings, the description of which you can read by clicking on the question mark next to each parameter.

Webvisor is a very convenient function that allows you to analyze the usability of your resource and evaluate how interesting and convenient it is for your visitors.

Goals

You can add up to two hundred goals, indicating what number of visits is a successful result. In fact, this section makes it possible to set certain goals and inform about their achievement. At the initial stage of creating a website, it is not very interesting, since the webmaster tries to pay attention to filling the site, setting up usability and promoting it in search engines. When the number of visits reaches at least fifty people per day, then you can begin to set certain goals for the future.

Filters

This section remained a mystery to me. I tried to find information on the Internet, but really didn’t find anything. I believe that it is not worth filtering any data, since you will not see a complete analysis. Apparently that’s why, when creating the Yandex metrics counter, I didn’t bother studying this section too much.

Notifications

Thanks to notifications, you can receive messages from Yandex.Metrica if problems arise with resource availability by email or via messages to your phone.

In fact, we have figured out how to create a Yandex Metrics counter, all that remains is to install it and start receiving statistics on visits.

Installing a Yandex metrics counter on a website

After all the settings have been made, return to the “Counter Code” section and re-check that all the necessary functions have been enabled and the visual display is configured to suit the design of your project. If you are sure that you are not going to make any more changes, then click the “Save” button and copy the code to the clipboard.

That's the whole description. In fact, there shouldn’t be any problems in creating and setting up a Yandex Metrics counter, but if you have any questions or add-ons, please let me know in the comments.