consent manager
A script that asks visitors for permission before tracking cookies are set, as privacy laws in many regions require.
In more detail
Privacy laws in many regions require consent before tracking cookies are set. The consent script must run before any analytics or advertising scripts.
Example
This is one of the few good reasons to use the next/script beforeInteractive strategy.Related terms
- beforeInteractive — A next/script strategy that loads the script before any Next.js code and before the page hydrates.
- cookie — A small named value a server asks a browser to store and send back automatically on later matching requests.
Taught in
- Script Optimization: next/script & Lazy Third Parties — Next.js 15 & Modern App Router Architecture