From d4f1b6a804fc3d19892b82809d9f746ac3b90ce6 Mon Sep 17 00:00:00 2001 From: wess09 <> Date: Mon, 27 Jul 2026 20:03:22 +0800 Subject: [PATCH] =?UTF-8?q?feat(analytics):=20=E6=B7=BB=E5=8A=A0=20Microso?= =?UTF-8?q?ft=20Clarity=20=E5=88=86=E6=9E=90=E8=84=9A=E6=9C=AC=E5=92=8C?= =?UTF-8?q?=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/webui/app_home.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/module/webui/app_home.py b/module/webui/app_home.py index 7ccdf48b7..3bb7df82f 100644 --- a/module/webui/app_home.py +++ b/module/webui/app_home.py @@ -239,6 +239,24 @@ def ui_check_announcement(self, force=False) -> None: def run(self, initial_page="home") -> None: # setup gui set_env(title="AzurPilot", output_animation=False) + if get_localstorage("clarity_notice_shown") != "1": + set_localstorage("clarity_notice_shown", "1") + toast( + "本 WebUI 使用 Microsoft Clarity 收集页面访问、点击交互和性能数据,用于分析并改进使用体验。", + color="info", + duration=12, + ) + # 加载 Microsoft Clarity 行为分析脚本,同一会话仅注入一次。 + run_js( + "if (!document.getElementById('microsoft-clarity-script')) {" + "(function(c,l,a,r,i,t,y){" + "c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};" + "t=l.createElement(r);t.id='microsoft-clarity-script';t.async=1;" + "t.src='https://www.clarity.ms/tag/'+i;" + "y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);" + "})(window,document,'clarity','script','xszl2nrp3q');" + "}" + ) run_js( "document.head.append(Object.assign(document.createElement('link'), { rel: 'manifest', href: '/static/assets/spa/manifest.json' }))" )