beforeInteractive

A next/script strategy that loads the script before any Next.js code and before the page hydrates.

In more detail

Only use it for scripts that must run first, such as bot detection or cookie consent managers, and place it in the root layout. It delays interactivity, so keep such scripts rare.

Related terms

Taught in

References