Cookie consent for Next.js

GDPR & CCPA cookie banner for Next.js

Add Cookivo to your Next.js root layout so it runs before any analytics, and use the JavaScript API to start your own tracking only after consent.

Set it up in 5 minutes

  1. Create a free Cookivo account and add your domain.
  2. Scan, review trackers and design your banner. Press Publish.
  3. In app/layout.tsx (or pages/_document.tsx), add your install code as plain <script> tags at the top of <head>.
  4. Don't load it with next/script strategy afterInteractive: it must run before other tags to block them.
  5. Use Cookivo.has('analytics') or the cookivo:change event to start your own code after consent.

Full details, including manual blocking and the JavaScript API, are in the documentation.

Designing a cookie banner for Next.js in the Cookivo dashboard

Made for Next.js

Developer API

Cookivo.get(), has(), set(), on('change') and a dataLayer event for custom setups.

Works with Vercel and any host

Two script tags, no build step, no npm package required.

Server-friendly

Read the cookivo_consent cookie on the server if you need to.

Next.js questions

Can I use next/script?

Use strategy beforeInteractive, or plain script tags in the root layout, so Cookivo runs first.

Does it work with the App Router?

Yes. Put the tags in the root layout's <head>.

Other platforms: WordPress · Shopify · Wix · Webflow · Framer · Squarespace

Make your Next.js site compliant today

Free for your first site. No card needed.