Forum Moderators: open

Message Too Old, No Replies

Design pattern for customization based on geo-location

         

NickMNS

3:35 am on Jan 8, 2018 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I would like to customize a landing page using IP based geo-location. I am pretty sure I know how to do this but I just wondering if it is the best design pattern or if there is a more elegant, efficient or refined way of doing things.

The website provides stats about events, when a user lands on a page I would like to populate the page with events close to the user's location. The user can then refine his/her search from there. This is really intended for a first interaction, example showing events on the homepage. Once the data is set, I will likely store it in a session cookie for future page views.

So the way I see this working is:
My server receive the users request for the page, I return a shell (page with static content) and collect the ip. I then take the ip, make an ajax call to a 3rd party geo/ip service that returns a json object with the geo-location data (coords, city, country etc...). Then, an ajax request is sent to my db with the geo-data that returns the result and populates the page.

The issue is that this seems like it my take some time, as I first have to wait for a third party and then I have to wait for my server to respond. Am I missing something.

Is this how it is typically done? Is there another way?

keyplyr

11:15 am on Jan 8, 2018 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You could host your own country list on a flat file, which would be fast. Then do all the heavy lifting on page when the visitor gives more specific data. Less risk of bounce.

NickMNS

3:45 pm on Jan 8, 2018 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Keyplyr, that is a good idea but I need city level data (US & CAD). Is such data readily available? How often does it change?

JonathanEdmonton

3:51 pm on Jan 8, 2018 (gmt 0)

5+ Year Member Top Contributors Of The Month



NickMNS maybe this link might help you [github.com...]

NickMNS

4:22 pm on Jan 8, 2018 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Thanks Jonathon, but that is not what I am looking for. I actually already have such a db. What I was asking about was a mapping of IP to cities or geo-coordinates.