Skip to content

Commit

Permalink
Update metric
Browse files Browse the repository at this point in the history
  • Loading branch information
v1ack committed Mar 31, 2021
1 parent d29b84d commit 4140e4f
Showing 1 changed file with 22 additions and 58 deletions.
80 changes: 22 additions & 58 deletions assets/metrika.js
Original file line number Diff line number Diff line change
@@ -1,62 +1,26 @@
(function (d, w, c) {
(w[c] = w[c] || []).push(function () {
try {
w.yaCounter46845507 = new Ya.Metrika2({
id: 46845507,
clickmap: true,
trackLinks: true,
accurateTrackBounce: true,
webvisor: true
});
} catch (e) {}
});
function install_metric(alt = false) {
let link = alt ? "https://cdn.jsdelivr.net/npm/yandex-metrica-watch/tag.js" : "https://mc.yandex.ru/metrika/tag.js";

var n = d.getElementsByTagName("script")[0],
s = d.createElement("script"),
f = function () {
n.parentNode.insertBefore(s, n);
};
s.type = "text/javascript";
s.async = true;
s.src = "https://mc.yandex.ru/metrika/tag.js";
(function (m, e, t, r, i, k, a) {
m[i] = m[i] || function () {
(m[i].a = m[i].a || []).push(arguments)
}
m[i].l = 1 * new Date()
k = e.createElement(t), a = e.getElementsByTagName(t)[0], k.async = 1, k.src = r, a.parentNode.insertBefore(k, a)
})
(window, document, "script", link, "ym")

if (w.opera == "[object Opera]") {
d.addEventListener("DOMContentLoaded", f, false);
} else {
f();
}
})(document, window, "yandex_metrika_callbacks2");

function altMetrika() {
if (typeof Ya == 'undefined') {
(function (d, w, c) {
(w[c] = w[c] || []).push(function () {
try {
w.yaCounter46845507 = new Ya.Metrika2({
id: 46845507,
clickmap: true,
trackLinks: true,
accurateTrackBounce: true,
webvisor: true
});
} catch (e) {}
});
ym(74988706, "init", {
clickmap: true,
trackLinks: true,
accurateTrackBounce: true,
webvisor: true,
})
}

var n = d.getElementsByTagName("script")[0],
s = d.createElement("script"),
f = function () {
n.parentNode.insertBefore(s, n);
};
s.type = "text/javascript";
s.async = true;
s.src = "https://cdn.jsdelivr.net/npm/yandex-metrica-watch/tag.js";

if (w.opera == "[object Opera]") {
d.addEventListener("DOMContentLoaded", f, false);
} else {
f();
}
})(document, window, "yandex_metrika_callbacks2");
}
}
setTimeout(altMetrika, 10000);
install_metric()
setTimeout(function () {
if (typeof Ya === "undefined")
install_metric(true)
}, 10000)

0 comments on commit 4140e4f

Please sign in to comment.