Pick the loading strategy on purpose
| Strategy | When it loads | Use case |
|---|---|---|
beforeInteractive | Before hydration | Critical: bot detection, consent banners |
afterInteractive (default) | After hydration | Analytics, tag managers |
lazyOnload | During idle time | Chat widgets, social embeds |
worker | In a web worker | Heavy compute that shouldn't block main thread |
One rule
beforeInteractive is allowed only inside the root layout (it injects into the document head). Anywhere else it's a runtime error.