GEOIP — Geolocation
GEOIP performs IP geolocation using the MaxMind GeoLite2 database. In site mode, the visitor's IP is automatically available. Pass a specific IP string to look up any address.
| Verb | Returns |
|---|---|
GEOIP ADDRESS SET ?ip | Visitor's IP address string |
GEOIP CITY SET ?city | City name |
GEOIP COUNTRY SET ?country | Country name |
GEOIP REGION SET ?region | State / province |
GEOIP LAT SET ?lat | Latitude (number) |
GEOIP LON SET ?lon | Longitude (number). LNG is accepted as an alias. |
GEOIP ALL SET ?geo | Full object: {ip, city, country, region, lat, lon} |
GEOIP "1.2.3.4" SET ?geo | Look up a specific IP — returns full object |
Client IP — in site mode
GEOIP ADDRESS SET ?ip
AFTER GEOIP CITY SET ?city
AFTER GEOIP COUNTRY SET ?country
AFTER EMIT ?ip & " — " & ?city & ", " & ?country
Try it ›
Full geo object
GEOIP ALL SET ?geo
AFTER EMIT ?geo
Try it ›
Look up a specific IP
GEOIP "8.8.8.8" SET ?geo
AFTER EMIT ?geo(city) & ", " & ?geo(country)
AFTER EMIT ?geo(lat) & " / " & ?geo(lon)
Try it ›