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' }))" )