Open
Description
📚 What are you trying to do?
I make the follow code for run the script only in a specific countries, but it will be loaded ever without respect the condition
The follow code is inside a composable called in the app.vue of nuxt project.
Can you help me ?
🔍 What have you tried?
const notLoadCookieBanner = ['en-us']
const countryLocale = ref('es-es')
const {
onLoaded,
load: loadCookie,
} = useScript<OneTrust>(
{
src: 'https://cdn.cookielaw.org/scripttemplates/otSDKStub.js',
'data-domain-script': '....',
defer: true,
},
{
trigger: 'manual',
use() {
return window.OneTrust
},
}
)
if (
countryLocale.value &&
notLoadCookieBanner.findIndex(
countryLocaleBanner => countryLocaleBanner === countryLocale.value
) === -1
) {
loadCookie()
}
ℹ️ Additional context
No response