(function () { 'use strict'; var METRIKA_ID = 102277183; function goal(n, p) { try { if (typeof window.ym === 'function') window.ym(METRIKA_ID, 'reachGoal', n, p || {}); } catch (e) {} } document.addEventListener('click', function (e) { var el = e.target; if (!el || !el.closest || !el.closest('.donate-submit')) return; goal('donate_click'); }, true); function wrap() { if (!window.cp || !window.cp.CloudPayments) return false; var CP = window.cp.CloudPayments; if (CP.__metrikaWrapped) return true; var proto = CP.prototype; ['charge', 'auth', 'pay'].forEach(function (m) { if (typeof proto[m] !== 'function') return; var orig = proto[m]; proto[m] = function (options, onSuccess, onFail) { options = options || {}; var d = options.data || {}; var monthly = !!(d.monthly || (d.CloudPayments && d.CloudPayments.recurrent) || /регулярн|ежемесячн/i.test(options.description || '')); if (options.amount) goal('donate_widget', { amount: options.amount }); var prevOk = typeof onSuccess === 'function' ? onSuccess : options.onSuccess; var prevFail = typeof onFail === 'function' ? onFail : options.onFail; options.onSuccess = function (resp) { goal('donate_success', { amount: options.amount, monthly: monthly ? 'yes' : 'no' }); if (monthly) goal('donate_monthly', { amount: options.amount }); if (typeof prevOk === 'function') prevOk(resp); }; options.onFail = function (reason, opts) { goal('donate_fail', { reason: String(reason) }); if (typeof prevFail === 'function') prevFail(reason, opts); }; return orig.call(this, options, options.onSuccess, options.onFail); }; }); CP.__metrikaWrapped = true; return true; } var n = 0, timer = setInterval(function () { if (wrap() || ++n > 60) clearInterval(timer); }, 250); })();
Содержание курса
«Серьёзный разговор»
