Приветствую, не работает почему то цели в метрике на отправку форм. Есть ли ошибка в коде?
jQuery('.wpcf7').on('wpcf7mailsent', function(event) {
var id = event.detail.contactFormId;
jQuery.magnificPopup.close();
if(id == 96 || id == 97) {
jQuery.magnificPopup.open({
midClick: true,
items: {
src: '#success',
type: 'inline'
}
})
} else if(id == 1434) {
jQuery.magnificPopup.open({
midClick: true,
items: {
src: '#success_okk',
type: 'inline'
}
});
}
else if(id == 525) {
jQuery.magnificPopup.open({
midClick: true,
items: {
src: '#success_otz',
type: 'inline'
}
});
}
else if(id == 2587) {
jQuery.magnificPopup.open({
midClick: true,
items: {
src: '#success_nalog',
type: 'inline'
}
});
};
var ym_targets = {
'96': 'house_call',
'97': 'priem'
},
YaId = xxxxxx;
console.log(event + "test forms");
if(event.originalEvent.detail.contactFormId in ym_targets && 'yaCounter' + YaId in window) {
window['yaCounter' + YaId].reachGoal(ym_targets[event.originalEvent.detail.contactFormId]);
console.log("Событие яндекс метрики: " + ym_targets[event.originalEvent.detail.contactFormId]);
}
});
Там где xxx номер счетчика.
В консоле ошибок нет, при проверке через все корректно /?_ym_debug=1
Работает только форма 96, а форма 97 почему то не засчитывается...
Сайт virilismed.ru