Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: 支持关闭 Google Analytics https://github.com/siyuan-note/siyuan/issues/6403

Liang Ding638911c306d5
diff --git a/app/src/config/about.ts b/app/src/config/about.ts
index 1f494db1e4..3a090527a5 100644
--- a/app/src/config/about.ts
+++ b/app/src/config/about.ts
@@ -30,7 +30,7 @@ export const about = {
<div class="b3-label__text">${window.siyuan.languages.googleAnalyticsTip}</div>
</div>
<div class="fn__space"></div>
- <input class="b3-switch fn__flex-center" id="googleAnalytics" type="checkbox"${window.siyuan.config.system.googleAnalytics ? " checked" : ""}>
+ <input class="b3-switch fn__flex-center" id="googleAnalytics" type="checkbox"${window.siyuan.config.system.disableGoogleAnalytics ? "" : " checked"}>
</label>
<label class="b3-label fn__flex">
<div class="fn__flex-1">
diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts
index 4ef70c65b3..55e954aa01 100644
--- a/app/src/types/index.d.ts
+++ b/app/src/types/index.d.ts
@@ -353,7 +353,7 @@ declare interface IConfig {
xanadu: boolean
udanax: boolean
uploadErrLog: boolean
- googleAnalytics: boolean
+ disableGoogleAnalytics: boolean
downloadInstallPkg: boolean
networkServe: boolean
fixedPort: boolean
diff --git a/app/src/util/onGetConfig.ts b/app/src/util/onGetConfig.ts
index f7b85d8a35..7537a2dd36 100644
--- a/app/src/util/onGetConfig.ts
+++ b/app/src/util/onGetConfig.ts
@@ -161,7 +161,7 @@ export const onGetConfig = (isStart: boolean) => {
mountHelp();
}
- if (window.siyuan.config.system.googleAnalytics) {
+ if (!window.siyuan.config.system.disableGoogleAnalytics) {
try {
window.dataLayer = window.dataLayer || [];
// @ts-ignore