Optimize performance of Cloudflare Pages Web Analytics

I have a Cloudflare Pages website with Web Analytics enabled, and see a couple possible performance optimizations.

  1. The script loads from a domain other than my Cloudflare Pages domain, which adds a DNS lookup and HTTPS handshake.
  2. it uses defer instead of async, like Google Analytics uses.

Is defer required for Real User Monitoring?
It’d be nice to see these enabled by default and for it to not add HTML comments around the appended script tag in the HTML.


I added these which are helpful, but would still prefer to use my first-party domain for the script load and async if it works for the script:

<link rel="preload" href="https://static.cloudflareinsights.com/beacon.min.js" as="script" />
<link rel="preconnect" href="https://cloudflareinsights.com" />