Pagespeed flags a page that keeps the main thread busy for longer than 4 seconds during load.
Webpagetest allows having a clear vision of what javascript execution happens in the main thread work of your website page. Do a test and visualize the pink line:
After finding what causes the issues, let’s move on to how to fix them.
Switch iframes for scripts
Iframes are considered bad practice because of security concerns.
Google Maps offers static(non-interactive) and javascript(interactive) maps besides iframes. Both require API keys, and the Javascript interactive maps may require advanced knowledge of HTML/CSS/JS.
Use Youtube Lite embed(needs an API), as it loads 224× faster than the Youtube iframe element. Use the YT Lyte plugin for Wordpress. Use Lite Vimeo for Vimeo videos.
Switch Recaptcha for bot fighting or IP ban
Consider using a smaller captcha such as math challenges, instead of Recaptcha. Set up Cloudflare and enable bot/email protection if it suits your spam/bot fighting. Use Cloudflare turnstile.
Ask the developer to improve the plugin
If you need a plugin but are having javascript issues, ask the developer to enable deactivating unused functions on the frontend.
Get your Core Web Vitals optimized. Send a request