Next.js Discord

Discord Forum
{children}
)The cookie consent keeps appearing on page refresh, I tried with beforeInteractive and didn't work, afterInteractive works (even if it seems not optimal for the cookie banner) but I cannot understand how to avoid to reload the script Someone has managed to solve the problem?","dateCreated":"2023-09-26T12:42:52.000Z","answerCount":0,"author":{"@type":"Person","name":"Tropical Parula"}}}

cookie consent banner Iubenda keeps asking

Unanswered
Tropical Parula posted this in #help-forum
Open in Discord
Tropical ParulaOP
In app router under app/layout.tsx I'm using Iubenda in this way:

return (
<html
lang={params.lang}
className={${canelaDeck.variable} ${manrope.className} ${playfair.className}}
>
<Script id="iubenda">
{var _iub = _iub || []; _iub.csConfiguration = {"askConsentAtCookiePolicyUpdate":true,"enableFadp":true,"enableLgpd":true,"enableUspr":true,"fadpApplies":true,"floatingPreferencesButtonDisplay":"bottom-right","perPurposeConsent":true,"siteId":xxxxxxxx,"usprApplies":true,"whitelabel":false,"cookiePolicyId":xxxxxxxxxx,"lang":"it", "banner":{ "acceptButtonDisplay":true,"closeButtonDisplay":false,"customizeButtonDisplay":true,"explicitWithdrawal":true,"listPurposes":true,"position":"float-top-center","rejectButtonDisplay":true }};}
</Script>
<Script
type="text/javascript"
src="https://cs.iubenda.com/autoblocking/3302591.js"
strategy="afterInteractive"
></Script>
<Script
type="text/javascript"
src="//cdn.iubenda.com/cs/gpp/stub.js"
strategy="afterInteractive"
></Script>
<Script
type="text/javascript"
src="//cdn.iubenda.com/cs/iubenda_cs.js"
strategy="afterInteractive"
async
></Script>

<body>
<Providers>
<main className="relative">{children}</main>
</Providers>
</body>
</html>
)


The cookie consent keeps appearing on page refresh, I tried with beforeInteractive and didn't work, afterInteractive works (even if it seems not optimal for the cookie banner) but I cannot understand how to avoid to reload the script


Someone has managed to solve the problem?

0 Replies