In Nuxt, the banner goes in app.head.script in nuxt.config.ts, as plain synchronous entries. This guide covers placement, and one rule that catches people out: no script in that list should be async or defer.
Last reviewed: 24 November 2026.
Which engine am I on?
Use the loader address from your live snippet (/v2/ means the New engine; no /v2/ means the Classic engine) or the portal Banner engine dropdown. The config entries below are the same on both. For Consent Mode loader behaviour, see cookie auto-blocking.
Where it goes
app.head in nuxt.config.ts is rendered into the initial HTML response. Put the two banner entries first in script:
// nuxt.config.ts
export default defineNuxtConfig({
app: {
head: {
script: [
{
innerHTML: 'var huOptions = { "appID": "YOUR_APP_ID", "currentLanguage": "en", "blocking": true, "globalCookie": false };',
type: 'text/javascript'
},
{
// use the loader address from your own snippet
src: 'https://cdn.hu-manity.co/v2/hu-banner.min.js',
type: 'text/javascript'
},
// Your existing trackers stay below, unchanged:
{ src: 'https://www.googletagmanager.com/gtag/js?id=YOUR_GA_ID' }
]
}
}
})
Copy the exact snippet from Integrations → Manual Integration instead of retyping the keys. The /v2/ loader path above is the New-engine address; use the loader URL from your own snippet. If the banner is now in a useHead() call or a .client.ts plugin, move it to app.head.script.
The rule: keep every entry plain
Nuxt’s head manager (unhead) can move scripts marked async ahead of entries listed before them. In a Nuxt 4.7.0 build, a gtag entry with async: true, listed after the banner, came out above the banner entries in the generated HTML. Plain entries (no async, no defer) kept the order we wrote.
So leave async and defer out of every entry in app.head.script, yours and the banner’s. Otherwise a tracker you listed after the banner can still run first, and the banner cannot hold it. Check the order in View Source of the server response, not in the config file.
Other gotchas
- Use the static config for the banner.
useHead()inside a page or component runs after the config entries, so it suits page-specific tags. The banner belongs in the static config. - Keep it out of
.client.tsplugins. Those run in the browser after hydration. - Re-paste after an engine switch. Copy the live snippet again;
nuxt.config.tsdoes not update itself. - Google Tag Manager goes below the banner, never inside it. Gate tags that GTM fires with consent triggers inside GTM. See cookie consent with Google Tag Manager.
Check it works
- View the source (not the Elements panel) of
/and an inner route.huOptionsand thehu-banner.min.jstag are the first two of your<script>tags, in that order, with noasyncordefer. - Search
app.head.script. Every entry is a plain synchronous script. - Private window, from a region where consent is required first (or with region rules off). Before you click, Application → Cookies shows no tracking cookies such as
_gaor_fbp. - Accept everything. Trackers start and their cookies appear.
If the banner does not show, see Banner is not displayed. The placement rule for every platform is in Where to put the Cookie Compliance snippet.
Where Cookie Compliance fits
Nuxt’s install is two entries at the top of app.head.script, with nothing framework-specific beyond keeping that list synchronous. Cookie Compliance holds recognised trackers until the visitor chooses, where the region requires consent first. The Free plan covers 1,000 visits per 30-day cycle and includes Google Consent Mode. Past the limit, holding changes by engine, so stay within the cycle or upgrade. On the Classic engine, the banner stops holding new scripts and leaves any it had already held. On the New engine, the engine switches off and releases the scripts it was holding. Professional has no visit limit and adds geolocation defaults, Meta Consent Mode, Microsoft Consent Mode and Global Privacy Control (switched on with the GPC support setting) and Consent on Update. See pricing. A consent tool does not, on its own, make a site compliant.
If an AI assistant edits your config, point it at the MCP server. Recipe: Nuxt cookbook. Other stacks: how to add a cookie banner to your website and Next.js cookie consent banner.
Ready to try it? Start free with Cookie Compliance. No payment needed.
FAQ
Where does the cookie banner go in Nuxt?
In app.head.script in nuxt.config.ts, as the first two entries: the inline huOptions block, then the loader script.
Why should I avoid async and defer in the Nuxt head?
Nuxt’s head manager can move async entries ahead of earlier ones, so a tracker listed after the banner can end up above it. Plain entries keep the order you wrote.
Can I use useHead() for the banner?
No. useHead() runs as part of a component’s setup, after the config entries. Use it for page-specific tags and keep the banner in nuxt.config.ts.
Can I add the banner in a .client.ts plugin?
No. A .client.ts plugin runs in the browser after hydration, which is after the page’s own scripts.
Do I need to update the config when I switch banner engine?
Yes. Copy the live snippet again from the dashboard and replace the two entries.