diff --git a/src/services/analytics/types.ts b/src/services/analytics/types.ts index 47fb97dbb6..07c3c4a59b 100644 --- a/src/services/analytics/types.ts +++ b/src/services/analytics/types.ts @@ -32,4 +32,5 @@ export enum DeviceType { export enum AnalyticsUserProperties { WALLET_LABEL = 'walletLabel', + WALLET_ADDRESS = 'walletAddress', } diff --git a/src/services/analytics/useGtm.ts b/src/services/analytics/useGtm.ts index f2fc484de3..854a63741e 100644 --- a/src/services/analytics/useGtm.ts +++ b/src/services/analytics/useGtm.ts @@ -37,7 +37,7 @@ const useGtm = () => { const isTablet = useMediaQuery(theme.breakpoints.down('md')) const deviceType = isMobile ? DeviceType.MOBILE : isTablet ? DeviceType.TABLET : DeviceType.DESKTOP const safeAddress = useSafeAddress() - const walletLabel = useWallet()?.label + const wallet = useWallet() // Initialize GTM useEffect(() => { @@ -83,10 +83,16 @@ const useGtm = () => { }, [router.pathname]) useEffect(() => { - if (walletLabel) { - gtmSetUserProperty(AnalyticsUserProperties.WALLET_LABEL, walletLabel) + if (wallet?.label) { + gtmSetUserProperty(AnalyticsUserProperties.WALLET_LABEL, wallet?.label) } - }, [walletLabel]) + }, [wallet?.label]) + + useEffect(() => { + if (wallet?.address) { + gtmSetUserProperty(AnalyticsUserProperties.WALLET_ADDRESS, wallet?.address) + } + }, [wallet?.address]) // Track meta events on app load useMetaEvents()