document.addEventListener("DOMContentLoaded", function() { const pagePath = window.location.pathname; // Get the path of the current URL const visitorsDiv = document.querySelector('.visitors'); const statsLink = document.getElementById('statsLink'); statsLink.setAttribute('href', `https://stats.bunkr.ru/stats?url=${pagePath}`); fetch(`https://stats.bunkr.ru/slutsCount?pageUrl=${pagePath}`) .then(response => response.json()) .then(data => { visitorsDiv.innerHTML = `${data.count} views`; }); });