ReloadNotice for Nuxt
Ask the visitor to reload when a withdrawn tool cannot be stopped otherwise.
What it does
Some third-party tools cannot be switched off once they are running. When a visitor withdraws consent for such a tool, this notice appears with a Reload and a Dismiss button. It never reloads on its own; the visitor decides.
Add it
<CookieYesRoot /> does not render it. List the components inside <CookieYesRoot> and add it there; the slot replaces the default contents, so keep the others:
<template>
<CookieYesRoot>
<CookieBanner />
<CookiePreferences />
<RecallButton />
<ReloadNotice />
</CookieYesRoot>
<NuxtPage />
</template>Then mark the tool that cannot be stopped, once, in a plugin that runs before the module's. The SDK reads this list once, when it starts, and the module starts it in a plugin with enforce: "pre" (order -20), so give yours a lower order. registerStopHandler is auto-imported:
export default defineNuxtPlugin({
order: -30,
setup() {
registerStopHandler({ id: "legacy-pixel", category: "advertisement", needsReload: true });
},
});It appears only when a reload is genuinely needed
The notice shows only when a category that was granted is turned off and a tool marked needsReload was running under it. A first-time rejection shows nothing: nothing was running. Once dismissed, it stays away until a new withdrawal needs a reload.
Change what it shows
It has no props. The text comes from the reloadNotice.message, reloadNotice.reloadButton and reloadNotice.dismissButton keys in i18n; see Translations. For your own markup, read the same state with useReloadNotice(), which returns required and dismiss.
Restyle it
Target [data-cy-part="reload-notice"], [data-cy-part="reload-message"], [data-cy-part="reload"] and [data-cy-part="reload-dismiss"] in your CSS.
Common mistakes
I rejected a category and the notice did not appear.
Expected, unless that category was granted before and a needsReload tool was running. Accept first, then reject.
The notice appears for a tool I did not mark. That tool's own stop function threw an error, so CookieYes fell back to asking for a reload.
Next steps
- Integrations: ready-made integrations; only Hotjar needs this
- GatedScript: load a script only after consent