发布于:2021-01-23 00:00:42
0
95
0
检测用户的地理位置信息为您提供了巨大的优势:改进的转换、更好的细分和分析,以及提供更相关的内容。有很多付费服务可以提供地理位置信息,但它们往往过于昂贵或缺乏有价值的信息。我对IP地理定位API印象非常深刻,这是一个免费的地理定位API,它提供了额外的细节,如语言和货币代码!
IP地理定位API的URL格式很简单:
GET https://api.ipgeolocationapi.com/geolocate/91.213.103.0
响应负载如下所示:
{ "continent":"North America", "address_format":"{{recipient}}n{{street}}n{{city}} {{region_short}} {{postalcode}}n{{country}}", "alpha2":"US", "alpha3":"USA", "country_code":"1", "international_prefix":"011", "ioc":"USA", "gec":"US", "name":"United States of America", "national_destination_code_lengths":[ 3 ], "national_number_lengths":[ 10 ], "national_prefix":"1", "number":"840", "region":"Americas", "subregion":"Northern America", "world_region":"AMER", "un_locode":"US", "nationality":"American", "postal_code":true, "unofficial_names":[ "United States", "Vereinigte Staaten von Amerika", "États-Unis", "Estados Unidos", "アメリカ合衆国", "Verenigde Staten" ], "languages_official":[ "en" ], "languages_spoken":[ "en" ], "geo":{ "latitude":37.09024, "latitude_dec":"39.44325637817383", "longitude":-95.712891, "longitude_dec":"-98.95733642578125", "max_latitude":71.5388001, "max_longitude":-66.885417, "min_latitude":18.7763, "min_longitude":170.5957, "bounds":{ "northeast":{ "lat":71.5388001, "lng":-66.885417 }, "southwest":{ "lat":18.7763, "lng":170.5957 } } }, "currency_code":"USD", "start_of_week":"sunday" }
我很感激一些额外的信息:
address_format - 并非每个国家都以相同的方式格式化它们的地址,了解地址格式有助于确保投递到达那里
country_code - 有用的电话号码
unofficial_names - 有助于获得一个国家的本地化名称
languages_official
&& languages_spoken
- 用于翻译。
简而言之,您将获得大量基于IP地址的信息!
IP地理定位不仅仅是针对IP——API还提供了一个端点来获取国家信息:
// https://api.ipgeolocationapi.com/countries/US { "continent": "North America", "address_format": "{{recipient}}n{{street}}n{{city}} {{region_short}} {{postalcode}}n{{country}}", "alpha2": "US", "alpha3": "USA", "country_code": "1", "international_prefix": "011", "ioc": "USA", "gec": "US", "name": "United States of America", "national_destination_code_lengths": [ 3 ], "national_number_lengths": [ 10 ], "national_prefix": "1", "number": "840", "region": "Americas", "subregion": "Northern America", "world_region": "AMER", "un_locode": "US", "nationality": "American", "postal_code": true, "unofficial_names": [ "United States", "Vereinigte Staaten von Amerika", "États-Unis", "Estados Unidos", "アメリカ合衆国", "Verenigde Staten" ], "languages_official": [ "en" ], "languages_spoken": [ "en" ], "geo": { "latitude": 37.09024, "latitude_dec": "39.44325637817383", "longitude": -95.712891, "longitude_dec": "-98.95733642578125", "max_latitude": 71.5388001, "max_longitude": -66.885417, "min_latitude": 18.7763, "min_longitude": 170.5957, "bounds": { "northeast": { "lat": 71.5388001, "lng": -66.885417 }, "southwest": { "lat": 18.7763, "lng": 170.5957 } } }, "currency_code": "USD", "start_of_week": "sunday" }
最重要的是,IP地理位置API是开源的,所以您可以检查代码,运行您自己的服务器,甚至如果您愿意也可以做出贡献!开源增值!
IP地理定位API是一个非常有用的工具,能够帮助你进行本土化、盈利、转换,并提供出色的用户体验。
作者介绍