How do sites like Groupon segment geolocation base

2020-06-25 04:54发布

Say you visit Groupon from the entry point Agoura Hills, CA - how would Groupon go about referencing that town to the nearest city that has deals (like Los Angeles) and choosing that as the closest?

Is it grabbing lat/long from the location and calculating the distance from all available cities, choosing the shortest? If so, where can you get lat/long data like that for each city or an open api to use for this purpose?

1条回答
姐就是有狂的资本
2楼-- · 2020-06-25 05:35

Groupon seems to use limelightnetworks as their CDN provider and most CDNs due to their distributed nature having some kind of geo-location database which they can map the request which is coming from the region. At the CDN's hands those information is easy, and site can be work with that information further. All that would be required is someway for the DNS to inform the server and this is not a new concept.

There is a also a geolocation API spec, which would allow browsers/clients to send information about the users location to the server (which the server can use for customization). Those act number of factors such as DNS, your wireless AP, etc. But that is still in draft stage and some google services use it and it requires browser support too.

查看更多
登录 后发表回答