Versionv1

SPAs and SSR (Next.js, etc.)

Frameworks that hydrate the UI can accidentally load the CMP too late or twice. The rule stays the same: window.INTA then uc.js, as early as possible in the real HTML document.

Next.js (App Router)

  • Prefer app/layout.tsx (or root layout) with a server or client component that emits the snippet in <head>.
  • If you use next/script, ensure the CMP runs before analytics scripts in the document orderstrategy="beforeInteractive" can be appropriate for the CMP loader; avoid loading GA with an earlier effective order.
  • Do not mount the CMP only inside a deep client route (e.g. a single page component) unless every entry route includes it.

React (SPA)

  • Add the two script tags to public/index.html or the framework’s HTML template, not only inside a late-mounted component.
  • Search the bundle for duplicate uc.js when adding third-party scripts via plugins.

Vue / Nuxt / SvelteKit

  • Use the framework’s root layout or app.html / head hooks so the CMP is in the initial HTML response for the first paint.

Verify

  1. View Page Source (not only Elements): uc.js should appear in the raw HTML.
  2. Debugging if the banner is missing or consent resets on navigation.

← Documentation home

Last updated