Geo Targeting
Geo targeting lets you choose countries where the consent banner should not appear. It’s a CookieRay Pro feature found under Settings → Geo Targeting.
Whether a banner is required for a given audience is a legal decision that depends on your situation. CookieRay is not legal advice — consult a qualified advisor before hiding the banner anywhere.
How to set it up
- Open Settings and find the Geo Targeting card.
- In Hide banner from these countries, search for and select the countries. You can choose from a fixed list of about 190 countries.
- Click Save Rules.
Visitors from the selected countries don’t get the banner or CookieRay’s front-end consent handling (see What “hidden” means). Everyone else sees it by default.
What decides who sees the banner
- If no rules are saved, everyone sees the banner.
- If the visitor’s country matches a saved rule, that rule decides whether the banner is shown.
- If the visitor’s country can’t be detected, the banner is shown. Geo targeting never hides the banner on a guess.
What “hidden” means
When a visitor’s country matches a hidden rule, CookieRay’s front end does not run for that visitor. It’s not only the banner that disappears. For those visitors:
- No consent banner is shown, so no consent is collected or logged.
- No Google Consent Mode signals are sent.
- CookieRay’s front-end script, its early script blocker and your custom CSS are not loaded, so nothing restores a script that was held back.
Some server-side parts still run for them:
- In Block Until Consent (Strict) mode, scripts that WordPress enqueues and that match CookieRay’s tracker list stay blocked. With no banner there is no way to unblock them.
- Pro integration tags (GTM, Meta Pixel, Adobe) are still printed. See Integrations for what each does.
- The trust badge is still shown if it is switched on.
In Log Consent Only mode nothing is blocked, so tracking tags that your site adds itself run as normal for hidden visitors, with no consent signals.
Because this depends on your site, test from a hidden country before relying on it.
Requirement: a country signal from your host
CookieRay does not call an external geolocation service. It reads the country from your server environment. Geo targeting works only if one of these is available:
| Source | Header / variable |
|---|---|
| Cloudflare | CF-IPCountry |
| AWS CloudFront | CloudFront-Viewer-Country |
| Generic proxy or load balancer | X-Country-Code |
| nginx / HAProxy | X-Geo-Country |
| Apache mod_geoip | GEOIP_COUNTRY_CODE |
| Apache mod_maxminddb | MM_COUNTRY_CODE |
| PHP GeoIP extension | A server-local lookup, when the extension and database are installed |
If none of these is present, your rules do nothing and the banner is shown to everyone. Ask your host or CDN how to enable a country header — for example, Cloudflare’s IP Geolocation setting.
Caching
The decision is made on the server when the page is generated. If a page cache serves the same HTML to every visitor, one visitor’s result can be served to others. Make sure your cache or CDN varies by country, or exclude the pages from caching, and test from more than one country before relying on it.