fix: set custom dimension on chainId change (#2440)
* set custom dimension on chainId change * make it more clear that 1 is mainnet * 0 fallback chainId
This commit is contained in:
parent
6085284ed6
commit
81b8afdd3d
@ -1,3 +1,5 @@
|
|||||||
|
import { SupportedChainId } from 'constants/chains'
|
||||||
|
import { useActiveWeb3React } from 'hooks/web3'
|
||||||
import { useEffect } from 'react'
|
import { useEffect } from 'react'
|
||||||
import ReactGA from 'react-ga'
|
import ReactGA from 'react-ga'
|
||||||
import { RouteComponentProps } from 'react-router-dom'
|
import { RouteComponentProps } from 'react-router-dom'
|
||||||
@ -21,6 +23,11 @@ export default function GoogleAnalyticsReporter({ location: { pathname, search }
|
|||||||
getCLS(reportWebVitals)
|
getCLS(reportWebVitals)
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
const { chainId } = useActiveWeb3React()
|
||||||
|
useEffect(() => {
|
||||||
|
ReactGA.set({ ['Chain ID']: chainId ?? 0 })
|
||||||
|
}, [chainId])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
ReactGA.pageview(`${pathname}${search}`)
|
ReactGA.pageview(`${pathname}${search}`)
|
||||||
}, [pathname, search])
|
}, [pathname, search])
|
||||||
|
Loading…
Reference in New Issue
Block a user