Page MenuHomePhabricator

Split GeoIP into a new component
Open, NormalPublic



Years ago, we would make a GeoIP lookup using a script tag added to the skin by CentralNotice. This was necessary to correctly geotarget campaigns to users, without splitting cache, etc.

This loading method has been deprecated thanks to some great work by @ori and others, and removed from the CentralNotice extension. At this point, the only thing remaining is some Javascript which parses a cookie value set by Varnish VCL into the window.Geo global. Please note that CentralNotice only uses country-level information, the rest of the data is being stored for use by other extensions.


Let's decouple GeoIP from CentralNotice. It could go into MediaWiki core or better yet, its own library and subsystem. Not sure what the best form would be.

Everything which depends on the Geo variable should have an explicit dependency to this library.

We should audit the privacy implications of all geodata usages.


The last I checked, the following extensions make use of GeoIP:

  • CentralNotice
  • WikimediaEvents
  • ImageMetrics
  • NavigationTiming
  • Petition
  • UniversalLanguageSelector
  • WikimediaShopLink

The following extensions seem to be performing their own geolocation:

  • DeviceMapLogCapture
  • DonationInterface
  • FundraiserLandingPage
  • LandingCheck
  • SecureSessions

Event Timeline

awight created this task.Jun 17 2015, 4:58 PM
awight raised the priority of this task from to Needs Triage.
awight updated the task description. (Show Details)
awight added subscribers: awight, MBrar.WMF, ori.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 17 2015, 4:58 PM

This sounds like a good idea to me.

Note that is a popular gadget which also depends on the Geo variable to add local notices to watchlists. We should try not to break it. There may be other gadgets/userscripts as well.

Thanks @Pcoombe! That's great to know :)

awight set Security to None.

Change 221759 had a related patch set uploaded (by AndyRussG):
WIP - Don't merge but please review - Refactor client-side API and RL modules for banner display

The patch for review isolates GeoIP from other CentralNotice logic. This should facilitate moving it to a new home. :)

Change 221759 merged by jenkins-bot:
Refactor client-side API and RL modules for banner display

Restricted Application added a project: Operations. · View Herald TranscriptMay 4 2016, 9:14 AM
chasemp triaged this task as Normal priority.May 5 2016, 8:43 PM
Nemo_bis added a subscriber: Nemo_bis.
Krinkle updated the task description. (Show Details)Aug 26 2016, 4:13 AM
Krinkle awarded a token.
Krinkle added a subscriber: Krinkle.
BBlack moved this task from Triage to Watching on the Traffic board.Oct 4 2016, 12:45 PM
awight removed a subscriber: awight.Mar 21 2019, 3:59 PM

Change 518449 had a related patch set uploaded (by Vedmaka Wakalaka; owner: Vedmaka Wakalaka):
[mediawiki/extensions/CentralNotice@master] Finer geo targeting