# Spam Protection

Google reCAPTCHA is the one of the best solutions to prevent web spams. There are two versions of Google reCAPTCHA and we support both clickable (v2) and invisible reCAPTCHA (v3).

Here are the steps to integrate Google reCaptcha v2 to your form endpoint.

# Setting up reCAPTCHA v2 (Checkbox)


# Step 1 - Get API Keys

Similar to what we have done to set up v3, login to Google reCAPTCHA Console. This time, select reCAPTCHA v2, choose "I'm not a robot tickbox" and add it to your domains. If you want to test it on your local, don't forget to add the localhost into the domain list.


# Step 2 - Add reCAPTCHA Library

There are 2 keys generated for you Site Key and Secret Key. For this step, we will be using the Site Key.

Add reCAPTCHA library into your <head> tags.

<script src="https://www.google.com/recaptcha/api.js"></script>

# Step 3 - Add Hidden Element

Add hidden reCAPTCHA <input> into your form as follows:

<div class="g-recaptcha" data-sitekey="YOUR reCAPTCHA SITE KEY"></div>

# Step 4 - Setup Secret Key

This step is where we use the "Secret Key". Add your Secret Key to your form by heading over your form settings and paste it under the "reCAPTCHA Key" section. Click "Save Changes" to save your form.


Here is a working example Codepen for HTML Form with Google reCaptcha with checkbox:

See the Pen Getform.io Google reCAPTCHA v2 (Checkbox) contact form example by Getform (@getform) on CodePen.