Log in

View Full Version : OnLoad detect country and redirect script



Flock001
01-11-2013, 04:10 PM
Hi guys,

i hope you can help. I am looking for a script that will detect whether or not the user is based in the UK or Internationally and then change the page according to which geographical location the user is in.

Can you help at all please? Thanks

Beverleyh
01-11-2013, 06:43 PM
Google is your friend: http://www.google.com/m?q=country%20detection%20script

However, you might want to avoid doing this as its not necessarily 100% reliable. I would say the better option would be to provide an easily visible country selection menu so the user can choose their own country - or use a combination of the 2 - - what if a visitor was travelling abroad and wanted to view content for their own region? Without the option to change they'd be pretty stuck.

ajfmrf
01-12-2013, 12:20 AM
I have a nice list of countries here if it helps:
http://www.web-user.info/forms/scrollingcheck/country.html
http://www.web-user.info/forms/scrollingcheck/final.html

djr33
01-12-2013, 11:48 AM
I've used GeoIP and I like it. For countries it should be reliable (90%+) and there are a few competing services out there that may also work.

It will be a little work to set up, but it may help your website.

However, I agree with Beverley that you need to be careful:
1) It may make mistakes sometimes. Even if that's just 1% of users (and that would be lucky!) then you don't want them to have problems.
2) Your physical location is not always useful information. People go on vacation, and they may want to buy something for when they return.
3) If this has anything to do with languages, the languages people can read don't always correlate with location-- maybe they're recent immigrants, or maybe you don't have their native language available so they need to pick the next best option-- for example Hungarians might pick German, and you'd have very little chance knowing that.

So... I suggest using the IP information as a first guess. I'm not sure I'd recommend using a redirect with it, but if you can actually integrate conditional content, that would be best. Or a redirect is fine as long as it isn't limiting or substantially different-- one page for people in the UK, and one page for others; but they have the same content overall.

Then I think you MUST allow them an easy way to switch between the websites. If there are reasons that it might be a problem, inform the user. You shouldn't/can't rely on this information such as for tax purposes, etc., or anything important.


And just for convenience-- for me while traveling I absolutely hate how Google doesn't let me choose my location for searches and attempts to "guess" what I want based on where I happen to be. It's hard to work around this (but there are options; I have an add-on for firefox now, for example), and there's really no reason it should be a problem. I like that it guesses my location and may be helpful if I want something local, but I hate that sometimes it limits what I can do. So again, make a first guess, and let the user do the rest.



In fact, if this is important, you might consider having a one-time first page that asks them their location. You can use a locating script to guess for them and say "Are you in the UK?" or "Are you outside the UK?" based on what you know-- but then they can confirm this and you'll know the answer is right (and accurate for the individual, not their current physical location).

That may sound excessive, but it is used fairly often for business websites. One that comes to mind is the FedEx website: http://www.fedex.com/