Commit 81b8afdd authored by Jordan Frankfurt's avatar Jordan Frankfurt Committed by GitHub

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
parent 6085284e
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 } ...@@ -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])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment