S
S
sadieff2016-05-23 16:34:54
JavaScript
sadieff, 2016-05-23 16:34:54

Why does the target code for Yandex Metrica prevent the code from executing further?

Good day. I set the goal for the Yandex metric. Event - a successful order followed by a redirect. Before the redirect, I insert the metric code. In the metric, it shows that the target is reached, but the redirect does not occur, in addition:

else if (response.data['msorder']) {
            
            console.log('in');
            yaCounter35933265.reachGoal('ORDER'); return true; // отправляем в метрику
            console.log('out');
          document.location.href = /\?/.test(document.location.href)
            ? document.location.href + '&msorder=' + response.data['msorder']
            : document.location.href + '?msorder=' + response.data['msorder'];
        }

Returns "in" to the console, but out does not. Does everything stop on sending to the metric? what could be the reason for this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nicholas, 2016-05-23
@sadieff

You return true;wrote there. Of course, after that, the function returns!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question