CookieScript allows you to show cookie banners based on the visitor’s location. This is useful when you want to display different banners for different regions, for example, one banner for visitors from Europe and another banner for visitors outside Europe.
Geo-targeting is configured when generating the CookieScript installation code. After selecting the required geo-targeting option, you must copy the newly generated code and install it on your website.
Saving the geo-targeting setting inside the banner is not enough. The geo-targeting logic is included in the generated CookieScript code.
Where to find geo-targeting settings
To configure geo-targeting:
Log in to your CookieScript account.
Open the banner you want to configure.
Go to Install.
Select the required geo-targeting option.
Copy the newly generated CookieScript code.
Install the code on your website.
You can choose a Global or Custom geo-targeting option, depending on where the banner should be displayed.
Important: install geo-targeted code directly in the website header
If you use geo-targeting, the geo-targeted CookieScript code must be installed directly in the <head> section of your website.
Do not install geo-targeted CookieScript code through Google Tag Manager.
If geo-targeted CookieScript code is installed through GTM, you may experience issues such as:
incorrect location detection;
the banner not loading;
the wrong banner being shown;
unexpected behavior with scripts or consent settings.
This can happen because Google Tag Manager and CookieScript use different methods to determine the visitor’s location. When geo-targeted CookieScript code is loaded inside GTM, the location detection may become unreliable.
For best results, always add geo-targeted CookieScript code directly to your website header.
Example: showing one banner in Europe and another outside Europe
For example, you may want to show:
one banner only to visitors from Europe;
another global banner to visitors outside Europe, such as visitors from Japan or other non-European countries.
In this setup:
Create a banner for Europe.
Enable geo-targeting for Europe.
Copy the generated geo-targeted CookieScript code.
Install this geo-targeted code directly in the
<head>section of your website.Create another global banner for visitors outside the targeted region.
The global banner code can be installed through Google Tag Manager.
The main rule is simple:
Geo-targeted CookieScript code should be installed directly in the website header. Global CookieScript code can be installed through GTM.
What happens outside the selected geo-targeted location?
Visitors outside the selected geo-targeted location will not see that specific banner.
If you have disabled third-party scripts through CookieScript, those scripts will be automatically activated for visitors outside the geo-targeted location.
For example, if your banner is targeted only to Europe, visitors from outside Europe will not see that banner, and third-party scripts disabled by that banner will be activated automatically.
Important notes
Geo-targeting is part of the generated CookieScript code. After changing geo-targeting settings, you must copy the new code and update it on your website.
If you use geo-targeting, install the generated geo-targeted code directly in the website <head> section.
Do not install geo-targeted CookieScript code through Google Tag Manager.
Global or non-geo-targeted CookieScript code can be installed through GTM.
Geo-targeting does not work with self-hosted code because the visitor IP is checked on CookieScript servers.
