From 4a2ce434f46bde4fa5d4b404b74f0302aa8bb860 Mon Sep 17 00:00:00 2001 From: hehh Date: Tue, 25 Nov 2025 17:14:29 +0800 Subject: [PATCH] =?UTF-8?q?feat(analytics):=20=E9=87=8D=E6=9E=84=E7=BD=91?= =?UTF-8?q?=E7=AB=99=E7=BB=9F=E8=AE=A1=E9=85=8D=E7=BD=AE=E4=B8=8E=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 引入 SiteConfig.analytics 统一管理所有统计配置 - 动态加载不蒜子、百度、Google Analytics 和 51.LA 统计脚本 - 优化统计脚本异步加载方式,提升页面性能 - 移除硬编码统计 ID,改为从配置文件读取 - 更新百度统计集成方式,增强错误处理 - 调整 Google Analytics 加载逻辑,支持异步初始化 - 修复统计元素获取逻辑,使用配置化的 ID 选择器 - 清理冗余代码,统一统计脚本加载风格 --- about.html | 21 ++++-- index.html | 208 ++++++++++++++++++++++++++++++--------------------- js/config.js | 23 ++++++ 3 files changed, 158 insertions(+), 94 deletions(-) diff --git a/about.html b/about.html index d29412f..c98c0e7 100644 --- a/about.html +++ b/about.html @@ -326,12 +326,19 @@ - - - + + @@ -329,55 +343,75 @@ + + - - - - - - - - + - - - - - - \ No newline at end of file + + diff --git a/js/config.js b/js/config.js index 1393dba..5a05afc 100644 --- a/js/config.js +++ b/js/config.js @@ -130,6 +130,29 @@ const SiteConfig = { sendBtn: '发送' }, + // 站点统计配置 + analytics: { + busuanzi: { + src: 'https://events.vercount.one/js', + site_pv_id: 'busuanzi_value_site_pv', + site_uv_id: 'busuanzi_value_site_uv', + formatter: true + }, + baidu: { + src: 'https://hm.baidu.com/hm.js?ae2a009a75b13c21d5121ee51375ea4e', + id: 'ae2a009a75b13c21d5121ee51375ea4e' + }, + google: { + src: 'https://www.googletagmanager.com/gtag/js', + id: 'G-DYWDEVKDP0' + }, + tencent: { + src: 'https://sdk.51.la/js-sdk-pro.min.js', + id: '3OBGjwDdEIRS7XZ1', + ck: '3OBGjwDdEIRS7XZ1' + } + }, + animationSettings: { observerOptions: { threshold: 0.1,