Q31: How does next/script manage third-party script loading in the Pages Router?
The next/script component optimizes third-party JS execution timing via strategies: beforeInteractive (injected in head before hydration), afterInteractive (default, loaded after page hydration), and lazyOnload (loaded during idle time).
Key Takeaways
- Controls third-party script execution timing.
- Prevents third-party scripts from blocking initial page rendering.
Knowledge Check
Which strategy in next/script should be used for critical analytics or bot detection scripts that must execute before page hydration?