Retaining query parameters

I am trying to set up my Nextjs site to retain query parameters as users navigate my site – specifically utm parameters.

My approach has been to handle this in my middleware.ts file. From the initial URL I save the query parameters that I am interested in to a cookie, and then add query parameters from this cookie to the URL when the site navigates to a different page.

I am noticing that am picking up a uid=xxx query parameter unless I ensure that it is not kept.

I am interested to know what is happening here and whether the way I am handling the URL and query parameters is getting in the way of Prismic.

Hi @ben7, Prismic doesn't do anything unusual regarding network requests or links. Prismic's client uses the native fetch and Next.js's fetch cache. @prismicio/next wraps next/link by forwarding a link field's URL to the href prop.

If you share your middleware.ts file, I might able able to see if the Prismic packages or recommended settings are interfering. Maybe a dynamic route segment (like one called [uid]) is showing up in your middleware?