Back|
C
Cookiestack
Sign inGet started

Yandex Metrica

Last updated: September 8, 2026

Unlike most integrations, you don't add your own Yandex Metrica counter snippet to the site. Metrica's standard snippet runs immediately and unconditionally — there's no reliable way to gate it behind consent from the outside. So Cookiestack initializes the counter from inside the widget itself, only after the visitor grants consent for the "Statistics" category.

Setup

Under the domain's Integrations tab, enable Yandex Metrica and enter the counter number (Counter ID) — the same one from the Metrica interface. Nothing else is needed: no Metrica <script>, no noscript pixel.

How it works

  • if the visitor rejects "Statistics", the counter never loads at all;
  • if the visitor accepts "Statistics" (fully, or via "Customize"), the widget loads mc.yandex.ru/metrika/tag.js itself and calls ym(counterId, "init", …);
  • if consent is withdrawn on a later visit, the counter isn't initialized again.

If you have other Yandex scripts on the site (e.g. a Yandex Direct pixel) that also need to be gated behind consent, use the generic data-cookie-category mechanism described in JavaScript API.

Yandex Metrica Integration