update gtag

This commit is contained in:
geekgeekrun
2024-10-26 14:10:11 +08:00
parent 59b228af21
commit 015c141c1a
3 changed files with 22 additions and 0 deletions

View File

@@ -15,6 +15,7 @@ import * as JSONStream from 'JSONStream'
import SqlitePluginModule from '@geekgeekrun/sqlite-plugin'
import gtag from '../../utils/gtag'
import GtagPlugin from '../../utils/gtag/GtagPlugin'
const { default: SqlitePlugin } = SqlitePluginModule
const rerunInterval = (() => {
@@ -31,6 +32,7 @@ const { groupRobotAccessToken: dingTalkAccessToken } = readConfigFile('dingtalk.
const initPlugins = (hooks) => {
new DingtalkPlugin(dingTalkAccessToken).apply(hooks)
new SqlitePlugin(getPublicDbFilePath()).apply(hooks)
new GtagPlugin().apply(hooks)
}
let isParentProcessDisconnect = false

View File

@@ -119,6 +119,7 @@ const attachRequestsListener = async (target: Target) => {
},
markReason: MarkAsNotSuitReason.USER_MANUAL_OPERATION_WITH_UNKNOWN_REASON
}
gtag('job_marked_as_not_suit', { markFrom: markDetail.markFrom })
if (reasonCodeToTextMap[chosenCode]?.includes('活跃度低')) {
markDetail.markReason = MarkAsNotSuitReason.BOSS_INACTIVE
markDetail.extInfo.bossActiveTimeDesc = currentJobData?.bossInfo.activeTimeDesc
@@ -153,6 +154,7 @@ const attachRequestsListener = async (target: Target) => {
const currentUserInfo = await page.evaluate(
'document.querySelector(".job-detail-box").__vue__.$store.state.userInfo'
)
gtag('new_chat_startup', { chatStartupFrom: ChatStartupFrom.ManuallyFromRecommendList })
await saveChatStartupRecord(
await dbInitPromise,
currentJobData,

View File

@@ -0,0 +1,18 @@
import gtag from '.'
export default class GtagPlugin {
apply(hooks) {
hooks.newChatStartup.tap('GtagPlugin', (_, { chatStartupFrom }) => {
gtag('new_chat_startup', { chatStartupFrom })
})
hooks.jobMarkedAsNotSuit.tap('GtagPlugin', (_, { markFrom }) => {
gtag('job_marked_as_not_suit', { markFrom })
})
hooks.noPositionFoundForCurrentJob.tap('GtagPlugin', () => {
gtag('no_position_found_for_current_job')
})
hooks.noPositionFoundAfterTraverseAllJob.tap('GtagPlugin', () => {
gtag('no_position_found_after_traverse_all_job')
})
}
}