At HotelTonight, we want our hotel deals to be as accessible as possible to our customers, which means reducing time spent doing tedious things such as signing up and logging in.
Accordingly, it occurred to us recently that we could save many of our customer a few seconds if we autocomplete their email domain while they’re typing. At the time of this writing, over 75% of our customers' email addresses are from just five domains (gmail.com, yahoo.com, hotmail.com, aol.com, comcast.net). so we should be able to make a pretty accurate educated guess.
Autocompleting email addresses can be tricky to implement because it can easily become distracting and get in the user’s way. It’s something that should be completely optional and never overbearing. Therefore, we’ve come up with a solution that works as follows:
- Start suggesting an email domain once the user types @
- Each time the user types a character after @, re-evaluate the suggestion (i.e. typing “@h” yields “@hotmail.com”, while “@hote” produces “@hoteltonight.com”).
- Stop suggesting once the user types “.” – to allow subsets of domains to be used. For example, gmail.co instead of gmail.com. Plus, once the user has typed a period we figure they’re intent on finishing the whole thing, so we’d like to get out of their way.
The first email address that appears after the user types @ is @gmail.com, which means that a full third of our users won’t have to finish the “gmail.com” part. For them, the days of fat fingering “@gmail.con” are over.
Our solution relies on HTAutocompleteTextField, which can be used to autocompletion any type of data in a text field (for example, a URL), as the logic is written by the developer.
We think this is pretty swell, and we’d love to see this used in every app, because, frankly, we as users are sick of typing “gmail.com” over and over again. Check out HTAutocompleteTextField on Github and the accompanying example for the implementation details.
Interested in building something great?
Join us in building the worlds most loved hotel app.
View our open engineering positions.