Setting up country detection on your CDN or host
Pick the one that matches your setup. After setting it up, reload the Detection tab and check the status box.
Cloudflare
Works out of the box. Cloudflare’s IP Geolocation is on by default and sends CF-IPCountry. If the status box shows no country, check Cloudflare dashboard β your site β Network β IP Geolocation is on. The plugin reads the real IP from CF-Connecting-IP.
Bunny.net
Works out of the box. Bunny sends the visitor’s country (CDN-RequestCountryCode) and IP (X-Real-IP) to your server automatically.
Amazon CloudFront
CloudFront only sends these headers when you ask for them:
- In the AWS console, open CloudFront β Policies β Origin request.
- Edit the policy your distribution uses (or create one) and add the headers
CloudFront-Viewer-CountryandCloudFront-Viewer-Address. - Attach the policy to your distribution’s default behavior and wait for the deployment.
Sucuri and Fastly
The plugin reads the real visitor IP (X-Sucuri-ClientIP, Fastly-Client-IP), but these services do not send a country. Add an IP database: WooCommerce’s MaxMind database or the GeoIP Detection plugin (below).
Hosts with GeoIP
If your host sets a country for each request (for example WP Engine GeoTarget, or an Apache/nginx GeoIP module that sets GEOIP_COUNTRY_CODE or MM_COUNTRY_CODE), the plugin uses it automatically. Ask your host if you are not sure.
WooCommerce (MaxMind)
- Create a free MaxMind account and a license key.
- In WooCommerce β Settings β Integration β MaxMind Geolocation, paste the key and save. WooCommerce downloads the database.
- The plugin then looks up visitors’ countries in that database, on your own server.
GeoIP Detection plugin
Install the free GeoIP Detection plugin and choose a data source in its settings (a local MaxMind, DB-IP or IP2Location database). The plugin uses it automatically.
Testing from wp-admin: the status box shows your visit. If you reach wp-admin without going through your CDN (for example on a different domain), the result can differ from what visitors get.