Analytics tag not loading due to Cross-Origin Request Blocked

Trying to test out cloudflare analytics.
Set up site in cloudflare and got the javascript tag and put in header.
Loading site now triggers an error

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at (Reason: CORS header 'Access-Control-Allow-Origin' missing).

I have added an Access-Control-Allow-Origin header to the page which is set to but this does not seem to have helped.

The site is running on an http/2 server with referrer policy strict-origin-when-cross-origin.

Does anyone have any thoughts on how I can resolve this issue?

Thanks in advance for any help.

1 Like

Just wanted to share that I’m seeing the same error.

I’ve tried changing the referee as mentioned in the issue here, but it did not help. Maybe @cloonan or @philgyford can help?

Same issue. Site is on Cloudflare Pages.

The same problem. Looks like someone forgot to add CORS headers into CF analytics.

Same here, it doesn’t seem that Cloudflare Pages and Cloudflare Web Analytics are compatible.

There is a workaround to disable and enable analytics back after setting up a custom domain.

Hi, looks like we have a bug on our end. Until this is fixed, after adding your custom domain on Pages, please disable and re-enable Web Analytics so that your new custom domain is allowed in the Web Analytics. Sorry for the inconvenience.

If you are seeing CORS error, that means Web Analytics has not been updated to receive payload from your domain. Please see for better understanding.

1 Like

Thanks for the response! On, I’ve tried:

  • disabling Web Analytics
  • running a build
  • enabling Web Analytics
  • running a build

However, console still has the CORS error.

EDIT: fixed, it seems like you also need to delete the project on web analytics, otherwise they get duplicated


This topic was automatically closed after 29 days. New replies are no longer allowed.