3 Steps to add Google reCaptcha into Magento 2
- Step 1: Install Google reCAPTCHA
- Step 2: Generate Google reCAPTCHA keys
- Step 3: Configure Google reCAPTCHA in Magento
Step 1. Step 1: Install Google reCAPTCHA
You can install the module using the following composer command:
composer require msp/recaptcha:2.0.0 |
If you already have installed a Magento instance, you need to run the following commands to enable the module:
php bin/magento module:enable --all php bin/magento setup:upgrade |
Step 2: Generate Google reCAPTCHA keys
Step 2.1. Register a new account at Google reCAPTCHA.
Make you way to Google reCAPTCHA to register a new account.
Step 2.2. Fill out the register form to choose the type of your Google reCAPTCHA
Fill out the Label field. In general, there will be 3 types of reCAPTCHA:
- Invisible reCAPTCHA: Users won't need to click any authentication button or do any unnecessary tests, the CAPTCHA will do that hard works for your customers.
- reCAPTCHA V2: Users need to tap the checkboc "I'm not a robot" to be authenticated.
- reCAPTCHA Android: This reCAPTCHA is designed for Android system
However, we've fused two types Invisible reCAPTCHA and reCAPTCHA V2 into the one display form is reCAPTCHA V2
Step 2.3. Enter your domain to apply.
Enter the domain you want to apply reCAPTCHA and register those required information.
Step 2.4. Get Key of the created Google reCAPTCHA.
After registering, you will be automatically redirects to the reCAPTCHA management site, where Analytics, Key information and Key settings and be viewed. The reCAPCHA Client Key and the reCAPCHA Secret Key display in the Key information.
Step 3. Configure Google reCAPTCHA in Magento
Sign in to the Admin of your Magento store. On the Admin sidebar, tap Stores >> Settings >> Configuration.
In the upper-right corner, set Store View to “Default Config.”
In the panel on the left under Security, choose Google reCAPTCHA. Then, expand the General section, and enter the following generated keys:
- Google API website key
- Google API secret key
Expand ( ) the Backend section, and do the following:
Set Enable to "Yes."
To change the Theme, clear the Use system value checkbox. Then, choose one of the following:
- Light
- Dark
To change the Size, clear the Use system value checkbox. Then, choose one of the following:
- Normal
- Compact
Expand ( ) the Frontend section. Then, do the following to add reCAPTCHA to customer accounts:
When complete, tap Save Config.
Now go to your any form page of your store, I am going to the contact page and here's the result:
Your store might be fully optimized in all aspects, but if it lacks the rock-solid security which your customers demand, then you can lose the trust of your customers and see conversion rates fall. After following this guide, I hope you can now setup Magento 2 reCAPTCHA. As there are many security practices of Magento 2 store being implemented every day, adding reCAPTCHA is one of them.
If you still have any confusion or query, related to this tutorial just leave your comment and I will get back to you asap!