How to set up Google Analytics through Google Tag Manager for Next-Js?
问题 formerly I was using react-ga npm module to insert google analytics in my next js app. and It was simply like this: import ReactGA from 'react-ga' export const initGA = () => { ReactGA.initialize('UA-*******-*', { titleCase: false }) } export const logPageView = () => { if (window.location.href.split('?')[1]) { ReactGA.set({page: window.location.pathname + '?' + window.location.href.split('?')[1]}) ReactGA.pageview(window.location.pathname + '?' + window.location.href.split('?')[1]) } else {