<script>
function onClick(e) {
e.preventDefault();
grecaptcha.ready(function() {
grecaptcha.execute('reCAPTCHA_site_key', {action: 'submit'}).then(function(token) {
// Add your logic to submit to your backend server here.
});
});
}
</script>
{"success":true|false,// whether this request was a valid reCAPTCHA token for your site"score":number// the score for this request (0.0 - 1.0)"action":string// the action name for this request (important to verify)"challenge_ts":timestamp,// timestamp of the challenge load (ISO format yyyy-MM-dd'T'HH:mm:ssZZ)"hostname":string,// the hostname of the site where the reCAPTCHA was solved"error-codes":[...]// optional}
[null,null,["最后更新时间 (UTC):2025-07-25。"],[[["\u003cp\u003ereCAPTCHA v3 provides a score-based system to assess user interactions without interrupting their experience, allowing you to take appropriate actions based on risk levels.\u003c/p\u003e\n"],["\u003cp\u003eYou can implement reCAPTCHA v3 by either automatically binding it to a button or programmatically invoking it for more control over when it runs.\u003c/p\u003e\n"],["\u003cp\u003ereCAPTCHA v3 uses "actions" to categorize interactions, providing detailed data breakdown and adaptive risk analysis based on the specific context.\u003c/p\u003e\n"],["\u003cp\u003ereCAPTCHA v3 returns a score along with other details that you should verify on your backend to ensure the response is valid and the action is expected.\u003c/p\u003e\n"],["\u003cp\u003eYou should analyze reCAPTCHA v3 scores within your admin console and adjust action thresholds based on your site's traffic and risk tolerance, starting with a default of 0.5.\u003c/p\u003e\n"]]],["reCAPTCHA v3 provides a score per request, indicating the likelihood of a good interaction. Implement it by registering keys and including the JavaScript API. Execute reCAPTCHA on forms, actions, or in the background using either an automated button binding or the `grecaptcha.execute` method. Verify the response token, and interpret scores (0.0-1.0) to decide actions like requiring multi-factor authentication. Define action names to gain detailed data in the admin console. Always verify the action name in the response.\n"],null,["# reCAPTCHA v3 returns a score for each request without user friction. The score is based on interactions with your site and enables you to take an appropriate action for your site. Register reCAPTCHA v3 keys on the [reCAPTCHA Admin console](https://www.google.com/recaptcha/admin/create).\n\nThis page explains how to enable and customize reCAPTCHA v3 on your webpage.\n\nPlacement on your website\n-------------------------\n\nreCAPTCHA v3 will never interrupt your users, so you can run it whenever you like without affecting\nconversion. reCAPTCHA works best when it has the most context about interactions with your site,\nwhich comes from seeing both legitimate and abusive behavior. For this reason, we recommend\nincluding reCAPTCHA verification on forms or actions as well as in the background of pages for\nanalytics.\n| **Note:** reCAPTCHA tokens expire after two minutes. If you're protecting an action with reCAPTCHA, make sure to call `execute` when the user takes the action rather than on page load.\n\nYou can execute reCAPTCHA on as many actions as you want on the same page.\n\nAutomatically bind the challenge to a button\n--------------------------------------------\n\nThe easiest method for using reCAPTCHA v3 on your page is to include the\nnecessary JavaScript resource and add a few attributes to your html button.\n\n1. Load the JavaScript API.\n\n \u003cscript src=\"https://www.google.com/recaptcha/api.js\"\u003e\u003c/script\u003e\n\n2. Add a callback function to handle the token.\n\n \u003cscript\u003e\n function onSubmit(token) {\n document.getElementById(\"demo-form\").submit();\n }\n \u003c/script\u003e\n\n3. Add attributes to your html button.\n\n \u003cbutton class=\"g-recaptcha\" \n data-sitekey=\"reCAPTCHA_site_key\" \n data-callback='onSubmit' \n data-action='submit'\u003eSubmit\u003c/button\u003e\n\nProgrammatically invoke the challenge\n-------------------------------------\n\nIf you wish to have more control over when reCAPTCHA runs, you can use the\n`execute` method in `grecaptcha` object. To do this,\nyou need to add a `render` parameter to the reCAPTCHA script load.\n\n1. Load the JavaScript API with your sitekey.\n\n \u003cscript src=\"https://www.google.com/recaptcha/api.js?render=reCAPTCHA_site_key\"\u003e\u003c/script\u003e\n\n2. Call `grecaptcha.execute` on each action you wish to protect.\n\n \u003cscript\u003e\n function onClick(e) {\n e.preventDefault();\n grecaptcha.ready(function() {\n grecaptcha.execute('reCAPTCHA_site_key', {action: 'submit'}).then(function(token) {\n // Add your logic to submit to your backend server here.\n });\n });\n }\n \u003c/script\u003e\n\n3. Send the token immediately to your backend with the request to\n [verify](/recaptcha/docs/verify).\n\nInterpreting the score\n----------------------\n\nreCAPTCHA v3 returns a score (1.0 is very likely a good interaction, 0.0 is very likely a bot).\nBased on the score, you can take variable action in the context of your site. Every site is\ndifferent, but below are some examples of how sites use the score. As in the examples below, take\naction behind the scenes instead of blocking traffic to better protect your site.\n\n| Use case | Recommendation |\n|------------|----------------------------------------------------------------------------------------------------------------|\n| homepage | See a cohesive view of your traffic on the admin console while filtering scrapers. |\n| login | With low scores, require 2-factor-authentication or email verification to prevent credential stuffing attacks. |\n| social | Limit unanswered friend requests from abusive users and send risky comments to moderation. |\n| e-commerce | Put your real sales ahead of bots and identify risky transactions. |\n\nreCAPTCHA learns by seeing real traffic on your site. For this reason, scores in a staging\nenvironment or soon after implementing may differ from production. As reCAPTCHA v3 doesn't ever\ninterrupt the user flow, you can first run reCAPTCHA without taking action and then decide on\nthresholds by looking at your traffic in the [admin console](https://g.co/recaptcha/admin). By\ndefault, you can use a threshold of 0.5.\n\nActions\n-------\n\nreCAPTCHA v3 introduces a new concept: actions. When you specify an action name\nin each place you execute reCAPTCHA, you enable the following new features:\n\n- A detailed break-down of data for your top ten actions in the [admin console](https://g.co/recaptcha/admin/)\n- Adaptive risk analysis based on the context of the action, because abusive behavior can vary.\n\nImportantly, when you verify the reCAPTCHA response, you should verify that the\naction name is the name you expect.\n| **Note:** Actions might contain only alphanumeric characters, slashes, and underscores. Actions must not be user-specific.\n\nSite Verify Response\n--------------------\n\nMake the request to [verify the response token](/recaptcha/docs/verify) as with reCAPTCHA v2 or\nInvisible reCAPTCHA.\n\nThe response is a JSON object: \n\n {\n \"success\": true|false, // whether this request was a valid reCAPTCHA token for your site\n \"score\": number // the score for this request (0.0 - 1.0)\n \"action\": string // the action name for this request (important to verify)\n \"challenge_ts\": timestamp, // timestamp of the challenge load (ISO format yyyy-MM-dd'T'HH:mm:ssZZ)\n \"hostname\": string, // the hostname of the site where the reCAPTCHA was solved\n \"error-codes\": [...] // optional\n }\n\n### Tips\n\n1. `grecaptcha.ready()` runs your function when the reCAPTCHA library loads. To avoid race conditions with the `api.js`, include the `api.js` before your scripts that call grecaptcha, or continue to use the [onload callback](/recaptcha/docs/display#explicit_render) that's defined with the v2 API.\n2. Try hooking the `execute` call to interesting or sensitive actions like Register, Password Reset, Purchase, or Play.\n3. Use `https://www.google.com/recaptcha/api.js?trustedtypes=true` to load code compatible with [Trusted Types](https://web.dev/trusted-types/)."]]