If you want to show the consent banner to everyone regardless of geolocation, but want to use different consent methods depending on the users geolocation, then look no further.
Below script changes "Explicit Consent" to "Implicit Consent" if the user is outside of the EU. This means that a consent will automatically be given if the user scrolls down on the website:
<script type="text/javascript">
window.addEventListener('CookiebotOnDialogDisplay', function () {
if (new RegExp(`${Cookiebot.userCountry.toUpperCase()}`).test(
'AT|BE|BG|CY|CZ|DE|DK|EE|ES|FI|FR|GB|GR|HR|HU|IE|IT|LT|LU|LV|MT|NL|PL|PT|RO|SE|SI|SK')) {
Cookiebot.dialog.consentLevel = 'implied';
Cookiebot.dialog.setOnscrollEvent();
}
});
</script>
If you for some reason would want the reversed behavior, going from "Implicit Consent" to "Explicit Consent", if the user is outside of the EU, then use below script:
<script type="text/javascript">
window.addEventListener('CookiebotOnDialogDisplay', function() {
if (new RegExp(`${Cookiebot.userCountry.toUpperCase()}`).test(
'AT|BE|BG|CY|CZ|DE|DK|EE|ES|FI|FR|GB|GR|HR|HU|IE|IT|LT|LU|LV|MT|NL|PL|PT|RO|SE|SI|SK')) {
Cookiebot.dialog.consentLevel = 'strict';
Cookiebot.dialog.detachOnscrollEvent();
}
});
</script>
Comments
0 comments
Please sign in to leave a comment.