Use next/script with beforeInteractive, afterInteractive, and lazyOnload strategies for the App Router. worker is experimental, pages/-only, and needs experimental.nextScriptWorkers. The experimental @next/third-parties (guide) wraps common embeds.
import Script from 'next/script'
export default function Page() {
return (
<>
<Script src="https://example.com/script.js" strategy="lazyOnload" />
</>
)
}
From the Script docs.