Cloaking is one of many blackhat techniques that can bury your site or even get a website excluded from the index of search engines. As with almost everything, there is both a beneficial and irritating side to cloaking.
What Is Cloaking?
Cloaking involves preparing two or more versions of the same page: the readable version for human visitors and another for search engine robots. The version for search engines is usually optimised to give the appearance that the page is keyword-rich, for instance, so that the site makes headway in search engine listings. But if all the keywords (dozens, even hundreds of vaguely relevant possibilities) were in the readable content, it would quickly irritate human readers.
It's cheating, right?
Yes. Cloaking is outright cheating and an attempt to manipulate search engines. It is a constant battle of wits with search engines that need to neutralise such attempts for fear of antagonising their own customers. Otherwise, the integrity of search results is at risk.
How Is Cloaking Done?
Cloaking is a server-side operation. A special script is deployed on the server. When a request arrives, the script delivers the version appropriate to the IP and the user agent of the request. Since search engines identify themselves as spiders, not as browsers, the user agent check results in serving up the especially-prepared page.
Is There a Positive Side to It?
On the other hand, a technique similar to cloaking is also routinely used for serving up, in the lingo of Internet marketing, targeted content. This is geotargeting (short for "geographical targeting"), a server–side technique for discriminating the geographical location of a visitor and displaying appropriate content.
A well-known example of this is when a Vancouver resident and a Hong Kong businessman both type in the www.google.com URL. The former receives google.ca (with local merchant advertising, naturally) while the latter is pleased to get the Chinese-language version. Similarly, Canadians who type in www.sears.com never reach the New York headquarters. They receive www.sears.ca instead.
Geotargeting is a legitimate application of cloaking because, privacy issues aside, the web site merely provides what is logically the appropriate or preferable version to each user. As we have seen, search engines already practice cloaking and selective display of query results.
As you can see, there is a line that separates unethical and ethical cloaking. Make sure you do not cross over.