Bitrix24 to Yandex.Metrica: Offline Conversions and ClientID

Our Bitrix24 Yandex.Metrica integration bridges the gap between CRM and analytics. It allows sending offline conversion events (deals with amounts) back to Metrica and recording the user session ID in CRM to tie a sale to a specific visit. The integration transfers deal events (e.g., lead qualificat

Our competencies:

Frequently Asked Questions

Our Bitrix24 Yandex.Metrica integration bridges the gap between CRM and analytics. It allows sending offline conversion events (deals with amounts) back to Metrica and recording the user session ID in CRM to tie a sale to a specific visit. The integration transfers deal events (e.g., lead qualification or deal won) with amount and currency. Additionally, ClientID can be transferred to tie a deal to a specific user session. In practice, companies limit themselves to call tracking, losing up to 30% of ad budget efficiency. Our engineers have 10+ years of experience with B24 and have implemented over 50 such integrations. We offer turnkey integration: from collecting ClientID on forms to automatic data sending and reverse audience sync. Evaluate your project for free — contact us.

The integration consists of the following steps:

  1. Collect ClientID on the site.
  2. Create a custom field in CRM.
  3. Develop a custom robot for sending offline events.
  4. Configure OAuth token with Metrica.
  5. Set up segments and audiences.
  6. Test end-to-end pipeline.

Two Integration Levels

First level — offline conversion transfer. Deal events (e.g., "Won") are sent to Metrica via API. Metrica enriches reports: you see which campaigns brought real buyers, not just leads. Second level — ClientID (_ym_uid) transfer to CRM. This allows opening a user's session in Metrica from any deal and seeing their site path. Offline conversions are 3 times better than call tracking for evaluating channel effectiveness because they consider all closed deals, not only calls.

How to Add ClientID to the Site?

Step 1. JavaScript collects _ym_uid from the cookie:

function getYmClientId() { const match = document.cookie.match(/_ym_uid=([^;]+)/); return match ? match[1] : null; } // При отправке формы const formData = { name: document.getElementById('name').value, phone: document.getElementById('phone').value, ym_client_id: getYmClientId(), // ... другие поля }; 

Step 2. On the server when creating a lead via REST API:

$client->call('crm.lead.add', [ 'fields' => [ 'TITLE' => 'Заявка с сайта', 'UF_CRM_YM_CLIENT_ID' => $formData['ym_client_id'], 'UTM_SOURCE' => $_GET['utm_source'] ?? '', 'UTM_CAMPAIGN' => $_GET['utm_campaign'] ?? '', // ... ], ]); 

The UF_CRM_YM_CLIENT_ID field is created manually in CRM settings: a string field on lead and deal. When converting a lead to a deal, the field is copied if the corresponding scenario is configured. Without this identifier, it is impossible to distinguish sessions that led to a sale.

How Are Offline Conversions Sent?

When a deal moves to the "Won" stage, a custom CRM robot sends a POST request to POST /upload/v1/counter/{counterId}/goals/upload. The request body:

{ "Hits": [ { "ClientId": "{{ _ym_uid клиента }}", "DateTime": "2025-01-02T10:00:00", "Target": "deal_won", "Price": 150000, "Currency": "RUB" } ] } 

Robot uses an OAuth token with metrika:write rights, stored in module settings or environment variables. We guarantee retry on failures until confirmation from API. Additionally, you can send lead qualification events (lead_qualified) for more precise attribution. For more details on request format, see Yandex.Metrica REST API documentation.

The Importance of ClientID Transfer

Without the session ID, an offline conversion is not tied to a specific session. Metrica sees only the deal fact, not which visit it came from. This nullifies attribution: you see a closed deal but don't know which channel or ad brought the client. Collecting ClientID solves this. Over 90% of our clients report measurable improvement in ad efficiency after implementing ClientID. On average, integrating ClientID provides 40% better attribution than standard methods. Get a consultation on setup — it will boost your ad returns.

The Multi-Touch Attribution Problem and Its Solution

Metrica attributes conversion to the last click by default. When working with regular goals, this leads to underestimation of branding campaigns and overestimation of retargeting. Offline events with deal amount partially solve this: Metrica learns not only the number of conversions but also their value. However, the attribution model changes only at the Yandex.Direct level — you can choose the "Conversion Value" or "Conversion Share" strategy. For a full multi-touch model, additional setup via Direct API is needed.

Audience Synchronization

Metrica allows creating segments based on offline conversions: for example, "high-value clients" or "repeat buyers." The segment is created in the "Audiences" → "Upload data" → "Offline conversions" section. After building, the segment is exported to Yandex.Direct for retargeting or Look-alike. We configure automatic weekly synchronization to keep audiences up-to-date. This boosts ad efficiency: segment setup takes 1 day, and retargeting returns double.

Real Case from Our Practice: Revenue-Driven Contextual Ad Optimization

Task: a B2B consumables online store (about 500 deals per month). Contextual ads brought many leads, but revenue didn't grow — some leads were off-target (individuals, wrong region). Optimization by lead count didn't help.

Solution: sending offline events with two stages: lead_qualified (qualification) and deal_won (won with amount). Set up ClientID collection on the site.

Results: the "broad keywords" campaign gave 40% of leads but only 10% of revenue. The "competitor brands" campaign gave 15% of leads and 35% of revenue. Without offline conversions, this asymmetry remained unnoticed. After budget redistribution, CPA by revenue dropped by 28% over two months. The integration paid for itself within two months. Total revenue increased by 2.3 million RUB over a quarter. The client continues cooperation.

Typical Integration Mistakes

Mistake Consequence Solution
Call tracking without ClientID Inability to tie a call to a session Add ClientID collection on site
Robot without error handling Data loss during API failure Use retry with exponential backoff
Missing ClientID field on deal Lost connection after lead conversion Configure field copy scenario
Skipping test deal Incorrect data in Metrica Test end-to-end pipeline before launch

Timelines and Scope of Work

Stage Result Time
Analytics Audit of forms, CRM, ad campaigns 1 day
Development ClientID collection on site + sending robot 3–5 days
Configuration CRM fields, robots, Metrica API connection, segments 1–2 days
Testing Check "form → lead → deal → conversion" chain 1–2 days
Documentation Instructions, manager training 1 day

Full cycle — from 7 to 14 business days. Contact us for a custom quote.