#3534 closed New feature (fixed)

Get city, region, country name, lat/long, using via the API UserCountry.getGeolocation

Reported by: hype Owned by: capedfuzz
Priority: major Milestone: 1.10 - Piwik 1.10
Component: Core Keywords: geolocation
Cc: Sensitive: no

Description (last modified by matt)

User request:

Would be great to add a feature where i can use the piwik API to get what country a user is coming from based on ip address: 


Example: 

$url = "http://analytics.com/"; 
$url .= "?module=API&method=Actions.getCountry"; 
$url .= "&userIP=192.11.111.11; 

$fetched = file_get_contents($url) 

But I think more generally there could be a simple API function that will be a proxy to the GeoIP provider currently in use. This could have many interesting uses. The function should check for: Piwik::checkUserHasSomeViewAccess()

Change History (3)

comment:1 Changed 17 months ago by matt (mattab)

  • Description modified (diff)
  • Owner set to capedfuzz
  • Priority changed from critical to major
  • Summary changed from Get country name using API to Get city, region, country name, lat/long, using via the API UserCountry.getGeolocation

comment:2 Changed 17 months ago by matt (mattab)

All info should be returned for a given IP adress, and would return an array containing country/country_code/region/region_code/city/lat/long/etc.

comment:3 Changed 17 months ago by capedfuzz (diosmosis)

  • Resolution set to fixed
  • Status changed from new to closed

(In [7494]) Fixes #3534, add UserCountry.getLocationFromIP method as proxy for GeoIP functionality.

Note: See TracTickets for help on using tickets.