How to defer JS codes (G4)?

Before adding the Google Analytics codes, my site was getting full marks from Core Web Vitals and successfully passing the test. After adding the code, it failed the test. How can I defer the G4 Javascript codes?

Failing the Core Web Vitals test is a big problem SEO. But I also want to use Google Analytics.

Edit: I use Zaraz on Cloudflare and it solves nearyly. But it can be better with delayın the JS.