mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 16:40:13 +01:00
🎨 加入 Google Analytics https://github.com/siyuan-note/siyuan/issues/6369
This commit is contained in:
parent
2c608bf593
commit
41d882ddba
3 changed files with 20 additions and 2 deletions
|
|
@ -427,4 +427,7 @@ export abstract class Constants {
|
||||||
// third
|
// third
|
||||||
"yul", "solidity", "abap",
|
"yul", "solidity", "abap",
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Google Analytics 事件
|
||||||
|
public static readonly ANALYTICS_EVT_ON_GET_CONFIG: string = "siyuan.onGetConfig";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -160,9 +160,23 @@ export const onGetConfig = (isStart: boolean) => {
|
||||||
mountHelp();
|
mountHelp();
|
||||||
}
|
}
|
||||||
|
|
||||||
window.gtag("event", "config", {
|
let para = {
|
||||||
"version": Constants.SIYUAN_VERSION,
|
"version": Constants.SIYUAN_VERSION,
|
||||||
});
|
"isLoggedIn": "false",
|
||||||
|
"subscriptionStatus": "-1",
|
||||||
|
"subscriptionPlan": "-1",
|
||||||
|
"subscriptionType": "-1",
|
||||||
|
}
|
||||||
|
if (window.siyuan.user) {
|
||||||
|
para.isLoggedIn = "true";
|
||||||
|
if (0 === window.siyuan.user.userSiYuanSubscriptionStatus) {
|
||||||
|
console.log(window.siyuan.user)
|
||||||
|
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);
|
||||||
};
|
};
|
||||||
|
|
||||||
const initBar = () => {
|
const initBar = () => {
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ type User struct {
|
||||||
UserTrafficTime float64 `json:"userTrafficTime"`
|
UserTrafficTime float64 `json:"userTrafficTime"`
|
||||||
UserSiYuanSubscriptionPlan float64 `json:"userSiYuanSubscriptionPlan"` // -2:未订阅,-1:试用,0:标准订阅,1:教育订阅
|
UserSiYuanSubscriptionPlan float64 `json:"userSiYuanSubscriptionPlan"` // -2:未订阅,-1:试用,0:标准订阅,1:教育订阅
|
||||||
UserSiYuanSubscriptionStatus float64 `json:"userSiYuanSubscriptionStatus"` // -1:未订阅,0:订阅可用,1:订阅封禁,2:订阅过期
|
UserSiYuanSubscriptionStatus float64 `json:"userSiYuanSubscriptionStatus"` // -1:未订阅,0:订阅可用,1:订阅封禁,2:订阅过期
|
||||||
|
UserSiYuanSubscriptionType float64 `json:"userSiYuanSubscriptionType"` // 0 年付;1 终生;2 月付
|
||||||
}
|
}
|
||||||
|
|
||||||
type UserTitle struct {
|
type UserTitle struct {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue