Refactor: replace custom counter with Yandex.Metrika

This commit is contained in:
2026-06-15 21:29:03 +03:00
parent a0e0afd92f
commit 241e46c40b
+24 -25
View File
@@ -15,6 +15,21 @@
</head>
<body class="antialiased relative selection:bg-cyber-purple selection:text-white">
<!-- Yandex.Metrika counter -->
<script type="text/javascript">
(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();
for (var j = 0; j < document.scripts.length; j++) {if (document.scripts[j].src === r) { return; }}
k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)
})(window, document,'script','https://mc.yandex.ru/metrika/tag.js?id=109871645', 'ym');
ym(109871645, 'init', {ssr:true, webvisor:true, clickmap:true, ecommerce:"dataLayer", referrer: document.referrer, url: location.href, accurateTrackBounce:true, trackLinks:true});
</script>
<noscript><div><img src="https://mc.yandex.ru/watch/109871645" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
<!-- /Yandex.Metrika counter -->
<!-- Overlay с шумом -->
<div class="noise-bg"></div>
@@ -1346,12 +1361,16 @@
<span>© 2025 ИКП. Все права защищены.</span>
<span class="hidden sm:inline">|</span>
<span class="text-gray-700">GL HF</span>
<!-- Yandex.Metrika informer -->
<span class="hidden sm:inline">|</span>
<!-- Счётчик посещений -->
<div class="inline-flex items-center gap-2 px-3 py-1 bg-cyber-blue/10 border border-cyber-blue/30 text-[10px] font-mono text-cyber-blue uppercase tracking-widest clip-path-polygon backdrop-blur-sm">
<span class="w-1.5 h-1.5 bg-cyber-blue rounded-full animate-pulse shadow-[0_0_10px_#3b82f6]"></span>
<span>Визиты: <strong id="visit-counter-val" class="font-black text-white">0</strong></span>
</div>
<a href="https://metrika.yandex.ru/stat/?id=109871645&amp;from=informer" target="_blank" rel="nofollow">
<img src="https://informer.yandex.ru/informer/109871645/3_0_202020FF_000000FF_1_pageviews"
style="width:88px; height:31px; border:0;"
alt="Яндекс.Метрика"
title="Яндекс.Метрика: данные за сегодня (просмотры, визиты и уникальные посетители)"
/>
</a>
<!-- /Yandex.Metrika informer -->
</div>
</footer>
@@ -1500,26 +1519,6 @@
window.addEventListener('resize', updateVacanciesCarousel);
}
// Счётчик посещений (Hybrid Local + Remote API)
const counterVal = document.getElementById('visit-counter-val');
if (counterVal) {
let localVisits = parseInt(localStorage.getItem('ikp_visits') || '0', 10);
localVisits += 1;
localStorage.setItem('ikp_visits', localVisits);
counterVal.textContent = localVisits;
fetch('https://api.counterapi.dev/v1/zaglushka_ikp/visits/increment')
.then(response => response.json())
.then(data => {
if (data && data.value) {
counterVal.textContent = data.value;
}
})
.catch(err => {
console.warn("CounterAPI error, falling back to localStorage:", err);
});
}
});
</script>
</body>