Skip to content

Commit

Permalink
refactor: version to analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
aqzhyi committed Jul 15, 2020
1 parent 0030380 commit fbb17a1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/etoro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import { registeredPortfolioHeaderExtraButtons } from '@/components/Portfolio/Po
import { registeredExecutionDialogControls } from '@/components/ExecutionDialog/ExecutionDialogControls'
import { registeredExecutionDialogTakeProfitControls } from '@/components/ExecutionDialog/ExecutionDialogTakeProfitControls'
import { registeredExecutionDialogStopLossControls } from '@/components/ExecutionDialog/ExecutionDialogStopLossControls'
import { gaAPI } from '@/gaAPI'
import { gaAPI, GaTargetEventId } from '@/gaAPI'
import packageJSON from '../package.json'

type $ = JQueryStatic
globalThis.localStorage.setItem('debug', `${debugAPI.log.namespace}:*`)
Expand All @@ -42,6 +43,13 @@ $('body').delegate(
}, 1000),
)

emitter.once(Events.ready).then(function sendVersionToAnalytics() {
gaAPI.sendEvent(
GaTargetEventId.universal_bootstrapWithVersion,
`version=${packageJSON.version}`,
)
})

/**
* 以事件驅動分別在各頁面中,渲染「本腳本」的各個部件到 etoro 頁面上
*
Expand Down
1 change: 1 addition & 0 deletions src/gaAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import store from '@/store/_store'
* e.g. {category}_{event}
*/
export enum GaTargetEventId {
universal_bootstrapWithVersion,
sidebar_extensionMenuItemClick,
watchlists_balanceLinkClick,
watchlists_portfolioLinkClick,
Expand Down

0 comments on commit fbb17a1

Please sign in to comment.