slYaGoals=function (targetName) {
if(!targetName) { console.error('slYaGoals: Ошибка - не указана цель'); return false};
if(typeof Ya != 'object') { console.error('slYaGoals: Ошибка - не найден счетчик'); return false};
if(typeof ym != 'function') { console.error('slYaGoals: Ошибка - не найдена функция "ym"'); return false};
let counters=Ya.Metrika2.counters();
counters.forEach( counter => {
ym(counter.id,'reachGoal',targetName);
console.info('slYaGoals: Счетчик ['+counter.id+'] - Цель "'+targetName+'" достигнута.')
});
};
// Скопирован адрес в шапке
// $('.header-top .address').bind({
// copy : function(){
// slYaGoals('copy_header_address');
// },
// });
// $(document).on("copy",'.information-contact address',function(){
// slYaGoals('copy_address');
// });