Skip to content

Commit

Permalink
add tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenhoaidanh committed Oct 26, 2023
1 parent e700d7b commit 3f3e92f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/components/swapv2/LimitOrder/Tutorial.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { ButtonPrimary } from 'components/Button'
import Column from 'components/Column'
import Row from 'components/Row'
import { DOCS_LINKS } from 'components/swapv2/LimitOrder/const'
import useMixpanel, { MIXPANEL_TYPE } from 'hooks/useMixpanel'
import useTheme from 'hooks/useTheme'
import { ExternalLink } from 'theme'

Expand Down Expand Up @@ -50,6 +51,12 @@ const ContentItem = ({ text }: { text: ReactNode }) => {
}
export default function Tutorial({ onClose }: { onClose: () => void }) {
const theme = useTheme()
const { mixpanelHandler } = useMixpanel()

const onGetStart = () => {
mixpanelHandler(MIXPANEL_TYPE.LO_CLICK_GET_STARTED)
onClose()
}

return (
<Wrapper>
Expand Down Expand Up @@ -97,7 +104,7 @@ export default function Tutorial({ onClose }: { onClose: () => void }) {
Learn more about our limit orders <ExternalLink href={DOCS_LINKS.USER_GUIDE}>here</ExternalLink>.
</Trans>
</Text>
<ButtonPrimary height="40px" width={'100%'} onClick={onClose}>
<ButtonPrimary height="40px" width={'100%'} onClick={onGetStart}>
<Trans>Get Started</Trans>
</ButtonPrimary>
</Column>
Expand Down
5 changes: 5 additions & 0 deletions src/hooks/useMixpanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ export enum MIXPANEL_TYPE {
LO_CLICK_SUBSCRIBE_BTN,
LO_CLICK_CANCEL_TYPE,
LO_CLICK_UPDATE_TYPE,
LO_CLICK_GET_STARTED,

// Wallet UI
WUI_WALLET_CLICK,
Expand Down Expand Up @@ -1133,6 +1134,10 @@ export default function useMixpanel(currencies?: { [field in Field]?: Currency }
mixpanel.track('Limit Order - Update Order Double Signature Click', payload)
break
}
case MIXPANEL_TYPE.LO_CLICK_GET_STARTED: {
mixpanel.track('Limit Order - Get Started Click', payload)
break
}

case MIXPANEL_TYPE.WUI_WALLET_CLICK: {
mixpanel.track('Wallet UI - Wallet Click')
Expand Down

0 comments on commit 3f3e92f

Please sign in to comment.