shadowwalker / next-pwa

Zero config PWA plugin for Next.js, with workbox 🧰
MIT License
3.86k stars 323 forks source link

Google Tag Manager loads twice when PWA is enabled #351

Open josezm opened 2 years ago

josezm commented 2 years ago

Summary

Hello! I am using the next-pwa library in my project and everything works perfectly! I only have one problem, I noticed that when the PWA is enabled, the Google Tag Manager loads twice, this is causing analytics errors and errors in scripts that are triggered from my GTM. Is there any way to avoid this behavior?

Versions

How To Reproduce

  1. Add GTM in _document.tsx and _app.tsx
  2. Enable PWA build
  3. Check Network in Devtools and see that the GTM script loads twice

Expected Behaviors

When a build is made with the PWA disabled, the gtm only loads 1 time When the build is done with the PWA activated, the gtm loads twice

Screenshots

With PWA disable image

With PWA enalbe image

Additional Context

johannbuscail commented 1 year ago

Any solution ?