add sage time gtag in main process

This commit is contained in:
geekgeekrun
2025-12-14 11:15:22 +08:00
parent e2040caa38
commit 2aee76307f
5 changed files with 46 additions and 14 deletions
@@ -94,7 +94,9 @@ const runAutoChat = async () => {
noPositionFoundForCurrentJob: new SyncHook(),
noPositionFoundAfterTraverseAllJob: new SyncHook(),
errorEncounter: new SyncHook(['errorInfo']),
encounterEmptyRecommendJobList: new AsyncSeriesHook(['args'])
encounterEmptyRecommendJobList: new AsyncSeriesHook(['args']),
sageTimeEnter: new AsyncSeriesHook(['args']),
sageTimeExit: new AsyncSeriesHook(['args'])
}
initPlugins(hooks)
@@ -31,5 +31,11 @@ export default class GtagPlugin {
hooks.encounterEmptyRecommendJobList.tap('GtagPlugin', ({ pageQuery }) => {
gtag('encounter_empty_rec_job_list', { pageQuery })
})
hooks.sageTimeEnter.tap('GtagPlugin', ({ tag, totalEnabledTimes, recordedOpCount }) => {
gtag('sage_time_enter', { tag, totalEnabledTimes, recordedOpCount })
})
hooks.sageTimeExit.tap('GtagPlugin', ({ tag, totalEnabledTimes, recordedOpCount }) => {
gtag('sage_time_exit', { tag, totalEnabledTimes, recordedOpCount })
})
}
}