At the moment we have 2 options to use geoip-data within piwik
1) using free databases as download from maxmind 2) using advanced, non free databases as download from maxmind (onetime pay and pay for updates)
There is another 3. Option rto get the desired data: 3) using advanced, non free databases as webservices (payed per use) see https://www.maxmind.com/en/geoip2-precision-services and api details: https://dev.maxmind.com/geoip/legacy/web-services/
=> this is really interesting (and not that expensive) if you would like to use the most accurate, most detailed and most actual data but do not have millions of visitors on your websites
[This was extracted and optimized from #3442]
=> how to implement it? that a good question .. especially because of performance -> Maybe having some nightly cron job which fetches the data for the last 24h and add it to the visits?
hmm and of course one could use something like a local cache not having to fetch data for same IPs several times
For performance reasons and privacy reasons we will not let users use the webservice version of geo location. It's faster and safer to use local geo location database. Of course anyone is welcome to build a custom plugin to use such web API, such as: http://plugins.piwik.org/IP2Location
@hpvd @mattab I would love to have the option to at least pay for a more updated local MaxMind database. It helps for me to see an accurate Provider or ISP, and currently that's something I can only get through using a premium subscription at Clicky (because they use Maxmind).
@mattab performance should be no reason anymore when integrating this "only on click" via https://github.com/piwik/piwik/issues/9182
vote for reopening :-)
I have moved to a paid plan on Clicky (www.clicky.com) now. Much easier.
@hpvd this should be done as plugin on marketplace, not in core...
@berters you could also use Piwik Cloud which has the paid maxmind Db
fyi: as a good starting point there is already a official webclient (php) available supporting this https://github.com/maxmind/GeoIP2-php
since there is a slight sign on horizon that there maybe eventually some work on this in the future maybe it's a good time to add some details matured in the time between...
when having this possibility there should be a possibility to
a) limit the number of request - calls per day - calls per month
This is necessary because it's a pay per use service and without having control over it one may get afraid... If the limits take action one of the others geoip services (setup in piwik) should be used (free but less accurate one)
To make this perfect a counter should count how often a limit takes action - within last 30days (for day limit) - within last 12 Month
having this one can decide if one wants to raise the limit or one say it's only a outlier and wants to keep everything as it is.
regarding performance there shouldn't be problem at all because: - usage of pay per use webservice does only make sense on small to medium sites (because otherwise the costs would be higher than buying a database...) - if really necessary/wanted:
-- one can think of collecting geoip data in batch run for a day at night (when server load is low..) -- one can think of fetching geoip data only on click like described https://github.com/piwik/piwik/issues/9182#issuecomment-155834326