import React, { useEffect } from 'react' import ReactGA, { FieldsObject } from 'react-ga' import { RouteComponentProps } from 'react-router-dom' import { analyticsId } from '../config' ReactGA.initialize(analyticsId, { testMode: process.env.NODE_ENV === 'test', debug: false }) const withTracker =
(
WrappedComponent: any,
options: FieldsObject = {}
) => {
const trackPage = (page: string) => {
options.isWeb3 = window.web3 !== undefined
ReactGA.set({ page, ...options })
ReactGA.pageview(page)
}
const HOC = (props: P) => {
useEffect(() => trackPage(props.location.pathname), [
props.location.pathname
])
return