Skip to content

Commit

Permalink
feat: add watchlist mixpanel tracking (#8023)
Browse files Browse the repository at this point in the history
  • Loading branch information
NeOMakinG authored Oct 30, 2024
1 parent 447c701 commit 918708f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/lib/mixpanel/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export enum MixPanelEvent {
LpIncompleteWithdrawPreview = 'LP Incomplete Withdraw Preview',
LpIncompleteWithdrawConfirm = 'LP Incomplete Withdraw Confirm',
CustomAssetAdded = 'Custom Asset Added',
ToggleWatchAsset = 'Toggle Watch Asset',
}

export type TrackOpportunityProps = {
Expand Down
7 changes: 7 additions & 0 deletions src/state/slices/preferencesSlice/preferencesSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import dayjs from 'dayjs'
import localizedFormat from 'dayjs/plugin/localizedFormat'
import { simpleLocale } from 'lib/browserLocale'
import type { SupportedFiatCurrencies } from 'lib/market-service'
import { getMixPanel } from 'lib/mixpanel/mixPanelSingleton'
import { MixPanelEvent } from 'lib/mixpanel/types'

dayjs.extend(localizedFormat)

Expand Down Expand Up @@ -217,6 +219,11 @@ export const preferences = createSlice({
} else {
state.watchedAssets = state.watchedAssets.concat(payload)
}

getMixPanel()?.track(MixPanelEvent.ToggleWatchAsset, {
assetId: payload,
isAdding: !isWatched,
})
},
setHomeMarketView(state, { payload }: { payload: HomeMarketView }) {
state.selectedHomeView = payload
Expand Down

0 comments on commit 918708f

Please sign in to comment.