vercel / next.js

The React Framework
https://nextjs.org
MIT License
123.05k stars 26.29k forks source link

@housseindjirdeh I updated my Nextjs to 1.12.6 and tried using worker strategy but I'm facing an issue, I'm using Partytown but Partyproxy is making a lot of requests on each page I visit. I'm using Next so I don't have any configs for PartyTown, I just put my script's strategy as a worker #58328

Open adityarao04 opened 8 months ago

adityarao04 commented 8 months ago
          @housseindjirdeh I updated my Nextjs to 1.12.6 and tried using worker strategy but I'm facing an issue, I'm using Partytown but Partyproxy is making a lot of requests on each page I visit. I'm using Next so I don't have any configs for PartyTown, I just put my script's strategy as a worker

image

Originally posted by @RigottiG in https://github.com/vercel/next.js/issues/36123#issuecomment-1117236344

I am facing the same issue here, I have a custom nextjs server and Partytown is sending multiple requests to my inline GTM code

here is my _document.js file <Partytown debug={true} forward={['dataLayer.push']} /> <script defer type="text/partytown" dangerouslySetInnerHTML={{__html: (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','${GTM_ID}')}}/>

I have also added nextScriptWorkers true in my next config

rashidul0405 commented 8 months ago

@adityarao04 https://github.com/BuilderIO/partytown/issues/170 https://partytown.builder.io/trade-offs

adityarao04 commented 7 months ago

@rashidul0405 The issue is partytown is transferring all call Fetch/CSS/JS to another thread instead of just transferring the GTM script