Yandex.Metrica is a web analytics platform that lets you get an in-depth understanding of your audience's behavior and use the insights to drive business growth.
Getting started
RudderStack supports sending events to Yandex.Metrica via the following connection modes:
| Connection Mode | Web | Mobile | Server | 
|---|---|---|---|
| Device mode | Supported | - | - | 
| Cloud mode | - | - | - | 
Once you have confirmed that the source platform supports sending events to Yandex.Metrica, follow these steps:
- From your RudderStack dashboard, add the source. Then, from the list of destinations, select Yandex.Metrica.
 - Assign a name to your destination and click Continue.
 
Connection settings
To successfully set up Yandex.Metrica as a destination, you need to configure the following settings:
- Tag ID: Enter your Yandex.Metrica tag ID.
 - Enable Clickmap: Enable this setting to collect data for click mapping.
 - Enable Tracklinks: Enable this setting to track user clicks on the outbound links.
 - Enable Accurate Track Bounce: This setting enables the accurate bounce rate with a non-bounce event that is registered after 15 seconds (15000 ms). For more information on this setting, refer to the Yandex.Metrica documentation.
 - Enable WebVisor: Enable this setting to use Yandex.Metrica's sesssion replay feature.
 - Container name: Enter the name of your Yandex.Metrica ecommerce data container that you set while creating a new counter. If not specified, RudderStack sets it to 
dataLayerby default. - Map your event name with supported Yandex.Metrica event name: Use this setting to map the RudderStack event to the Yandex.Metrica event selected from the dropdown.
 - Goal ID: Enter your Yandex.Metrica goal ID.
 - Client-side Events Filtering: This setting lets you specify which events should be blocked or allowed to flow through to Yandex.Metrica. For more information on this setting, refer to the Client-side Events Filtering guide.
 - Use device mode to send events: As this is a web device mode-only destination, this setting is enabled by default and cannot be disabled.
 - OneTrust Cookie Categories: This setting lets you associate OneTrust cookie consent groups to Yandex.Metrica.
 
Identify
You can use the identify call to identify a user in Yandex.Metrica. If a contact already exists, RudderStack updates the contact details.
A sample identify call is shown below:
rudderanalytics.identify('1hKOmRA4el9Z', {      firstName: 'Alex',      lastName: 'Keener',      email: "alex@example.com"    }RudderStack uses Yandex.Metrica's setUserID method to associate the userId with the user's client ID during a particular session. To update the information of a user with a specfic userId, RudderStack uses the userParams method.
Supported mappings
The following table lists the mappings between the RudderStack attributes and the Yandex.Metrica properties:
| RudderStack property | Yandex.Metrica property | 
|---|---|
userId anonymousId Required  | UserID | 
Track
You can use the track call to send your ecommerce events to Yandex.Metrica.
A sample track call is shown below:
rudderanalytics.track("Order Completed", {  order_id: "34897497",  coupon: "BB20",  currency: "INR",  products: [{      product_id: "43521",      currency: "INR",      name: "Rudder Bag",      price: 3700.99,      brand: "Nice",      category: "Bags",      quantity: 3,    },    {      product_id: "37333",      currency: "INR",      name: "RudderStack T-shirt",      price: 1651.55,      brand: "Adidas",      category: "Bags",      quantity: 3,    },  ],});Event mapping
The following table lists the default mappings between the RudderStack events and the Yandex.Metrica events:
| RudderStack property | Yandex.Metrica property | Description | 
|---|---|---|
Product Viewed | detail | View the full description of the product. | 
Product List Viewed | detail | View the full description of the product list. | 
Product Added | add | Add an item to the basket. | 
Product Removed | remove | Remove an item from the basket. | 
Order Completed | purchase | Complete the product purchase. | 
You can also map any other event to the above Yandex.Metrica events via the dashboard settings.
Supported property mappings
The following table lists the properties mapping for Yandex.Metrica's detail, add, and remove events:
| RudderStack property | Yandex.Metrica property | 
|---|---|
properties.product_id properties.sku properties.products[index].product_id properties.products[index].sku Required, if name is not present.  | id | 
properties.name properties.products[index].name Required, if product_id/sku is not present.  | name | 
properties.brand properties.products[index].brand | brand | 
properties.category properties.products[index].category | category | 
properties.coupon properties.products[index].coupon | coupon | 
properties.position properties.products[index].position | position | 
properties.price properties.products[index].price | price | 
properties.quantity properties.products[index].quantity | quantity | 
properties.variant properties.products[index].variant | variant | 
The following mappings are applicable only for the purchase event:
| RudderStack property | Yandex.Metrica property | 
|---|---|
properties.order_id Required  | id | 
properties.revenue | revenue | 
Page
You can use the page call to send all the page view data to Yandex.Metrica.
A sample page call is shown below:
rudderanalytics.page(  "Cart",  "Cart Viewed", {    referrer: "https://www.mysite.com/search?q=bestseller",    title: "The best seller items",    url: "https://www.mysite.com/bestseller/1"  });RudderStack uses Yandex.Metrica's hit method to send all the page view data.
Supported mappings
The following table lists the mappings between the RudderStack attributes and the Yandex.Metrica properties:
| RudderStack property | Yandex.Metrica property | 
|---|---|
context.page.url Required  | url | 
context.page.title | title | 
context.page.referrer | referer | 
FAQ
What is the Yandex.Metrica container name? Where can I find it?
You can set your Yandex.Metrica data container name while setting up your counter for your website, as shown:
    Where can I find my Yandex.Metrica tag ID?
To obtain your Yandex.Metrica tag ID, follow these steps:
- Log into your Yandex.Metrica dashboard.
 - From the left sidebar, click Visitors. You can see the tag ID listed in the dashboard as well as in the URL, as shown:
 
    Where can I find my Yandex.Metrica goal ID?
To obtain your Yandex.Metrica tag ID, follow these steps:
- Log into your Yandex.Metrica dashboard.
 - From the left sidebar, click Goals. You can see the goal ID listed in the dashboard against your created targets/goals, as shown:
 
    Contact us
For more information on the topics covered on this page, email us or start a conversation in our Slack community.