Add Velo
to Next.js.
Install the Velo cookie banner and Google Consent Mode v2 on Next.js with one line in your root layout. Most installs take a few minutes when you already have admin access to the site. If you run Google Tag Manager, that route is on this page too.
Instructions and image sources reviewed 7 November 2026.
Paste one line
into your root layout.
Add your site’s snippet to the site-wide head, then publish and test the result. If your measurement tags already run through Google Tag Manager, use the route below.
Already using Google Tag Manager? Skip the code and do it there ↓
Three steps · about five minutes
-
01
Copy the line
Copy the complete installation snippet for this site from your Velo dashboard. The example below shows the format; replace your-site-id before using it. Keep the API endpoint supplied by your dashboard.
<script src="https://cdn.veloconsent.com/v1/velo.js" data-api="https://app.veloconsent.com" data-velo-site="your-site-id" async></script> -
02
Paste it into your root layout
With the App Router, open the root layout, app/layout.tsx or src/app/layout.tsx, add a <head> element above <body> if there is none, and paste your complete Velo snippet inside it, above any analytics or advertising tags. With the Pages Router, paste it inside <Head> in pages/_document.tsx, creating that file if the project has none. The snippet is valid JSX as it stands. Keep it out of useEffect and out of next/script with the default strategy, which both load it after your other tags can fire. Deploy, then test a page reached through a Link as well as a full reload.
Next.js · root layout
// app/layout.tsx on the App Router. On the Pages Router, the same // line goes inside <Head> in pages/_document.tsx. export default function RootLayout({ children }) { return ( <html lang="en"> <head> {/* Paste the complete Velo snippet from your dashboard here. */} <script src="https://cdn.veloconsent.com/v1/velo.js" data-api="https://app.veloconsent.com" data-velo-site="your-site-id" async></script> </head> <body>{children}</body> </html> ); }Verified configuration reference · 7 November 2026 Configuration reference checked against the platform documentation. This is not an admin screenshot.
Platform documentation ↗ -
03
Publish and check the live site
Save and publish the change using the platform steps above, then clear any site or CDN cache. Open the published URL in a fresh browser session. Check the banner where your region rules require it, test accepting and rejecting, and verify consent defaults and updates before your measurement tags run. Confirm the site appears as installed in your Velo dashboard.

Live interface capture · 23 September 2026 The real banner on veloconsent.com, captured on 23 September 2026. Your banner’s copy, layout and region settings may differ.
Velo live site ↗View full size ↗
Load the snippet once, from the root layout. A tag in a useEffect runs after your other tags can fire, and next/script without a strategy waits for hydration. Test a page reached through a Link as well as a full reload: the banner should stay put, with no second copy.
Still comparing options? See every supported platform.
Use Tag Manager?
Skip the code.
If Google Tag Manager is already on your site, this is the easiest way to add Velo. There’s no code to touch, it takes four short steps, and all your tags stay in one place.
- 01
Add Velo to Tag Manager
Open the Velo template, click Add to workspace, then pick your container.
Open the Velo template ↗ - 02
Paste your site ID
In Tag Manager, open Tags and click New. Click Tag Configuration, choose Velo CMP and paste your site ID. You’ll find it in your Velo dashboard. Leave everything else as it is.
- 03
Make it load first
Click Triggering, choose Consent Initialization – All Pages, then click Save. This lets Velo start before your other tags.
- 04
Publish and check it
Click Submit, then Publish. Preview alone doesn’t put Velo live. Then open your site in a private window, try the banner, and check that it shows as installed in your Velo dashboard.
Next.js questions,
answered.
What teams installing on Next.js ask first.
Does this work with the App Router and the Pages Router?
Yes. The App Router takes the snippet in the root layout and the Pages Router in pages/_document.tsx. We tested both on Next.js 16, with full reloads and with Link navigation.
Should I use next/script instead?
Only with strategy="beforeInteractive" in the root layout, which also worked in our tests. A plain tag is simpler: it is in the HTML from the first byte, while beforeInteractive is started by Next.js’s own loader. Avoid the default afterInteractive and lazyOnload, which load after your other tags can fire.
Does the banner survive client-side navigation?
Yes. Link navigation keeps the same document, so the banner, the button that reopens it and the visitor’s choice all stay in place, and the tag in the layout does not load again.
My site sets a Content Security Policy.
The snippet needs https://cdn.veloconsent.com in script-src and https://app.veloconsent.com in connect-src. Check the browser console after publishing and allow anything else your policy blocks.
Will it slow the site down?
The dashboard snippet loads asynchronously. As with any script, measure its effect on your site and check your tag order; asynchronous loading alone does not guarantee consent defaults run before other tags.
Can an AI assistant do this for me?
Yes. Copy the prompt in Install with agents, just below, into Claude, ChatGPT, Cursor or whichever assistant you already use. It carries the steps on this page, the order the tags have to load in, and the checks the agent has to run before it tells you the job is done.
Or hand it
to an agent.
Copy the prompt into Claude, ChatGPT, Cursor or whichever assistant you already use. It carries everything on this page: both routes, the order the tags have to load in, and the checks that prove it worked.
Paste this prompt into your assistant, then provide your site ID and the complete installation snippet or GTM settings from your Velo dashboard.
Working with an agent that reads the web? Point it at veloconsent.com/llms.txt and /install.md for the same context in plain text.


