Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: track user's wallet type through user properties #2688

Merged
merged 5 commits into from
Oct 30, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/services/analytics/useGtm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ import { DeviceType } from './types'
import useSafeAddress from '@/hooks/useSafeAddress'
import useWallet from '@/hooks/wallets/useWallet'

enum GA_USER_PROPERTIES {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn’t put it here. This hook is just a hook to bind GTM to React. The actual analytics service is where it should be, similar to our custom event definitions.

WALLET_LABEL = 'walletLabel',
}

const WALLET_LABEL_NONE = 'NONE'

const useGtm = () => {
const chainId = useChainId()
const cookies = useAppSelector(selectCookies)
Expand Down Expand Up @@ -83,7 +89,7 @@ const useGtm = () => {
}, [router.pathname])

useEffect(() => {
gtmSetUserProperty('walletLabel', walletLabel ?? 'NONE')
gtmSetUserProperty(GA_USER_PROPERTIES.WALLET_LABEL, walletLabel ?? WALLET_LABEL_NONE)
}, [walletLabel])

// Track meta events on app load
Expand Down
Loading