Setting Up Yandex.Metrica Goals on 1C-Bitrix
Metrica offers two types of goals: JavaScript events (you call ym(id, 'reachGoal', 'target') yourself) and auto-goals (button clicks, form submissions, link clicks — Metrica detects these automatically). Auto-goals are unreliable on 1C-Bitrix sites with AJAX components: Metrica does not always see dynamically rendered elements. For accurate conversion tracking, JavaScript goals must be configured manually.
Counter ID and goal triggering
The Metrica counter code contains ym(XXXXXXXX, 'init', {...}). After initialization, a goal is reached by calling:
ym(XXXXXXXX, 'reachGoal', 'IDENTIFIER');
The identifier (IDENTIFIER) is defined in the Metrica interface when creating a goal, with type "JavaScript event".
Connecting to 1C-Bitrix events
Order placement. The sale.order.ajax component fires BX.onCustomEvent('OnSaleOrderComplete', ...) after a successful order creation. Intercept it:
BX.addCustomEvent(document, 'OnSaleOrderComplete', function(data) {
ym(XXXXXXXX, 'reachGoal', 'ORDER_COMPLETE', {
order_id: data.ORDER_ID,
order_price: data.PRICE
});
});
Feedback forms (bitrix:main.feedback, web forms from the form module):
BX.addCustomEvent('onWebFormSuccess', function(form) {
ym(XXXXXXXX, 'reachGoal', 'FORM_SUBMIT');
});
For the older bitrix:form.result.new component, the submission event is a form submit on elements with class .bx-form, handled via event delegation on document.
Add to cart — the catalog.element component fires BX.onCustomEvent('OnSuccessAdd2Basket', ...) when the button is clicked:
BX.addCustomEvent('OnSuccessAdd2Basket', function(item) {
ym(XXXXXXXX, 'reachGoal', 'ADD_TO_CART');
});
Composite goals
Metrica supports composite goals — a chain of steps. For the checkout funnel, 3–4 steps are configured:
| Step | Identifier | Event in 1C-Bitrix |
|---|---|---|
| 1. Cart | BASKET_VIEW |
Visit to /basket/ |
| 2. Checkout | CHECKOUT_START |
Click "Place order" |
| 3. Payment | PAYMENT_SELECT |
Payment method selection |
| 4. Order complete | ORDER_COMPLETE |
OnSaleOrderComplete |
The first two steps can be covered by a URL condition in the Metrica interface (goal type "Page visits"), steps 3 and 4 — only via JavaScript.
Verifying goal firing
In the Metrica interface: Debug → Check data submission — shows events in real time. In the browser, check the Network tab for a request to mc.yandex.ru/watch/ with the parameter rn=reachGoal....
What we configure
- Goals by type: order, form, cart, phone number click
- Integration with 1C-Bitrix AJAX component events via
BX.addCustomEvent - Composite goal for the checkout funnel
- Visit parameter passing for segmentation (UTM, device type)

