2 Commits

Author SHA1 Message Date
846c066314 add: счетчик google.analytic
All checks were successful
Build ETPGRF-site / build (push) Successful in 1m27s
2026-01-24 13:48:50 +03:00
d74bee2fc0 add: только текст от логотипов
All checks were successful
Build ETPGRF-site / build (push) Successful in 1m26s
2026-01-24 12:49:55 +03:00
4 changed files with 26 additions and 5 deletions

View File

@@ -70,7 +70,7 @@
{# Футер #}<footer class="footer mt-auto py-2 mt-4">
<div class="container d-flex justify-content-between align-items-center">
<span class="text-muted small nowrap me-2">&copy; Sergei Erjemin, 2025&ndash;{% now 'Y' %}.</span>
<nobr class="text-muted small mx-2"><i class="bi bi-tags me-1" title="Версия библиотеки etpgrf / Версия сайта"></i>v0.1.3 / v0.1.6
<nobr class="text-muted small mx-2"><i class="bi bi-tags me-1" title="Версия библиотеки etpgrf / Версия сайта"></i>v0.1.3 / v0.1.8
</nobr>
{# Сводная статистика (HTMX) #}<span class="text-muted small ms-2" hx-get="{% url 'stats_summary' %}" hx-trigger="load">
...

View File

@@ -14,7 +14,6 @@
// Слушать изменения
darkModeMediaQuery.addEventListener('change', updateTheme);
// --- ЛОГОТИП И СКРОЛЛ ---
function updateLogo() {
const navbar = document.getElementById('logo');
@@ -30,17 +29,15 @@
}
}
// Инициализация логотипа при загрузке и скролле
// document.addEventListener('DOMContentLoaded', updateLogo);
window.addEventListener('scroll', updateLogo, { passive: true });
// --- КУКИ И СЧЕТЧИКИ ---
const COOKIE_KEY = 'cookie_consent';
const TTL_MS = 90 * 24 * 60 * 60 * 1000; // 90 дней
const MAILRU_ID = "3734603";
const YANDEX_ID = "106310834";
const GOOGLE_ID = "G-03WY2S9FXB";
function loadCounters() {
// console.log("Загрузка счетчиков...");
@@ -67,6 +64,22 @@
trackLinks:true,
accurateTrackBounce:true
});
// Google Analytics
(function() {
var script = document.createElement('script');
script.async = true;
script.src = 'https://www.googletagmanager.com/gtag/js?id=' + GOOGLE_ID;
document.head.appendChild(script);
})();
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
// Делаем gtag глобальной, чтобы вызывать из sendGoal
window.gtag = gtag;
gtag('js', new Date());
gtag('config', GOOGLE_ID);
} catch (e) {
console.error("Ошибка загрузки счетчиков:", e);
}
@@ -115,12 +128,18 @@
// console.log("Sending goal:", goalName);
try {
// Mail.ru
if (window._tmr) {
window._tmr.push({ id: MAILRU_ID, type: "reachGoal", goal: goalName, value: 1 });
}
// Яндекс.Метрика
if (typeof window.ym === 'function') {
window.ym(YANDEX_ID, 'reachGoal', goalName);
}
// Google Analytics
if (typeof window.gtag === 'function') {
window.gtag('event', goalName);
}
} catch (e) {
console.error("Ошибка отправки цели:", e);
}

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 45 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 45 KiB