I’ve been working for a client, and the e-commerce solution I built along with Mandy for them has a multi-currency feature. They wanted to have the customer shown the most suitable currency when they arrive on the site, and so we had to come up with a way to do that.

The first thing was to find out which country they were in, and the answer we fell to first was a lookup service by IpLocate. I think that decision was mainly driven by cost, though it was checked for ease of integration. There are lots of competitors in the field.

The service will tell you the 2 letter ISO country code See Alpha-2 codes here for any given Ip address. The idea being, that once we know the country the customer is in, we can deliver the most appropriate currency.

Some countries were important to the client, but most were not., and most countries were not important at all made this job easier. The client knew which countries they cared about.

Well, shortly after that went live we realised that cloudflare offer the same information in the headers as part of their offering. So we informed the customer and the decision was made to run on iplocate for a year and then make an analysis.

Well, that happened today and the results are in

  • iplocate and cloudflare agree on 98% of the ip addresses we gave them over the year
  • iplocate always provides a country code. Cloudflare failed to do that 1.5% of the time.
  • Where they differed I did a quick comparison with a third provider and found that iplocate were more accurate.

We also considered that dropping iplocate meant quicker round trips on the first visit, and a simplified stack.

The customer then made a return on investment type decision about accuracy vs cost for their needs. I’m mainly interested in how they ended up with different answers. Perhaps iplocate is better because it always had an answer, but perhaps it’s sometimes not as simple as that, and sometimes the ip address is not actually known to be at one location or another, making cloudflare more accurate.

What is the ultimate source of this information anyway? Wikipedia has a view on this and it’s actually quite a complicated picture. So there’s nothing there that makes it easy for me to point at which of iplocate and cloudflare are actually more accurate from a first-principles point of view.