mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 08:30:12 +01:00
🚨
This commit is contained in:
parent
20c338399d
commit
36f2d68e89
7 changed files with 42 additions and 49 deletions
|
|
@ -32,15 +32,5 @@
|
||||||
}
|
}
|
||||||
}, 2000)
|
}, 2000)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- Google tag (gtag.js) -->
|
|
||||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-L7WEXVQCR9"></script>
|
|
||||||
<script>
|
|
||||||
window.dataLayer = window.dataLayer || [];
|
|
||||||
function gtag(){dataLayer.push(arguments);}
|
|
||||||
gtag('js', new Date());
|
|
||||||
|
|
||||||
gtag('config', 'G-L7WEXVQCR9');
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -26,15 +26,5 @@
|
||||||
<div id="status" class="fn__flex status"></div>
|
<div id="status" class="fn__flex status"></div>
|
||||||
<div id="commonMenu" class="b3-menu fn__none"></div>
|
<div id="commonMenu" class="b3-menu fn__none"></div>
|
||||||
<div id="message" class="b3-snackbars"></div>
|
<div id="message" class="b3-snackbars"></div>
|
||||||
|
|
||||||
<!-- Google tag (gtag.js) -->
|
|
||||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-L7WEXVQCR9"></script>
|
|
||||||
<script>
|
|
||||||
window.dataLayer = window.dataLayer || [];
|
|
||||||
function gtag(){dataLayer.push(arguments);}
|
|
||||||
gtag('js', new Date());
|
|
||||||
|
|
||||||
gtag('config', 'G-L7WEXVQCR9');
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -72,15 +72,5 @@
|
||||||
<button data-type="redo"><svg><use xlink:href="#iconRedo"></use></svg></button>
|
<button data-type="redo"><svg><use xlink:href="#iconRedo"></use></svg></button>
|
||||||
<span class="fn__flex-1"></span>
|
<span class="fn__flex-1"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Google tag (gtag.js) -->
|
|
||||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-L7WEXVQCR9"></script>
|
|
||||||
<script>
|
|
||||||
window.dataLayer = window.dataLayer || [];
|
|
||||||
function gtag(){dataLayer.push(arguments);}
|
|
||||||
gtag('js', new Date());
|
|
||||||
|
|
||||||
gtag('config', 'G-L7WEXVQCR9');
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,14 @@ export const about = {
|
||||||
<div class="fn__space"></div>
|
<div class="fn__space"></div>
|
||||||
<input class="b3-switch fn__flex-center" id="downloadInstallPkg" type="checkbox"${window.siyuan.config.system.downloadInstallPkg ? " checked" : ""}>
|
<input class="b3-switch fn__flex-center" id="downloadInstallPkg" type="checkbox"${window.siyuan.config.system.downloadInstallPkg ? " checked" : ""}>
|
||||||
</label>
|
</label>
|
||||||
|
<label class="b3-label fn__flex">
|
||||||
|
<div class="fn__flex-1">
|
||||||
|
${window.siyuan.languages.googleAnalytics}
|
||||||
|
<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" : ""}>
|
||||||
|
</label>
|
||||||
<label class="b3-label fn__flex">
|
<label class="b3-label fn__flex">
|
||||||
<div class="fn__flex-1">
|
<div class="fn__flex-1">
|
||||||
${window.siyuan.languages.about9}
|
${window.siyuan.languages.about9}
|
||||||
|
|
@ -364,6 +372,12 @@ export const about = {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
const googleAnalyticsElement = about.element.querySelector("#googleAnalytics") as HTMLInputElement;
|
||||||
|
googleAnalyticsElement.addEventListener("change", () => {
|
||||||
|
fetchPost("/api/system/setGoogleAnalytics", {googleAnalytics: googleAnalyticsElement.checked}, () => {
|
||||||
|
exportLayout(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
const uploadErrLogElement = about.element.querySelector("#uploadErrLog") as HTMLInputElement;
|
const uploadErrLogElement = about.element.querySelector("#uploadErrLog") as HTMLInputElement;
|
||||||
uploadErrLogElement.addEventListener("change", () => {
|
uploadErrLogElement.addEventListener("change", () => {
|
||||||
fetchPost("/api/system/setUploadErrLog", {uploadErrLog: uploadErrLogElement.checked}, () => {
|
fetchPost("/api/system/setUploadErrLog", {uploadErrLog: uploadErrLogElement.checked}, () => {
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ export const initConfigSearch = (element: HTMLElement) => {
|
||||||
"importKey", "genKey", "genKeyByPW", "copyKey", "resetRepo", "systemLogTip", "export", "visitAnnouncements",
|
"importKey", "genKey", "genKeyByPW", "copyKey", "resetRepo", "systemLogTip", "export", "visitAnnouncements",
|
||||||
"safeQuit", "directConnection", "siyuanNote", "key", "password", "copied", "resetRepoTip",
|
"safeQuit", "directConnection", "siyuanNote", "key", "password", "copied", "resetRepoTip",
|
||||||
"autoDownloadUpdatePkg", "autoDownloadUpdatePkgTip", "networkProxy", "keyPlaceholder", "initRepoKeyTip",
|
"autoDownloadUpdatePkg", "autoDownloadUpdatePkgTip", "networkProxy", "keyPlaceholder", "initRepoKeyTip",
|
||||||
"useFixedPort", "useFixedPortTip"]),
|
"useFixedPort", "useFixedPortTip", "googleAnalytics", "googleAnalyticsTip"]),
|
||||||
];
|
];
|
||||||
const inputElement = element.querySelector(".b3-form__icon input") as HTMLInputElement;
|
const inputElement = element.querySelector(".b3-form__icon input") as HTMLInputElement;
|
||||||
if (window.siyuan.config.system.container !== "ios") {
|
if (window.siyuan.config.system.container !== "ios") {
|
||||||
|
|
|
||||||
4
app/src/types/index.d.ts
vendored
4
app/src/types/index.d.ts
vendored
|
|
@ -26,6 +26,7 @@ type TBazaarType = "templates" | "icons" | "widgets" | "themes"
|
||||||
declare module "blueimp-md5"
|
declare module "blueimp-md5"
|
||||||
|
|
||||||
interface Window {
|
interface Window {
|
||||||
|
dataLayer: string[]
|
||||||
siyuan: ISiyuan
|
siyuan: ISiyuan
|
||||||
webkit: any
|
webkit: any
|
||||||
|
|
||||||
|
|
@ -44,7 +45,7 @@ interface Window {
|
||||||
|
|
||||||
hideKeyboardToolbar(): void
|
hideKeyboardToolbar(): void
|
||||||
|
|
||||||
gtag(name: string, key: string, value: IObject): void;
|
gtag(name: string, key: string | Date, value?: IObject): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ITextOption {
|
interface ITextOption {
|
||||||
|
|
@ -352,6 +353,7 @@ declare interface IConfig {
|
||||||
xanadu: boolean
|
xanadu: boolean
|
||||||
udanax: boolean
|
udanax: boolean
|
||||||
uploadErrLog: boolean
|
uploadErrLog: boolean
|
||||||
|
googleAnalytics: boolean
|
||||||
downloadInstallPkg: boolean
|
downloadInstallPkg: boolean
|
||||||
networkServe: boolean
|
networkServe: boolean
|
||||||
fixedPort: boolean
|
fixedPort: boolean
|
||||||
|
|
|
||||||
|
|
@ -161,24 +161,31 @@ export const onGetConfig = (isStart: boolean) => {
|
||||||
mountHelp();
|
mountHelp();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
if (window.siyuan.config.system.googleAnalytics) {
|
||||||
const para = {
|
try {
|
||||||
"version": Constants.SIYUAN_VERSION,
|
window.dataLayer = window.dataLayer || [];
|
||||||
"container": window.siyuan.config.system.container,
|
// @ts-ignore
|
||||||
"isLoggedIn": "false",
|
window.gtag = () => {window.dataLayer.push(arguments)};
|
||||||
"subscriptionStatus": "-1",
|
window.gtag("js", new Date());
|
||||||
"subscriptionPlan": "-1",
|
window.gtag("config", "G-L7WEXVQCR9");
|
||||||
"subscriptionType": "-1",
|
const para = {
|
||||||
};
|
"version": Constants.SIYUAN_VERSION,
|
||||||
if (window.siyuan.user) {
|
"container": window.siyuan.config.system.container,
|
||||||
para.isLoggedIn = "true";
|
"isLoggedIn": "false",
|
||||||
para.subscriptionStatus = window.siyuan.user.userSiYuanSubscriptionStatus.toString();
|
"subscriptionStatus": "-1",
|
||||||
para.subscriptionPlan = window.siyuan.user.userSiYuanSubscriptionPlan.toString();
|
"subscriptionPlan": "-1",
|
||||||
para.subscriptionType = window.siyuan.user.userSiYuanSubscriptionType.toString();
|
"subscriptionType": "-1",
|
||||||
|
};
|
||||||
|
if (window.siyuan.user) {
|
||||||
|
para.isLoggedIn = "true";
|
||||||
|
para.subscriptionStatus = window.siyuan.user.userSiYuanSubscriptionStatus.toString();
|
||||||
|
para.subscriptionPlan = window.siyuan.user.userSiYuanSubscriptionPlan.toString();
|
||||||
|
para.subscriptionType = window.siyuan.user.userSiYuanSubscriptionType.toString();
|
||||||
|
}
|
||||||
|
window.gtag("event", Constants.ANALYTICS_EVT_ON_GET_CONFIG, para);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
}
|
}
|
||||||
window.gtag("event", Constants.ANALYTICS_EVT_ON_GET_CONFIG, para);
|
|
||||||
} catch (e) {
|
|
||||||
console.error(e);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue