import { AppProps } from 'next/app' ; import '@/styles/global.css' ; import { useEffect } from 'react' ; import { useRouter } from 'next/router' ; import { appWithTranslation } from 'next-i18next' ; import * as ga from '../lib/ga' ; const MyApp = ( { Component , pageProps } ) => { const router = useRouter ( ) ; useEffect ( ( ) => { const handleRouteChange = ( url ) => { ga . pageview ( url ) ; } ; router . events . on ( `routeChangeComplete` , handleRouteChange ) ; return ( ) => { router . events . off ( `routeChangeComplete` , handleRouteChange ) ; } ; } , [ router . events ] ) ; return < Component { ... pageProps } / > ; } ; export default appWithTranslation ( MyApp ) ;