How to enable Yandex.Metrica?

In the widget event processing code, add the code for sending data to Yandex.Metrica. You will get something like this just after your widget code:
window.bukzaCallbackFor[Widget Container ID] = function(payload){
        //other handlers
        case 'ORDER_COMPLETED':
            ym([Counter ID], 'reachGoal', '[ID of your goal]',
                currency: "RUB"
In this case, the initialization code of the Yandex.Metrica counter should already be added to the page with the widget. More information about sending data to the Yandex.Metrica read here.
If you insert code inside a widget, use something like this:
[Yandex.Metrica initialization code]
window.addEventListener('message', function (e) {
 if (e && e.origin
      && e.origin.indexOf('') !== -1)
   var message = JSON.parse(;
   switch (message.event) {
       //other handlers
       case 'ORDER_COMPLETED':
           ym([Counter ID],'reachGoal', '[ID of your goal]',
               currency: "USD"
   }, false);
Didn't find the answer to your question?
Feel free to ask it at