Definition
Cloaking is the deceptive practice of detecting bot user-agents and serving them different content than humans see. Google + AI engines treat this as a serious violation: cloaked sites are demoted or removed from the index entirely. Anti-cloaking discipline means your pre-rendered HTML (what bots see) must match what humans see post-hydration. Differs from legitimate user-agent-aware delivery like format negotiation (HTML vs JSON for the same URL).
A spam tactic: serve bots a keyword-stuffed page; serve humans a redirect to a malware site. Result: removal from Google index.
How to optimize
Audit by fetching your pages with Googlebot user-agent vs human user-agent: content should be identical. SSR/SSG eliminates the temptation; user-agent forking is a yellow flag.
