What is cloaking?
Cloaking is a technique that consists of displaying information differently depending on the entity wishing to view it.
Cloaking is often prohibited by search engines.
Some SEOs use cloaking in order to display very optimized pages for SEO to search engines, as well as more attractive pages to internauts. It can also be a method to cloak your optimizations.
Other SEOs exchange links and use cloaking to not send out outbound links or avoid reciprocal links.
Other famous websites use cloaking on URLs in order to display optimized URLs to search engines and URLs with this tracking parameter to users. In the latter case, there is absolutely nothing prohibited and the engines will have no valid reason to apply a penalty.
Some very famous scripts such as discussion forum solutions use cloaking in order to present a lighter version to the engines. In this way, they save the server's resources.
In the context of SEO, the professional will try to distinguish robots from human visitors.
There are several forms of cloaking. A cloaking can be based on the IP address, the user agent, the referrer (source URL), the content of a cookie or even the "host" machine of the visitor.
Moreover, the techniques of prerender used for the SEO of websites in Javascript are often of cloaking. However, these techniques are not contraindicated by Google they are even recommended.