
React: Setting Up Google Analytics - Live Coding with Jesse
video description
Date: 2022-03-14
Comments and reviews: 2
Aleks
You don't have to export the constants because you use them on the same file.
Also instead of the whole logPageView function that uses a window.location.pathname, I came up with an approach that uses NextJs routes.
Import Router from 'next/router';
....
Router.onRouteChangeComplete = url => process.browser && ReactGA.pageview(url);
reply
You don't have to export the constants because you use them on the same file.
Also instead of the whole logPageView function that uses a window.location.pathname, I came up with an approach that uses NextJs routes.
Import Router from 'next/router';
....
Router.onRouteChangeComplete = url => process.browser && ReactGA.pageview(url);
reply
Manish
Thanks for the helpful video. I have one question, instead of calling initialize in every page before -pageView-, can I call initialize in the route.js page and then call the pageView in the respective page, where-ever it is required?
reply
Thanks for the helpful video. I have one question, instead of calling initialize in every page before -pageView-, can I call initialize in the route.js page and then call the pageView in the respective page, where-ever it is required?
reply
Add a review, comment
Other channel videos















