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 an item 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
-
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. 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
Go to the 1C-Bitrix admin panel, log in, and add the module using one of the following methods:
Through the admin panel
- Open Marketplace → Solutions installed and find the module named “Yandex Metrica”.
- Click the icon and select Install now.
Via 1C-Bitrix: Marketplace
- Go to 1C-Bitrix: Marketplace, and find the module with the name "Yandex Metrica".
- Open the module and click Install.
Using a ZIP archive
- Download the installation ZIP archive with UTF8 or CP1251 encoding.
- Go to the 1C-Bitrix admin panel on the Content page.
- Select the Files and folders → bitrix → modules section and open the last page of the module list.
- Click Upload → Add file and 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 that the
yandex.metrika
catalog appears in the list. - Open Marketplace → Solutions installed and find the module named “Yandex Metrica”. Click
and select Install.
Step 2. Set up the module
- Go to Settings → Product settings → Module settings → Yandex Metrica.
- 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 the changes.
Tip
The Brand Property field is not obligatory. Fill it in 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.
Step 3. Check if data is sent
To check if data is sent to Yandex Metrica:
- 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 e-commerce reports, go to Yandex Metrica and open Reports → E-commerce. 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
You can send information about the brands in your online store to Yandex Metrica. Based on this data, Yandex Metrica generates a report 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
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.
To find a property value:
- Go to the 1C-Bitrix admin panel.
- Go to Content → Types of infoblocks → Catalogs and select a 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 items report 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.
Alert
The path to the element.php
file may differ in the templates for different websites.
-
Log in to the website as an administrator.
-
On the Website tab, turn on Editing mode.
Note
If you’ve edited the template before, go to step 6 of this guide.
-
On the website, open the product card and hover over the catalog component area to open the menu.
-
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 you don't see
"$elementId = "
before thebitrix:catalog.element
component, add the variable to the code manually. -
After it, add
$APPLICATION->IncludeComponent("yandex.metrika:detail", "", array("PRODUCT_ID" => $elementId), $component);
.
Check that thedetail
code uses the same case for variables and functions as theelement.php
file.Code example
... $elementId = $APPLICATION->IncludeComponent('bitrix:catalog.element', 'bootstrap_v4', $componentElementParams, $component ); $APPLICATION->IncludeComponent("yandex.metrika:detail", "", array("PRODUCT_ID" => $elementId), $component); ...
-
Click Save.
How to find the element.php file
- On the Website tab, turn on Editing mode.
- On the website, open the product card and hover over the catalog component area to open the menu.
- Click
, select the catalog, and then Edit 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).
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.
License agreement
Read the License agreement for using the “Yandex Metrica” module for 1C-Bitrix.
Updating the module
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.
- Download the updated ZIP archive with UTF8 or CP1251 encoding and follow the instructions for installing the file.
Useful links |
Online training |