DEV Community

Discussion on: Add Google Analytics through GTM (Google Tag Manager) on Next.js

Collapse
 
alex44lel profile image
Alex44lel

Hi I have done everything in this post but there is a problem.

When a user logs-in on my website it gets redirected to another page (using router.replace()). The problem is that the pageview event is triggering two times when a user logs-in and thus registering two pageviews instead of one.

I attach a photo of my google tag manager

Hope anybody can help me as I do not want to have "fake" pageviews on my analytics

Collapse
 
oxodesign profile image
Flamur Mavraj

Havent had this scenario, so not sure what you can do here! If you have found a solution please do share it with us.

All the best.