不蒜子调整
This commit is contained in:
tangly1024
2021-12-21 13:55:42 +08:00
parent e430d55cf8
commit ac7ff2e912
7 changed files with 153 additions and 47 deletions

View File

@@ -5,12 +5,12 @@ import * as gtag from '@/lib/gtag'
const Gtag = () => {
const router = useRouter()
useEffect(() => {
const handleRouteChange = url => {
const gtagRouteChange = url => {
gtag.pageview(url)
}
router.events.on('routeChangeComplete', handleRouteChange)
router.events.on('routeChangeComplete', gtagRouteChange)
return () => {
router.events.off('routeChangeComplete', handleRouteChange)
router.events.off('routeChangeComplete', gtagRouteChange)
}
}, [router.events])
return null