Cookie Consent Manager
Geo Targeting
Premium feature.
Consent requirements are not the same everywhere. With geo targeting the shop decides, based on the visitor's country, whether the banner is shown at all — and whether as opt-in or as an opt-out notice.
Legal note: geo targeting is an optimisation, not legal advice. If you are unsure which rules apply to your markets, stay with Always show the banner. It is the safest option and the default.
Step 1: get the GeoLite2 database
The IP → country mapping happens locally. No request leaves your server and no third-party service is contacted. For that the free MaxMind database is required:
- Create a free account at
maxmind.com. - Under Download Databases get GeoLite2 Country in the MMDB format.
- Extract the archive — you need the file
GeoLite2-Country.mmdb.
Step 2: place the database
Put the file into one of the two default directories, relative to the Shopware project directory:
files/geolite2/GeoLite2-Country.mmdb
config/geolite2/GeoLite2-Country.mmdb
If it sits there, the plugin finds it automatically — leave the field Path to the MaxMind GeoLite2 country database empty. Otherwise enter an absolute path or a path relative to the project directory.
The web server user must be able to read the file. Keep it up to date — MaxMind publishes new editions weekly, and an outdated database maps new IP ranges incorrectly.
Step 3: choose the mode
In the plugin configuration under Geo targeting (Premium) → Banner display by region:
| Mode | Behaviour |
|---|---|
| Always show the banner | Default. The banner appears for all visitors. Safest option. |
| Show banner only for EU/EEA visitors | Normal opt-in banner in countries with a consent requirement. Elsewhere: no banner, all scripts load immediately. |
| Smart: opt-in for EU, small opt-out notice elsewhere | Normal opt-in banner in countries with a consent requirement. Elsewhere: scripts load immediately, but a small notice bar allows objection. |
Step 4: review the country list
The field Countries requiring consent normally stays empty — then the built-in list applies: EU-27 plus Iceland, Liechtenstein, Norway and the United Kingdom.
To deviate, enter comma-separated ISO 3166 alpha-2 codes, for example:
DE, AT, CH, FR, IT, GB
The list you enter replaces the built-in list completely — it does not extend it.
How the country is determined
Detection runs in this order:
- Logged-in customers — the country of the shipping address applies. That is more accurate than any IP lookup.
- Everyone else — lookup of the client IP in the GeoLite2 database.
- No result — if the IP is private, the database is missing or the address is not contained, the country counts as unknown and the banner is shown.
That fallback is deliberate: when in doubt, ask rather than track.
Common pitfalls
- Reverse proxy or CDN — with Varnish, a load balancer or Cloudflare in front, Shopware sees the proxy's IP instead of the visitor's unless configured. Set
trusted_proxiesin the Shopware configuration, otherwise everyone ends up in the same "country" or in the fallback. - HTTP cache — the banner is rendered server-side. Make sure your caching strategy does not reuse a response across country borders. When in doubt use Always show the banner.
- Local testing — requests from your own network carry a private IP. The result is always the fallback (banner visible). Use an external connection or a VPN to test.
- Premium not active — without the in-app purchase geo targeting is inactive and the banner always appears.
- Database missing — without a readable
.mmdbfile the fallback applies as well. That is not an error, but geo targeting has no effect then.
Interaction with Google Consent Mode
Geo targeting only controls whether you ask. If you additionally want different Google defaults per region, use Region-specific defaults under Google Consent Mode & Tracking. Both features can be combined.