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:
- Transmitting e-commerce events:
- Viewing a product profile.
- Adding an item to the basket.
- Removing an item from the basket.
- Making a purchase.
- Providing details of transmitted product data.
Installing and setting up the module
- Getting started
- Step 1. Installing the module
- Step 2. Setting up the module
- Step 3. Checking if data is sent
Getting started
- If you don't have a Yandex Metrica tag yet, create one. 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.
- 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. - Make sure no similar module that installs a Yandex Metrica tag is activated in 1C-Bitrix. To do this, go to the admin panel and open “Yandex Metrica”, “Metrica”, or “Metrika”. If there is one, delete it.and look for a module with the name
Step 1. Installing the module
Go to the 1C-Bitrix admin panel, log in, and add the module using one of the following methods:
- Open “Yandex Metrica”., and find the module with the name
- Click the icon and select Install.
- Go to 1C-Bitrix: Marketplace, and find the module with the name “Yandex Metrica”.
- Open the module and click Install.
- Go to the 1C-Bitrix admin panel on the Content page.
- Selectand open the last page of the module list.
- Clickand select the ZIP archive with the Yandex Metrica module.
- Click Save. The archive will be uploaded to the modules catalog on your server.
- Unpack the archive: find it in the list of modules, click and select Unpack. Make sure the yandex.metrika catalog appeared in the list.
- Open “Yandex Metrica”. Click and select Install., and find the module with the name
Step 2. Setting up the module
- Go to.
- Select the website.
- 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
- By default, the Session Replay option is enabled. It records user sessions so that you can analyze statistics in more detail. If necessary, you can disable Session Replay at any time.
Save your changes.
In addition, to get more detailed statistics about products (for example, which products users view most often), configure the detail event.
Step 3. Checking if data is sent
- For e-commerce data, see Checking e-commerce settings.
- For data about website sessions, see Checking the tag.
E-commerce data appears in Yandex Metrica a few hours after it is first sent. To view the e-commerce reports, in Yandex Metrica, open Learn more about the reports.
.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.
Additional settings
- How to fill in the “Brand Property” field in the module settings
- How to transmit information about product views (the detail property)
How to fill in the “Brand Property” field in the module settings
You can send information about the brands in your online store to Yandex Metrica. Based on this data, in Yandex Metrica a report is generated, which you can use to determine the most popular brand among customers or to find out which brand brings the most profit, for example.
- Go to the 1C-Bitrix admin panel.
- Go toand select the catalog.
- On the right, open the Features tab.
- In the list, find the field for the brand.
- Specify the name of the field in the “Yandex Metrica” module settings.
How to transmit information about product views (the detail property)
You can send product viewing data to Yandex Metrica so that the e-commerce reports will contain more detailed information. For example, the Popular products report is formed in this way.
To set up the events responsible for product viewing, you need to make changes to the element.php file code of the bitrix:catalog component template on your website.
- Log in to the website as an administrator.
- On the Website tab, turn on Editing mode.Note. If you have edited the template before, go to p. 6 of the instructions.
- On the website, open the product card and hover over the area of the catalog component: a menu will appear.
- Click , select the catalog, and then Copy the component template.
- In the Copy to the site template field, select current and save the changes.
- Find and open the element.php file. In the code, find the row that looks like this:
$elementId = $APPLICATION->IncludeComponent('bitrix:catalog.element', 'bootstrap_v4', $componentElementParams, $component );
If before the
bitrix:catalog.element
component you don't see"$elementId = "
, add the variable to the code yourself. - After it, add
$APPLICATION->IncludeComponent("yandex.metrika:detail", "", array("PRODUCT_ID" => $elementId), $component);
.Make sure that the register of variables and function names of the code detail matches the case of the element.php file variables.
Code example... $elementId = $APPLICATION->IncludeComponent('bitrix:catalog.element', 'bootstrap_v4', $componentElementParams, $component ); $APPLICATION->IncludeComponent("yandex.metrika:detail", "", array("PRODUCT_ID" => $elementId), $component); ...
- Click Save.
- On the Website tab, turn on Editing mode.
- On the website, open the product card and hover the cursor over the area of the catalog component: a menu will appear.
- Click , select the catalog, and then Copy the component template.
- 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.
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 or on the 1C-Bitrix website (in the lower right corner, click Technical support).
- Outdated version of 1C-Bitrix. Check if a new version is available and install it. To do this, in the admin panel, go to.
- The brand property you specified is not on the website.
- The tag number contains characters that are not digits.
License agreement
Read the License agreement for using the “Yandex Metrica” module for 1C-Bitrix.
Updating the module
- Click the link in the message.
- Select the module on the page.
- On the page 1C-Bitrix: Marketplace.
- Download the updated ZIP archive with UTF8 or CP1251 encoding and follow the instructions for installing the file.