Zaraz sets cookies for root-domain when used on subdomain

For Workers & Pages, what is the name of the domain?

What is the issue or error you’re encountering

Cookie “zaraz-analytics___cfa_clientId” has been rejected because it is in a cross-site context and its “SameSite” is “Lax” or “Strict”.

What steps have you taken to resolve the issue?

I setup a worker to rewrite the cookie domain in the headers of https://subdomain.example.com/cdn-cgi/zaraz/s.js script, but the zaraz scripts even if they are served with that url they don’t bypass the worker routes.

What are the steps to reproduce the issue?

setup zaraz for a root-domain (in my case iframe enabled)
request a html page on a subdomain of that root-domain and see the browser console show cookie errors for zaraz and ga4 cookies.
See the headers of the injected zaraz tracking script and the set-cookie domain is set to root-domain instead of the requested subdomain.