The easiest way to install Yandex Metrica on Joomla 4, 5, or 6 is to use the Yandex Metrica Integrator system plugin. It lets you connect the counter without manually editing template files, configure the main Metrica options, and display an informer when needed. You can also install the counter manually through a Custom HTML module or directly in the template code.

What is Yandex Metrica?

Yandex Metrica is a web analytics service by Yandex that helps you analyze website traffic, traffic sources, and visitor behavior.

Once the counter is installed on your website pages, Metrica starts collecting statistics about visits and user actions. The service lets you analyze the effectiveness of traffic sources and advertising, use Webvisor, click maps, goals, e-commerce tracking, and other web analytics tools.

How to install Yandex Metrica on Joomla?

Important information!
Before installing Metrica, you need to create a counter in your Yandex account. You will need the counter ID to configure the plugin.

You can find the counter ID on the “My counters” page next to your website address or in the settings of the corresponding counter on the “Counter” tab.

There are several ways to install Yandex Metrica on Joomla:

  1. using the Yandex Metrica Integrator system plugin — recommended;
  2. through Joomla's standard Custom HTML module;
  3. by inserting the counter code directly into the template.

Yandex Metrica Integrator plugin for Joomla

The easiest way to connect Metrica is the free Yandex Metrica Integrator system plugin for Joomla 4, 5, and 6. Instead of manually inserting ready-made JavaScript code, you only need to enter the counter ID and configure the required options.

  1. download the Yandex Metrica Integrator plugin;
  2. in the Joomla administrator panel, go to System → Install → Extensions;
  3. install the downloaded ZIP package;
  4. go to System → Manage → Plugins;
  5. find System - Yandex Metrica and open its settings;
  6. enter the Counter ID;
  7. configure the required options;
  8. set the plugin status to Enabled and save the changes.

The plugin will automatically generate the counter code and add it to your website pages. The code is regenerated automatically when the settings are changed.

Yandex Metrica Integrator features

The plugin settings include:

  • Webvisor;
  • click map;
  • link tracking;
  • accurate bounce rate tracking;
  • URL change tracking;
  • page title sending;
  • e-commerce support;
  • additional Metrica initialization options;
  • exclusion of selected Joomla user groups from analytics.

The last option is useful, for example, if you want to exclude website administrator visits from your statistics.

Counter code

At the bottom of the Plugin tab, the automatically generated Counter Code is displayed. You can copy it with one click.

This also allows you to use Yandex Metrica Integrator only as a code generator: you can copy the generated code and install it on the website manually without enabling the plugin.

Yandex Metrica informer in Joomla

Yandex Metrica Integrator also lets you configure and display the Yandex Metrica informer — a small visual block showing website traffic statistics.

Important information!
For the informer to display correctly, it must also be enabled in the settings of the Yandex Metrica counter itself. The informer code does not replace the counter code: if only the informer is installed, visit statistics will not be collected.

To configure it, open the Informer tab in the plugin settings.

Here you can:

  • enable or disable automatic informer output;
  • select a Joomla module position;
  • place the informer at the beginning or end of the selected position;
  • select the informer type;
  • configure its size;
  • select the displayed metric;
  • change colors and transparency;
  • preview the result live.

For automatic placement, select the required template module position in the Position field and choose At the beginning or At the end in the Order in position field.

No separate Joomla module is required for this method.

Informer code

At the bottom of the tab, the ready-to-use Informer Code is displayed and can also be copied with one click.

If automatic output through the plugin is not suitable, copy this code and insert it manually, for example into Joomla's standard Custom HTML module. In this case, automatic informer output in the plugin settings can remain disabled.

Installing Yandex Metrica through a Custom HTML module

If using the system plugin is not possible, you can place the counter code through Joomla's standard Custom HTML module. However, this method is less universal: the module will only work on pages where the current template actually renders the selected module position.

Please note!
Yandex recommends placing the counter code on all website pages as close to the beginning of the page as possible. Therefore, installation through the system plugin is preferable to placing the counter in lower module positions.
  1. if necessary, configure the ability to add the <script> tag using this guide;
  2. go to System → Manage → Site Modules;
  3. click New;
  4. select the Custom module type;
  5. enter a title, for example “Yandex Metrica”, and disable title display;
  6. insert the counter code in HTML source mode rather than as regular text;
  7. select a position that is actually rendered by the active template on the required pages;
  8. set the status to Published;
  9. on the Menu Assignment tab, select On all pages;
  10. save the changes.

You can copy the ready-made code directly from the Yandex Metrica interface or generate it on the Plugin tab of Yandex Metrica Integrator and use it without enabling the plugin itself.

Inserting the counter code into a Joomla template

Another option is to add the Metrica code directly to the Joomla template. This method requires manual file changes and is usually less convenient than using the system plugin.

Important information!
The counter will only be installed on pages that use the modified template. If your website uses multiple templates, the code must be added to each of them.

You can add custom code in several ways:

  1. Through the template settings.

    Some templates allow you to add custom code through their own settings without editing files.

  2. By editing the template's index.php file through your hosting control panel or FTP.
  3. By editing the template file directly from the Joomla administrator panel.

To edit the template through the Joomla administrator panel:

  1. go to System → Site Templates;
  2. open the required template;
  3. find the index.php file;
  4. locate the opening <body> tag or its version with attributes;
  5. insert the full counter code as close as possible to the beginning of the <body> element;
  6. save the changes.

Yandex recommends installing the counter on all website pages as close to the beginning of the page as possible. If the JavaScript part of the code is placed in <head>, the <noscript> element must remain inside <body>.

Important information!
When updating the template, its files may be overwritten. If the Metrica code was added directly to index.php, check after the update whether your changes are still present.

How to check whether Yandex Metrica is working

After installation, make sure that the required counter is actually present on the website pages and is sending data.

  1. open Yandex Metrica and go to the settings of the required counter;
  2. find the Counter check section;
  3. enter a website page URL and run the check;
  4. repeat the check for several types of pages if the website uses different sections or templates.

For more detailed diagnostics, add the _ym_debug=2 parameter to the page URL, for example:

https://example.com/?_ym_debug=2

The debugger lets you check the installed counter ID, its parameters, page view tracking, e-commerce events, and other data.

If Metrica does not detect the counter, check whether it is being blocked by a browser extension, other scripts, Content Security Policy settings, or network restrictions.