Created
June 7, 2021 08:52
-
-
Save DopamineDriven/e9efe98f7e40ad72e11a491b2ba76616 to your computer and use it in GitHub Desktop.
app routing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const router = useRouter(); | |
useEffect(() => { | |
const handleRouteChange = (url: URL) => { | |
gtag.pageview(url); | |
}; | |
router.events.on( | |
'routeChangeComplete', | |
handleRouteChange | |
); | |
return () => { | |
router.events.off( | |
'routeChangeComplete', | |
handleRouteChange | |
); | |
}; | |
}, [router.events]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment