---
metadata:
  - name: generator
    content: Diplodoc Platform v5.54.5
alternate:
  - https://yandex.com/support/metrica/en/ecommerce/bitrix.md
  - https://yandex.com/support/metrica/es/ecommerce/bitrix.md
  - https://yandex.com/support/metrica/pt/ecommerce/bitrix.md
  - https://yandex.com/support/metrica/ru/ecommerce/bitrix.md
  - https://yandex.com/support/metrica/tr/ecommerce/bitrix.md
  - https://yandex.com/support/metrica/zh/ecommerce/bitrix.md
  - href: en/ecommerce/bitrix.md
    type: text/markdown
    title: Markdown version
  - href: ../llms.txt
    type: text/markdown
    title: llms.txt
title: Enabling a 1C-Bitrix module
description: Connecting a 1C-Bitrix module.
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com/support/metrica/en/llms.txt


# Enabling a 1C-Bitrix module

The Yandex Metrica team developed an official free-of-charge module for installing a web analytics tag on a website. The module runs on 1C-Bitrix version 18.0 and higher, and supports all “1C-Bitrix: Site Management” editions.

“Yandex Metrica” module features:

- Adding new Yandex Metrica tags with the following options enabled by default:
    
    - [E-commerce](https://yandex.com/support/metrica/en/ecommerce/about.md).
    - [Session Replay](https://yandex.com/support/metrica/en/webvisor/info.md).
    - [Click map](https://yandex.com/support/metrica/en/behavior/click-map.md)
    
- Transmitting [E-commerce events](https://yandex.com/support/metrica/en/ecommerce/data.md):
    - Viewing an item profile.
    - Adding an item to the basket.
    - Removing an item from the basket.
    - Making a purchase.
    
- Providing details of [transmitted product data](https://yandex.com/support/metrica/en/ecommerce/data.md#product_data).

{% cut "Module security" %}

As a result of analysis conducted with 1C-Bitrix, potential vulnerabilities in the **yandex.metrika** module were identified and resolved.

Specialists spotted several security issues: there was a risk of data compromise, request spoofing, or malicious code injection by attackers. All detected vulnerabilities were promptly fixed.

Here are the changes we made:
- Authentication for AJAX actions has been strengthened. Access to critical operations is now protected by CSRF token verification and request method checking.
- We've added protection against user ID spoofing through cookies: identification is now tied to the server session.
- Risks related to unsafe data deserialization and the use of potentially dangerous functions (for example, extract) have been eliminated.
- We have performed thorough validation and escaping of all user data output to JavaScript context, which prevents cross-site scripting (XSS).
- Strict CSRF token verification has been added when saving module settings in the admin panel.
- We have corrected the method for determining user IP addresses: the platform's standard mechanism is now used, which prevents IP spoofing through HTTP headers.

All these changes enhance site security and don't affect the standard functionality of Yandex Metrica. This update doesn't require any additional actions from administrators. It's enough to install the current version of the module.

We recommend that users of the **yandex.metrika** module update it for maximum protection of their projects.

{% endcut %}

## Installing and setting up the module {#general}

### Getting started {#start}

1. If you don’t have a Yandex Metrica tag yet, [create one](https://yandex.com/support/metrica/en/quick-start.md). Make sure the correct website URL is specified in the tag settings. To check this, go to the Yandex Metrica **Settings** page. Pay attention to the **Address** field value: it should show the URL of the website where you want to install the module.
1. <!-- source: en/_includes/ecommerce/enabling/id-enabling/3.md -->
   In the tag settings, enable the **E-commerce** option. A container for collecting data from `dataLayer` will be added to the code snippet by default.
   <!-- endsource: en/_includes/ecommerce/enabling/id-enabling/3.md -->
    
1. Make sure no similar module that installs a Yandex Metrica tag is activated in 1C-Bitrix. In the admin panel, open **Marketplace** → **Solutions installed** and search for modules named “Yandex Metrica”, “Metrica”, or “Metrika”. If there is one, delete it.

### Step 1. Install the module {#upload}

Go to the 1C-Bitrix admin panel, log in, and add the module using one of the following methods:


{% cut "Through the admin panel" %}


1. Open **Marketplace** → **Solutions installed** and find the module named “Yandex Metrica”.
1. Click the icon and select **Install now**.
    

{% endcut %}

{% cut "Via 1C-Bitrix: Marketplace" %}


1. Go to [1C-Bitrix: Marketplace](http://marketplace.1c-bitrix.ru/solutions), and find the module with the name "Yandex Metrica".
1. Open the module and click **Install**.


{% endcut %}

{% cut "Using a ZIP archive" %} {#zip}


1. Download the installation ZIP archive with [UTF8](https://metrika-cms-plugins.s3.yandex.net/1c-bitrix/yandex.metrika.utf8.zip) or [CP1251](https://metrika-cms-plugins.s3.yandex.net/1c-bitrix/yandex.metrika.cp1251.zip) encoding.
1. Go to the 1C-Bitrix admin panel on the **Content** page.
1. Select the **Files and folders** → **bitrix** → **modules** section and open the last page of the module list.
1. Click **Upload** → **Add file** and select the ZIP archive with the Yandex Metrica module.
1. Click **Save**. The archive will be uploaded to the `modules` catalog on your server.
1. Unpack the archive: find it in the list of modules, click ![](../_assets/bitrix-menu.png), and select **Unpack**. Make sure that the `yandex.metrika` catalog appears in the list.
1. Open **Marketplace** → **Solutions installed** and find the module named “Yandex Metrica”. Click ![](../_assets/bitrix-menu.png) and select **Install**.


{% endcut %}


### Step 2. Set up the module {#set}

1. Go to **Settings** → **Product settings** → **Module settings** → **Yandex Metrica**.
1. Select the website.
1. Enter the number of the tag installed on your website. If the plugin detects a Yandex Metrica tag on the website, the fields will be filled in automatically. Check if their values are correct. [How to find the tag number](https://yandex.com/support/metrica/en/general/tag-id.md)
1. By default, the **Session Replay** option is enabled. It [records user sessions](https://yandex.com/support/metrica/en/webvisor/info.md) so that you can analyze statistics in more detail. If necessary, you can disable Session Replay at any time.
1. Save the changes.
    


{% note tip %}

The **Brand Property** field is not obligatory. [Fill it in](#brand) if you want to track statistics on the product brand in Yandex Metrica. For example, which brand is most popular with customers.
In addition, to get more detailed statistics about products (for example, which products users view most often), [configure the detail event](#detail).

{% endnote %}


### Step 3. Check if data is sent {#check}

Check if the following data is sent to Yandex Metrica:

- [E-commerce](https://yandex.com/support/metrica/en/ecommerce/check.md).
- [Site sessions](https://yandex.com/support/metrica/en/general/check-counter.md).

E-commerce data appears in Yandex Metrica a few hours after it is first sent. To view e-commerce reports, go to Yandex Metrica and open **Reports** → **E-commerce**.

[E-commerce reports](https://yandex.com/support/metrica/en/data/e-commerce-reports.md)

Data about sessions and pageviews appears in Yandex Metrica when the first website sessions occur after you install the module. To view statistics, go to Yandex Metrica and open **Reports**. For more information about working with reports, see [Setting up and viewing a report](https://yandex.com/support/metrica/en/reports/report-general.md).


## Additional settings {#func}

### How to fill in the “Brand Property” field in the module settings {#brand}

You can send information about the brands in your online store to Yandex Metrica. Based on this data, Yandex Metrica [generates a report](https://yandex.com/support/metrica/en/reports/popular-brands.md) that you can use to determine the most popular brand for customers or find out which brand brings the most profit, among other things.


{% note info %}

1C-Bitrix templates can have several product catalogs. In the Yandex Metrica module settings, only the active directories’ brand properties are displayed. We recommend filling in all the available **Brand Property** fields to ensure data is properly sent to Yandex Metrica.

{% endnote %}


To find a property value:
1. Go to the 1C-Bitrix admin panel.
1. Go to **Content** → **Types of infoblocks** → **Catalogs** and select a catalog.
1. On the right, open the **Features** tab.
1. In the list, find the field for the brand.
1. Specify the name of the field in the “Yandex Metrica” module settings.


### How to transmit information about product views (the detail property) {#detail}

You can send product viewing data to Yandex Metrica so that the E-commerce reports will contain more detailed information. For example, the [Popular items report](https://yandex.com/support/metrica/en/reports/popular-goods.md) is formed in this way.

To configure product view events, you need to make changes to the code in the `element.php` file for the `bitrix:catalog` component template on your website.


{% note alert %}

The path to the `element.php` file may differ in the templates for different websites.

{% endnote %}


1. Log in to the website as an administrator.
1. On the **Website** tab, turn on **Editing mode**.
    
    {% note info %}
    
    If you’ve edited the template before, go to step 6 of this guide.
    
    {% endnote %}
    
1. On the website, open the product card and hover over the catalog component area to open the menu.
1. Click ![](../_assets/bitrix-set-icon.png), select the catalog, and then **Copy the component template**.
1. In the **Copy to the site template** field, select **current** and save the changes.
1. [Find](#found-element) and open the `element.php` file. In the code, find the row that looks like this:
    ```php
    $elementId = $APPLICATION->IncludeComponent('bitrix:catalog.element', 'bootstrap_v4', $componentElementParams,
    $component
    );
    ```
    
    If you don't see `"$elementId = "` before the `bitrix:catalog.element` component, add the variable to the code manually.
    
1. After it, add `$APPLICATION->IncludeComponent("yandex.metrika:detail", "", array("PRODUCT_ID" => $elementId), $component);`.
    Check that the `detail` code uses the same case for variables and functions as the `element.php` file.
    
    {% cut "Code example" %}
    
    ```php
    ...
    $elementId = $APPLICATION->IncludeComponent('bitrix:catalog.element', 'bootstrap_v4', $componentElementParams,
    $component
    );
    $APPLICATION->IncludeComponent("yandex.metrika:detail", "", array("PRODUCT_ID" => $elementId), $component);
    ...
    ```
    
    {% endcut %}
    
1. Click **Save**.


{% cut "How to find the element.php file" %} {#found-element}


1. On the **Website** tab, turn on **Editing mode**.
1. On the website, open the product card and hover over the catalog component area to open the menu.
1. Click ![](../_assets/bitrix-set-icon.png), select the catalog, and then **Edit the component template**.
1. Make sure that the `element.php` file is displayed in the window that opens. The path to the file is specified in the name of the window.


{% endcut %}


After the module is installed and set up, look at the error log. To do this, open the module in the 1C-Bitrix admin panel. You can ask any questions via [the form below](#form) or on the 1C-Bitrix website (in the lower right corner, click **Technical support**).


{% cut "Viewing common errors" %}


- Outdated version of 1C-Bitrix. Check if a new version is available and install it. To do this, open the admin panel and go to **Marketplace** → **Platform update**.
- The brand property you specified is not on the website.
- The tag number contains characters that are not digits.


{% endcut %}



## License agreement {#licens}

Read the [License agreement](https://metrika-cms-plugins.s3.yandex.net/1c-bitrix/LICENSE.txt) for using the “Yandex Metrica” module for 1C-Bitrix.


## Updating the module {#update}

When the module has a new version, a message about it will be displayed in the 1C-Bitrix admin panel. You can install an update in one of the following ways:
- Click the link in the message.
- Select the module on the **Marketplace** → **Solutions installed** page.
- On the page [1C-Bitrix: Marketplace](https://marketplace.1c-bitrix.ru/).
- Download the updated ZIP archive with [UTF8](https://metrika-cms-plugins.s3.yandex.net/1c-bitrix/yandex.metrika.utf8.zip) or [CP1251](https://metrika-cms-plugins.s3.yandex.net/1c-bitrix/yandex.metrika.cp1251.zip) encoding and [follow the instructions for installing the file](#zip).

<!-- source: en/_includes/buttons/chat-button.md -->
[Chat with us](https://yandex.com/chat/#/user/036e6a02-3620-9cdc-4c5e-a34667a7379e?utm_source=spravka){.button}

<!-- source: en/_includes/styles/href-to-button.md -->

<!-- endsource: en/_includes/styles/href-to-button.md -->
<!-- endsource: en/_includes/buttons/chat-button.md -->

<!-- source: en/_includes/support-2.md -->
<div class="cut-button">

{% cut "Write an email" %}

<!-- source: en/_includes/popup/id-popup/wrong-sup.md -->
Please note: Our support team will never initiate a call to you. Do not follow any instructions of people who call you and introduce themselves as the Yandex Metrica support team.
<!-- endsource: en/_includes/popup/id-popup/wrong-sup.md -->

<div style="padding: 15px;
     margin: 10px 0;
     background: #FFFFFF;
     border-radius: 10px;
     border: 1px solid var(--yc-color-line-generic);">
  <iframe style="background: #FFFFFF;"
        height="700"
        width="100%"
        frameborder="0"
        src="https://forms.yandex.com/surveys/10011833/?&iframe=1&lang=en">
  </iframe>
</div>

{% endcut %}

</div>

<!-- source: en/_includes/styles/cut-button.md -->

<!-- endsource: en/_includes/styles/cut-button.md -->
<!-- endsource: en/_includes/support-2.md -->

<!-- source: en/_includes/footer-links.md -->
- - -

<div class="borderless-table">

#|
||
Useful links

- [Demo tag](https://metrica.yandex.com/r/dashboard?)
- [Add a tag](https://metrica.yandex.com/add/)
- [Free tag setup](https://yandex.com/promo/freeservice/metrica?utm_source=help_metrica_en&utm_medium=cpc&utm_campaign=1)
- [Yandex Metrica API](https://tech.yandex.com/metrika/)
- [Suggest your idea](https://yandex.com/support/metrica/troubleshooting/idea.html)
- [Discuss in Telegram](https://t.me/yandexmetrika)
|
Online training

- [Get a Yandex Metrica certificate](https://yandex.ru/adv/expert/exam/metrika/?utm_source=metrika_help&utm_medium=web&utm_campaign=static&utm_content=useful_links)


- [Take a training course](https://yandex.com/adv/edu/online/metrika?utm_source=metrika_help&utm_medium=web&utm_campaign=static&utm_content=useful_links)

||
|#

</div>

<!-- source: en/_includes/styles/table-style.md -->

<!-- endsource: en/_includes/styles/table-style.md -->
<!-- endsource: en/_includes/footer-links.md -->
