You can add Google reCAPTCHA to your Contact Form or Subscribe Form module to deter spam.
Here's an example of a form generated by a Contact module with an "I'm not a robot" v2 reCAPTCHA checkbox. Checking the box may be sufficient, or in some cases, the user has to solve a captcha after checking the box.
You can also choose a dark checkbox, which appears in the following screenshot.
If you choose a V2 or V3 invisible checkbox, a small reCAPTCHA box pinned to the right side of the browser screen. When you hover over it, the box expands to display "protected by reCAPTCHA," as shown in the following animation. You can choose either a light or dark version for this icon.
With the v2 invisible reCAPTCHA, users may in questionable cases still have to solve a captcha.
The v3 reCAPTCHA requires no action from users and returns scores, based on seeing both legitimate and abusive behavior on your site, with the ability for you to tailor your own action to suit your site, as described in this Google blog. Because of this, we recommend that you thoroughly review the v3 reCAPTCHA docs before using.
Register your site for a reCAPTCHA license key pair
Register your site at the Google reCAPTCHA admin console. You must choose one of the following reCAPTCHA types to generate the appropriate keys:
reCAPTCHA v3 Verifies requests with a score
"I'm not a robot" checkbox
Validate requests with the "I'm not a robot" checkbox
Invisible reCAPTCHA badge
Validate requests in the background
For more information about these types and how they work, see the Google developer reCAPTCHA documentation.
If you change your mind about which type of reCAPTCHA to use, you'll have to get a new key pair for that type.
Set up reCAPTCHA in a Contact Form or Subscribe Form module:
Open either module for editing and click the Captcha tab.
For the reCAPTCHA field setting, click Show.
For Validate type, choose the validation type you want.
(v3 only) If you're an advanced user and want to sort your reCAPTCHA results by action in your Google admin console, enter an action name here.
Enter the Site key and Secret key from your Google reCAPTCHA registration.
Be sure to use keys that match the validation type.
For Theme, choose whether you want the “I'm not a robot” box or the reCAPTCHA icon to have a light background or dark background.