Geo Targeting

Restrict your floating messages and chat widget to visitors from specific countries. FloatMessage uses Cloudflare's infrastructure to accurately determine visitor location.

How It Works

When a visitor loads your embed script, the API checks the CF-IPCountry header automatically set by Cloudflare. This header contains the visitor's ISO 3166-1 alpha-2 country code (e.g., "US", "GB", "JP").

Evaluation Flow

  1. Visitor loads the embed script on your website
  2. Script fetches config from FloatMessage API
  3. API reads CF-IPCountry header
  4. If allowed countries list is set and visitor's country is not in it, returns disabled
  5. Message or chat widget is silently hidden — no error shown to visitor

Configuration

Configure geo targeting in the dashboard when creating or editing a message, or in Chat Settings under Visibility & Conditions.

  • Empty list = show to all visitors globally (default)
  • Selected countries = show only to visitors from those countries
  • Search and select from 249 countries/territories

Supported Countries

FloatMessage supports all 249 ISO 3166-1 alpha-2 country codes. Geo detection is handled server-side by Cloudflare, ensuring accurate results without client-side geolocation prompts.

Notes

  • Geo check happens server-side — the country code never reaches the client if blocked
  • For floating messages, a blocked visitor receives a 403 response
  • For chat widgets, a blocked visitor receives { "enabled": false }
  • Country codes are case-sensitive uppercase (e.g., "US" not "us")
  • Works on Cloudflare-proxied domains. On non-Cloudflare environments, the header may not be available