The history of the Internet has been a steady march towards websites that are richer, bigger and more interactive. As websites have become more robust, we — as designers and developers — have often placed the burden on our users to make more decisions, each of which distracts them from their wants and needs.
However, by using a combination of technical solutions and some careful decision-making on our part, we can often remove interface barriers for our users. It’s common for websites to automatically determine whether the user is on a mobile device (although responsive design has made this less relevant in many cases, and browser detection techniques are not without criticism3).
Further Reading on SmashingMag: Link
- A Closer Look At Personas: What They Are And How They Work4
- A 5-Step Process For Conducting User Research5
- User Interface Design in Modern Web Applications6
- Effectively Planning UX Design Projects7
More often than not, though, we’re still asking users to provide their localization information: their language, timezone and country. We can use a combination of techniques to minimize that burden on the user, too. Let’s dig into our bag of tricks and look at how we can handle localization without interrupting the user’s focus.
The most common way of detecting the user’s language is with the
window.navigator.language, which serves a similar purpose, but may be less reliable — particularly cross-browser. Both methods rely on the user having their preferred language set in their operating system, so always provide an option for users to select an alternate language.
Country or Region Link
A lot of attention has been paid to HTML5 geolocation8 recently, and it’s a great thing to have in our tool belt. It’s a generally reliable way to get the user’s current location — provided they are using a modern browser and opt in to providing it to you.
If you’re simply looking for what country a user is located in or what continent they’re on, IP-based geolocation services such as MaxMind9 and IpInfoDB10 (among many others) are a great bet. These solutions are implemented server-side, which may be preferable because the user isn’t required to load up a page and opt in to HTML5 geolocation only to be forwarded on to a new page.
Although IP-based geolocation still generally applies to mobile devices, HTML5 geolocation is widely available on these devices, and may be more reliable — particularly if the user is roaming.
Date.getTimezoneOffset(), which returns the difference between UTC and the user’s local time in minutes. However, there are some edge cases to handle (particularly around Daylight Savings Time), so I strongly recommend using a library such as jsTimezoneDetect11 for reliability and ease of use.
Should We Ask The User? Link
When deciding whether I need a user-facing interface element for a particular setting, I ask myself three questions:
- Can I make a confident determination using a technical solution?
- Can I decide on an intelligent default?
- What are the consequences of guessing wrong?
That last consideration is the most important. If we guess the wrong timezone for a user, is that worse than asking them up front for that information? It depends.
If you’re using the timezone to send a daily email digest, the consequences of being incorrect are probably minor, and it’s likely a worthwhile trade-off. What if we were using the timezone to set the period of time when a user could bid on an item? That’s a different story entirely; the implications of getting that wrong are far more dire, and we shouldn’t rely on behind-the-scenes magic.
Whenever you’re making any assumption on behalf of the user, consider whether it makes sense to provide a way for them to choose a different option than the one you’ve selected for them.
Case Study: UPS Link
How does this all work in practice? We’ll discuss one (very) common mistake, and one possible solution. If you buy or sell much online, you’re probably familiar with UPS12. Let’s look at a huge opportunity for improvement, not only for UPS, but for thousands of other websites as well.
What It Does Wrong Link
Before you do anything on UPS’ website, you’re forced to pick your country and language from a big ugly drop-down list. This means that before finding a UPS Store location, tracking a package or scheduling a pickup, you’re faced with a question — without any explanation whatsoever of why UPS needs an answer.
Locale selection on UPS’ website
I don’t have any insider knowledge of UPS or its website, but common sense would suggest that it must be seeing at least some users drop off at that page. Blocking a user from viewing the website without selecting a locale isn’t consistent with either the user’s goal (tracking or shipping a package, in most cases) or the company’s goal (increasing revenue by shipping packages or promoting related services). So, what do we do instead?
How To Fix It Link
There are plenty of better ways to handle this situation. We could ask for the user’s country only when absolutely necessary (such as when calculating a shipping rate). But the locale (e.g. “United States – English”) also contains the language preference, so non-English-speaking visitors might have a difficult time navigating the website in that scenario. UPS could certainly do plenty to make the list more usable14, but it might not need to do these things at all.
Let’s go back to the basics: our goal is to reliably determine the visitor’s country and language preference. Luckily, we can do both of these things without even prompting the user.
For the country, we can use IP-based geolocation. This technique is imprecise but generally accurate, which is fine for our purposes: we’re looking for a country, here, not a street address.
The language would often be determined by the country, particularly in the case of UPS (which offers only a single language for most countries). In case the user’s locale has multiple common languages, we could use the HTTP
Accept-Language header to default the user to their preferred language. Voila!
We’ve (hopefully) directed the user to the correct version of the website without distracting them from their original goal.
Now, rather than interjecting a distracting page, we’ll add a message to the top of the home page letting the user know that we’ve directed them to the appropriate website, and giving them an opportunity to change the language and country in the unlikely event that our determination was wrong for some reason or in case their preference is different from their current location.
Now, the vast majority of users will never have to think about their locale and can get right down to business, while any users who prefer a different locale would still be empowered to make that selection.
Proceed With Caution Link
So, we should all run out and start using these and similar techniques on all of our websites, right? Not necessarily.
As with anything else, there are trade-offs. Will guessing the country confuse users or feel like an invasion of privacy? Do your users frequently use your application while travelling?
No two websites are the same, and the most important thing you can do is to get into the mindset of your users through research, analytics and interviews. As designers, we’re used to being conscientious while we’re adding interface elements; we need to be even more careful when removing them.
Wrapping Up Link
Adding more checkboxes, drop-down menus and radio buttons to a website is the easiest thing in the world. The technical implementation is straightforward, and the UX trade-offs are well defined.
Putting in the extra work to remove interface elements is sometimes thankless. But creating experiences in which users are only asked relevant information at relevant times makes for happy users, and happy users lead to happy designers.
More Reading Link
- “Accept-Language” specification16, “Hypertext Transfer Protocol — HTTP/1.1,” W3C
- “Accept-Language Used for Locale Setting17,” W3C Internationalization
- “window.navigator.language18,” Gecko DOM Reference, Mozilla
- You Are Here (And So Is Everybody Else)19,” Dive Into HTML5
- FreeGeoIP.net Web Service
- 1 http://www.flickr.com/photos/johanl/8348989885
- 2 http://www.flickr.com/photos/johanl/8348989885
- 3 http://blog.adrianroselli.com/2011/10/detecting-mobile-devices.html
- 4 https://www.smashingmagazine.com/2014/08/a-closer-look-at-personas-part-1/
- 5 https://www.smashingmagazine.com/2013/09/5-step-process-conducting-user-research/
- 6 https://www.smashingmagazine.com/user-interface-design-in-modern-web-applications/
- 7 https://www.smashingmagazine.com/2013/01/effectively-planning-ux-design-projects/
- 8 http://dev.w3.org/geo/api/spec-source.html
- 9 http://dev.maxmind.com/geoip/geolite
- 10 http://ipinfodb.com/ip_location_api.php
- 11 https://bitbucket.org/pellepim/jstimezonedetect
- 12 http://www.ups.com/
- 13 http://www.ups.com/
- 14 https://www.smashingmagazine.com/2011/11/10/redesigning-the-country-selector/
- 15 https://www.smashingmagazine.com/wp-content/uploads/2013/01/after_cropped_sized.png
- 16 http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4
- 17 http://www.w3.org/International/questions/qa-accept-lang-locales.en.php
- 18 https://developer.mozilla.org/en-US/docs/DOM/window.navigator.language
- 19 http://diveintohtml5.info/geolocation.html