MENU
Google reCAPTCHA
reCAPTCHA protects you against spam and other types of automated abuse.
Google 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 appropriate action for your site.
Traditionally, reCAPTCHA worked by asking the user to solve a simple puzzle such as confirming graphical text or locating objects. reCAPTCHA v3 will never interrupt your users, so you can run it whenever you like without affecting conversion. reCAPTCHA works best when it has the most context about interactions with your site, which comes from seeing both legitimate and abusive behavior. For this reason, we recommend including reCAPTCHA verification on forms or actions as well as in the background of pages for analytics.
……<script src="https://www.google.com/recaptcha/api.js"></script>……<script>
function onSubmit(token) {
document.getElementById("demo-form").submit();
}</script>…… <button class="g-recaptcha"
data-sitekey="reCAPTCHA_site_key"
data-callback='onSubmit'
data-action='submit'>Submit</button>……
If you wish to have more control over when reCAPTCHA runs, you can use the execute method in the grecaptcha object. To do this, you need to add a render parameter to the reCAPTCHA script load.
……<script src="https://www.google.com/recaptcha/api.js?render=reCAPTCHA_site_key"></script>……<script>
function onClick(e) {
e.preventDefault();
grecaptcha.ready(function() {
grecaptcha.execute('reCAPTCHA_site_key',
{action: 'submit'}).then(function(token) { // ……
});
});
}</script>……