Add a Google reCAPTCHA checkbox to a form

You can optionally add Google reCAPTCHA to your contact form or subscribe form to deter spam. You can choose either an "I'm not a robot" checkbox or invisible validation, explained below.

Here's an example of a form generated by a Contact module with an "I'm not a robot" reCAPTCHA checkbox.

You can also choose a dark checkbox, which appears in the following screenshot.

If you choose an 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.

Notes:

  • To use the reCAPTCHA feature, you must sign up for the public and secret key pair specifically for the domain on which this site will run.
  • The "I'm not a robot" checkbox and invisible checkbox require different key pairs, so if you change your mind about the setting you'll have to sign up for a new key pair for that domain.
  • reCAPTCHA authentication should also work for any subdomains of the domain you register. If you have your website at a staging location or a local server where the URL does not match your domain name, the reCAPTCHA "I'm not a robot" box or the invisible validation box will display but show an error until you have moved your site.
  • For more information, see the Google reCAPTCHA documentation.

To set up reCAPTCHA in a Contact Form or Subscribe Form module:

  1. Click the reCAPTCHA tab.
  2. For reCAPTCHA field, click Show.
  3. Enter the Site key and Secret key from your Google reCAPTCHA domain registration.
    Use the keys that match whether you plan to use the "I'm not a robot" box or Invisible validation.
  4. For Validate type, choose either "I'm not a robot" checkbox or Invisible.
  5. For Theme, choose whether you want the box to have a light background or dark background.
    For more information, see the Google documentation about reCAPTCHA types.