var _mj_domain = 'https://api2.ma.ru'; var version = Number('0'); function _mj(ac, dm) { var data = { data: dm, action: ac, data_id: window.mj_data_id, yandex_client_id: mgyci(), google_client_id: mggci(), mj_token: mgtci(), }; var c = "onload" in new XMLHttpRequest ? XMLHttpRequest : XDomainRequest, d = new c; d.open("POST", _mj_domain + "/api/analytics/set/action/", !0), d.withCredentials = !0, d.setRequestHeader("Content-Type", "application/json; charset=utf-8"), d.send(JSON.stringify(data)), d.onload = function () { var a = JSON.parse(this.responseText); console.log(a); }, d.onerror = function () { return console.log("\u041E\u0448\u0438\u0431\u043A\u0430 " + this.status), !1 } } function mgc(a) { const b = `; ${document.cookie}`, c = b.split(`; ${a}=`); if (2 === c.length) return c.pop().split(";").shift() } function mggci() { return mgc("_ga") } function mgtci() { return mgc("_mj_token") } function mgyci() { return mgc("_ym_uid") } function __mgr() { var a = document.referrer, b = mgc("_mj_referrer"), c = a.search(window.location.hostname); return -1 === c && "" !== a ? document.cookie = "_mj_referrer=" + a + ";path=/;max-age=2592000" : ("undefined" == typeof b || "" === a) && (document.cookie = "_mj_referrer=direct;path=/;max-age=2592000"), mgc("_mj_referrer") } function sD() { const qS = window.location.search, uP = new URLSearchParams(qS); var p = { site: window.location.hostname, site_url: window.location.pathname, referrer_site: __mgr(), utm_medium: uP.get("utm_medium"), utm_source: uP.get("utm_source"), utm_campaign: uP.get("utm_campaign"), utm_term: uP.get("utm_term"), utm_content: uP.get("utm_content"), yandex_client_id: mgyci(), google_client_id: mggci(), mj_token: mgtci(), new_version: version }; mxc(_mj_domain + "/api/analytics/set/", p); return true; function mxc(a, b) { var c = "onload" in new XMLHttpRequest ? XMLHttpRequest : XDomainRequest, d = new c; d.open("POST", a, !0), d.withCredentials = !0, d.setRequestHeader("Content-Type", "application/json; charset=utf-8"), d.send(JSON.stringify(b)), d.onload = function () { var a = JSON.parse(this.responseText); window.mj_data_id = a && a.id; if(mgtci()) return; var token = version ? a.token : a; document.cookie = "_mj_token=" + token + ";path=/" }, d.onerror = function () { return console.log("\u041E\u0448\u0438\u0431\u043A\u0430 " + this.status), !1 } } } if (!sD()) { setTimeout(sD, 2000); }