# Spam Filtering with reCaptcha v2
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
# 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". In order to add your Secret Key;
- Select the form endpoint that you wish to integrate reCaptcha
- Heead over to Automation section of the selected form endpoint.
- Select "Secure endpoint with reCaptcha" automation and paste it under the "reCAPTCHA Key" section anc click "Complete"
- Finally click "Save" on top to save your automation.
Here is a working example Codepen for HTML Form with Google reCaptcha with checkbox: