Google posted some guidelines on how you can conduct A/B or multivariate testing and stay clear of any issues with being listed in its search engine, such as avoiding penalties.
Google says you shouldn’t cloak, show its crawlers something that humans wouldn’t see. From its post:
Make sure that you’re not deciding whether to serve the test, or which content variant to serve, based on user-agent. An example of this would be always serving the original content when you see the user-agent “Googlebot.” Remember that infringing our Guidelines can get your site demoted or removed from Google search results—probably not the desired outcome of your test.
We recommend using rel=”canonical” rather than a noindex meta tag because it more closely matches your intent in this situation. Let’s say you were testing variations of your homepage; you don’t want search engines to not index your homepage, you just want them to understand that all the test URLs are close duplicates or variations on the original URL and should be grouped as such, with the original URL as the canonical. Using noindex rather than rel=”canonical” in such a situation can sometimes have unexpected effects.
Use 302s, Not 301s
Google recommends using the temporary direction method, a 302, over the permanent 301 redirect:
Don’t Run Experiments Longer Than Necessary
If you’ve been running an experiment longer than Google expects one should run, it warns that you could face penalty. How long is too long isn’t said. Google just says:
Once you’ve concluded the test, you should update your site with the desired content variation(s) and remove all elements of the test as soon as possible, such as alternate URLs or testing scripts and markup. If we discover a site running an experiment for an unnecessarily long time, we may interpret this as an attempt to deceive search engines and take action accordingly. This is especially true if you’re serving one content variant to a large percentage of your users.
If you follow these guidelines, Google does not promise there will be no impact in your search results but does say there will be “little or no impact on your site in search results.”