Geolocation is based on the MaxMind GeoIP2 database paid for by the WMF, and is used in two ways:
- Varnish adds a cookie called
GeoIP(only if the request does not already have one), with lifetime set to the current session, in the format
<ISO 3166-1 country code>:<ISO 3166-2 region code>:<city name>:<lat>:<long>:<???>
- The analytics pipeline adds geolocation data to the
geocoded_datafield of the
webrequesttable, based on the IP address.
To look up data by hand, log in to mwlog1001 or mwmaint1002 and run
mmdblookup --file /usr/share/GeoIP/GeoIP2-City.mmdb --ip <IP> (see here for documentation of the returned data structure) or, if you just want a single field, something like
mmdblookup --file /usr/share/GeoIP/GeoIP2-City.mmdb --ip <IP> country names en.
The information below is probably outdated.
As usual, geolocation being a fundraising-related thing (first introduced in 2009), there's only mystery around it. Here's some sparse links:
- Analytics/Geolocation, published in 2014
- Slowness of GeoIP lookup and workarounds
- gerrit:260316 documents the cookie format
- Analytics/Geowiki documents one way to use the geolocation data
- meta:Geonotice (discussing alternatives to current system for regional-level geolocation)
- "ryan lane says that our geoip service is probably not fine grained enough": meta:IRC office hours/Office hours 2012-01-12
- Extension:CentralNotice might happen to contain some information in a far future.
- meta:MaxMindCityTesting was a test of a geolocation DB data provider
- "Can 3rd parties use geoiplookup.wikimedia.org" (like ULS on another MediaWiki installation)? No known problems on WMF end.
- As of 2015, GeoIP information is set by varnish in a cookie, see phabricator:diffusion/OPUP/history/production/templates/varnish/geoip.inc.vcl.erb for more information and gerrit:190964 for an overview of the system.
- As of 2016, the geoiplookup service was shut down.