|
@@ -161,24 +161,31 @@ export const onGetConfig = (isStart: boolean) => {
|
|
|
mountHelp();
|
|
|
}
|
|
|
|
|
|
- try {
|
|
|
- const para = {
|
|
|
- "version": Constants.SIYUAN_VERSION,
|
|
|
- "container": window.siyuan.config.system.container,
|
|
|
- "isLoggedIn": "false",
|
|
|
- "subscriptionStatus": "-1",
|
|
|
- "subscriptionPlan": "-1",
|
|
|
- "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();
|
|
|
+ if (window.siyuan.config.system.googleAnalytics) {
|
|
|
+ try {
|
|
|
+ window.dataLayer = window.dataLayer || [];
|
|
|
+ // @ts-ignore
|
|
|
+ window.gtag = () => {window.dataLayer.push(arguments)};
|
|
|
+ window.gtag("js", new Date());
|
|
|
+ window.gtag("config", "G-L7WEXVQCR9");
|
|
|
+ const para = {
|
|
|
+ "version": Constants.SIYUAN_VERSION,
|
|
|
+ "container": window.siyuan.config.system.container,
|
|
|
+ "isLoggedIn": "false",
|
|
|
+ "subscriptionStatus": "-1",
|
|
|
+ "subscriptionPlan": "-1",
|
|
|
+ "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);
|
|
|
}
|
|
|
};
|
|
|
|