“As long as your intent is not suspicious, you can do this and expect to not get banned. That, technically speaking, is cloaking, but Google looks the other way because they’re aware of the intent.” When you handle a request from Googlebot, you can opt to do SSR whereas all other requests are handled normally, delivering scripts for rendering in the browser.
“One server side rendering (SSR) solution offers it only dynamically in concert with spider spotting. What about JavaScript issues? “Cloaking is specifically against Google guidelines, but those guidelines are murky at the moment because of JavaScript,” says Search Engine Land’s Detlef Johnson. Unlike some of the other Toxins, cloaking is not something that can happen by accident - it’s a deliberate attempt to manipulate search results, and if you’re caught doing it, you can expect a very heavy penalty. Showing search engine crawlers something different than what you present to users is called “ cloaking,” and it can potentially be used to trick users into visiting irrelevant or harmful pages. That said, let’s talk about things not to do.
Rest assured, It’s hard to accidentally spam a search engine, and the engines look at a variety of signals before deciding if someone deserves a harsh penalty. (They might even work now, at least until you’re caught.) We recommend staying far away from these tactics, because employing them could result in a penalty or ban. These are shortcuts, or tricks, that may have been sufficient to guarantee a high ranking back in the day when the engines’ methods were much less sophisticated. Anyone entering the realm of search engine optimization is likely to encounter some questionable (aka “black hat”) tactics, or Toxins, as we call them in our Periodic Table of SEO Factors.