dart-lang / tools

This repository is home to tooling related Dart packages.
BSD 3-Clause "New" or "Revised" License
30 stars 21 forks source link

Implement geolocation #242

Open eliasyishak opened 7 months ago

eliasyishak commented 7 months ago

GA4 does not behave like GA3, we should have a mechanism for resolving geolocation data within the package if GA4 is unable to support this feature

eliasyishak commented 7 months ago

http://ip-api.com/json seems to be a promising but we may not be permitted to use it... from the home page, "Free for non-commercial use"

eliasyishak commented 7 months ago

https://ipregistry.co/ another alternative but this has a cost... and with us having this package be open-source, we would have to expose our API key publicly.. likely not a good option

eliasyishak commented 7 months ago

https://freeipapi.com/ this alternative seems to be free and doesn't require an API key. Website also says it is permitted for commercial use

Simply running curl https://freeipapi.com/api/json/8.8.8.8 returns json for that IP endpoint

{
    "ipVersion": 4,
    "ipAddress": "8.8.8.8",
    "latitude": 37.386051,
    "longitude": -122.083847,
    "countryName": "United States of America",
    "countryCode": "US",
    "timeZone": "-08:00",
    "zipCode": "94035",
    "cityName": "Mountain View",
    "regionName": "California",
    "isProxy": false,
    "continent": "Americas",
    "continentCode": "AM"
}