Closed flavioriper closed 5 months ago
PartyTown moves the script out of the main thread using an internal proxy, for some sources like GA, it can lead to CORS errors since the response comes with "wrong Headers".
https://partytown.builder.io/proxying-requests#serving-resources-locally
They offer two approaches to solve this:
I choose to go for the local one, hosting the GA script within the project
@travjenkins mentioned pulling the GA script in the build step to make sure we always have the latest version.
I've tried to look for a Baked Gatsby plugin but no one was doing this in a simple way, so I decided to just fetch and save locally the script onPreBootstrap
step.