使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
最大限度地降低 A/B 测试在 Google 搜索中的影响
本文将介绍如何确保在测试网页内容或网页网址变体时,最大限度地降低对网站在 Google 搜索中的排名的影响。虽然本文并不会阐述如何构建或设计测试,但您可在本文的末尾处找到更多与测试相关的资源。
测试概览
网站测试是指试用网站(或网站的某一部分)的不同版本并收集与用户对每个版本的反应相关的数据。
-
A/B 测试是指测试某项变更的两个(或更多)变体。例如,您可以测试为按钮使用不同字体的效果,看看这能否增加按钮点击次数。
-
多变量测试是指您一次可以测试多种类型的更改,看看每项更改的影响以及更改之间的潜在协同关系。
例如,您不仅可以为某个按钮试用多种字体,还可以尝试同时更改(和不更改)网页其余部分的字体。新字体是否更便于阅读?是否应该在所有地方使用?或者,按钮字体看起来是否有别于网页的其余部分?这是否有助于吸引用户的注意力?
您可以使用软件比较网页(网页的某些部分、整个网页或整个多页流程)的不同变体的行为,并跟踪哪个版本对用户最有效。
您可以为某个网页创建多个版本来运行测试,每个版本都要有自己的网址。
当用户尝试访问原始网址时,您需将部分用户分别重定向到每个变体网址,然后比较用户的行为以了解哪个网页最有效。
您还可以通过在网页上动态插入变体来运行测试,而无需更改网址。您可以使用 JavaScript 来决定显示哪个变体。
即使 Google 在您运行测试期间抓取了您的部分内容变体或将其编入了索引,也可能无关紧要,具体取决于您正在测试什么类型的内容。一些细微的更改(例如按钮或图片的尺寸、颜色或放置位置,或“号召性用语”的文字[“加入购物车”/“立即购买!”])可能会对用户与网页的互动情况产生出乎意料的影响,但对该网页的搜索结果摘要或排名却往往只会产生极小的影响或者毫无影响。
此外,如果我们对您网站的抓取频次足以让系统检测到您的实验内容并将其编入索引,那么在您完成实验后,我们可能也会以足够快的速度将您对网站做出的最终更新编入索引。
测试时的最佳做法
要想避免在测试网站变体期间对网站的 Google 搜索行为造成任何不良影响,请参阅下列最佳做法:
不要伪装测试网页的真实内容
请勿向 Googlebot 呈现一组网址,而向用户呈现另一组网址。这种行为称为伪装真实内容,无论您是否在运行测试,这种做法都违反了我们的网络垃圾政策。请注意,违反 Google 的网络垃圾政策可能会导致您的网站从 Google 搜索结果中遭到降位或移除(这可能并不是您想要的测试结果)。
只要您伪装了真实内容,无论是通过服务器逻辑或 robots.txt 还是通过任何其他方法,都会被视为违规行为。
因此,您不妨改用下文所述的链接或重定向。
使用 Cookie 控制测试时请注意,Googlebot 通常不支持 Cookie。这意味着,Googlebot 将只能检测到使用不支持 Cookie 的浏览器的用户可访问的内容版本。
使用 rel="canonical"
链接
如果您针对多个网址运行测试,可对所有备用网址使用 rel="canonical"
链接属性,指明原始网址是首选版本。我们建议您使用 rel="canonical"
(而非 noindex
meta
标记),因为在这种情况下它更符合您的意图。例如,在测试首页的变体时,您并不想让搜索引擎避免将首页编入索引,而是只想告知搜索引擎,所有测试网址都是原始网址的近似副本或变体,因此应被归为一组且以原始网址作为规范网址。在这种情况下,使用 noindex
(而非 rel="canonical"
)有时可能会产生意外的不良影响。
使用 302
(而非 301
)重定向
如果您运行的是会将用户从原始网址重定向到变体网址的测试,请使用 302 (temporary)
重定向,而非 301 (permanent)
重定向。这会让搜索引擎知晓此重定向是临时的,只有当您运行实验时它才会奏效,并且它们应将原始网址保留在各自的索引中,而不应将其替换为重定向的目标(测试网页)。您也可以使用基于 JavaScript 的重定向。
实验仅持续必要的运行时长
一项可靠的测试所需的时间将取决于转化率以及网站获得的流量等因素;一款优良的测试工具能够在您收集的数据足以得出可靠的结论时告知您。一旦完成测试,尽快使用所需的内容变体更新网站,并移除所有测试元素,例如备用网址或测试脚本和标记。如果我们发现某个网站运行实验的时间过长,我们可能会将此理解为试图欺骗搜索引擎并会采取相应措施,尤其是当您将一个内容变体提供给大量用户时。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-04。
[null,null,["最后更新时间 (UTC):2025-08-04。"],[[["\u003cp\u003eWebsite testing involves comparing different versions of a website or page to see how users react.\u003c/p\u003e\n"],["\u003cp\u003eTo minimize search impact during testing, use \u003ccode\u003erel="canonical"\u003c/code\u003e for alternate URLs, 302 redirects for temporary variations, and avoid cloaking.\u003c/p\u003e\n"],["\u003cp\u003eConclude tests promptly after gathering sufficient data and update your site with the winning variation to prevent potential search engine penalties.\u003c/p\u003e\n"],["\u003cp\u003eWhile testing can impact Google Search results, following best practices ensures minimal disruption and accurate indexing.\u003c/p\u003e\n"]]],["To minimize the impact of A/B testing on Google Search, avoid cloaking and use `rel=\"canonical\"` links on alternate URLs to indicate the original as preferred. Employ `302` redirects for temporary URL variations instead of `301`. Run tests only as long as necessary and promptly remove testing elements afterward. Small content variations generally don't significantly affect search performance. If tests run excessively, Google may consider it deceptive.\n"],null,["# A/B Testing Best Practices for Search | Google Search Central\n\nMinimize A/B testing impact in Google Search\n============================================\n\n\nThis page covers how to ensure that testing variations in page content or page URLs has\nminimal impact on your Google Search performance. It does not give instructions on how to\nbuild or design tests, but you can find more resources about testing at the end of this page.\n\nOverview of testing\n-------------------\n\n\nWebsite testing is when you try out different versions of your website (or a part of your\nwebsite) and collect data about how users react to each version.\n\n- **A/B testing** is where you test two (or more) variations of a change. For example, you may test different fonts on a button to see if you can increase button clicks.\n- **Multivariate testing** is where you test more than one type of change at a time, looking for the impact of each change as well as potential synergies between the changes. For example, you might try several fonts for a button, but also try changing (and not changing) the font of the rest of the page at the same time. Is a new font easier to read and so should be used everywhere? Or is the benefit that the button font looks different to the rest of the page, helping it draw attention?\n\n\nYou can use software to compare behavior with different variations of your pages\n(parts of a page, entire pages, or entire multi-page flows), and track which version is most\neffective with your users.\n\n\nYou can run tests by creating multiple versions of a page, each with its own URL.\nWhen users try to access the original URL, you redirect some of them to\neach of the variation URLs and then compare users' behavior to see which page is most\neffective.\n\n\nYou can also run tests without changing the URL by inserting variations dynamically on the\npage. You can use JavaScript to decide which variation to display.\n\n\nDepending on what types of content you're testing, it may not even matter much if Google\ncrawls or indexes some of your content variations while you're testing. Small changes, such as\nthe size, color, or placement of a button or image, or the text of your \"call to action\" (\"Add\nto cart\" vs. \"Buy now!\"), can have a surprising impact on users' interactions with your page,\nbut often have little or no impact on that page's search result snippet or ranking.\n\n\nIn addition, if we crawl your site often enough to detect and index your experiment, we'll\nprobably index the eventual updates you make to your site fairly quickly after you've\nconcluded the experiment.\n\nBest practices when testing\n---------------------------\n\n\nHere is a list of best practices to avoid any bad effects on your Google Search behavior while\ntesting site variations:\n\n### Don't cloak your test pages\n\n\nDon't show one set of URLs to Googlebot, and a different set to humans. This is called\n[cloaking](/search/docs/essentials/spam-policies#cloaking),\nand is against our\n[spam policies](/search/docs/essentials/spam-policies),\nwhether you're running a test or not. Remember that infringing our spam policies can get your\nsite demoted or removed from Google search results---probably not the desired outcome of your\ntest.\n\n\nCloaking counts whether you do it by server logic or by robots.txt, or any other method.\nInstead, use links or redirects as described next.\n\n\nIf you're using cookies to control the test, keep in mind that Googlebot generally doesn't\nsupport cookies. This means it will only see the content version that's accessible to users\nwith browsers that don't accept cookies.\n\n### Use `rel=\"canonical\"` links\n\n\nIf you're running a test with multiple URLs, you can use the\n[`rel=\"canonical\"` link attribute](https://support.google.com/webmasters/answer/139394)\non all of your alternate URLs to indicate that the original URL is the preferred version. We\nrecommend using `rel=\"canonical\"` rather than a `noindex` `meta` tag\nbecause it more closely matches your intent in this situation. For instance, if you are\ntesting variations of your home page, you don't want search engines not to index your\nhome page; you just want them to understand that all the test URLs are close duplicates or\nvariations on the original URL and should be grouped together, with the original URL as the\ncanonical. Using `noindex` rather than `rel=\"canonical\"` in such a\nsituation can sometimes have unexpected bad effects.\n\n### Use `302` redirects, not `301` redirects\n\n\nIf you're running a test that redirects users from the original URL to a variation URL,\nuse a [`302 (temporary)` redirect](/search/docs/crawling-indexing/301-redirects#temporary),\nnot a `301 (permanent)` redirect. This tells search engines that\nthis redirect is temporary---it will only be in place as long as you're running the experiment---\nand that they should keep the original URL in their index rather than replacing it with the\ntarget of the redirect (the test page).\n[JavaScript-based redirects](/search/docs/crawling-indexing/301-redirects#jslocation)\nare also fine.\n\n### Run the experiment only as long as necessary\n\n\nThe amount of time required for a reliable test will vary depending on factors like your\nconversion rates, and how much traffic your website gets; a good testing tool tells you\nwhen you've gathered enough data to draw a reliable conclusion. Once you've concluded the\ntest, update your site with the desired content variation(s) and remove all\nelements of the test as soon as possible, such as alternate URLs or testing scripts and\nmarkup. If we discover a site running an experiment for an unnecessarily long time, we may\ninterpret this as an attempt to deceive search engines and take action accordingly. This is\nespecially true if you're serving one content variant to a large percentage of your users.\n\nMore information about testing\n------------------------------\n\n- [Google Analytics article](https://support.google.com/analytics/answer/9366791) on content experiments\n- [Google Analytics content testing tools](https://marketingplatform.google.com/about/analytics/)\n- Ask questions about testing on the [Analytics Help Forum](https://support.google.com/analytics/community)\n- Ask questions about impact on search results in the [Google Search Central Help Forum](https://support.google.com/webmasters/community)."]]