The Most Popular Extension Builder for Magento 2

With a big catalog of 224+ extensions for your online store

How to add Google reCAPTCHA into Magento 2

Learn how to integrate Google reCAPTCHA into Magento 2—an essential skill in today’s internet workflows. Despite various methods, reCAPTCHA remains a trusted solution for distinguishing humans from automated bots.

This challenge-response test ensures user authenticity, employing an adaptive CAPTCHA system that deters abusive activities on your site. Enhance security without compromising the user experience by creating a new reCAPTCHA implementation.

What is CAPTCHA in Magento 2?

CAPTCHA, short for Completely Automated Public Turing test to tell Computers and Humans Apart, is a tool designed to differentiate between automated bots and real human users.

It involves presenting challenges, like inputting distorted characters, that require human interpretation. This complexity prevents bots from solving the challenges, ensuring online security and deterring fraudulent activities.

In Magento 2, CAPTCHA can be deployed in various areas, including admin access and user interactions on the storefront. Magento supports both standard CAPTCHA and Google reCAPTCHA, which will be discussed later in this blog.

Overview Google reCAPTCHA

reCAPTCHA, a free service by Google, safeguards websites from spam and abuse. A “CAPTCHA” is a turing test designed to distinguish between humans and bots. While easy for humans to solve, it poses a challenge for bots and malicious software. Integrating reCAPTCHA into a site helps prevent automated software, ensuring a smoother experience for genuine users while blocking unauthorized access.

To activate Google reCAPTCHA, you must obtain a set of API keys. Before proceeding with the setup and key generation, it’s crucial to decide on the type of reCAPTCHA you want to implement. There are three options to choose from:

  • reCAPTCHA v2 (“I am not a robot”)

  • reCAPTCHA v2 Invisible

  • reCAPTCHA v3 Invisible

To enable and configure it, please adhere to the instructions below.

Importants

Download reCaptcha from:

If it’s hard to install Google reCAPTCHA, we are here to help with Installation Service pack

Learn more about Google reCaptcha

Why People love Mageplaza ReCAPTCHA

  • Easy to add to any forms
  • Work in Frontend and Backend (Unique)
  • Support both visible and invisible captcha

Table of contents

Steps to add Google reCaptcha into Magento 2

Step 1. Register a new account at Google reCAPTCHA.

Make your way to Google reCAPTCHA to register a new account.

Step 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.

Invisible reCAPTCHA

  • reCAPTCHA V2: Users need to tap the checkboc “I’m not a robot” to be authenticated.

reCAPTCHA V2

  • reCAPTCHA Android: This reCAPTCHA is designed for Android system (Mageplaza Social Login doesn’t support this type)

However, we’ve fused two types Invisible reCAPTCHA and reCAPTCHA V2 into the one display form is reCAPTCHA V2

reCAPTCHA Android

Step 3. Enter your domain to apply.

Enter the domain you want to apply reCAPTCHA and register those required information.

Enter your domain to apply

Step 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.

Get Key of the created reCAPTCHA

Step 5. Enable Google reCAPTCHA Magento 2 for Admin Panel and Storefront

Sign in to your Magento account. In the Admin sidebar, go to Stores > Settings > Configuration.

Navigate to backend

Scroll down on the left panel, expand Customers, and select Customer Configurations.

Scroll down

Then, open the CAPTCHA section.

Capcha section

You can configure optional steps based on your needs:

  • Choose the default Font name for Magento 2 CAPTCHA.

  • Select multiple Forms for Magento 2 CAPTCHA (use CTRL or Mac key for multiple selections).

  • Set Displaying Mode to Always.

  • Set the Number of Unsuccessful Attempts to Login (If 0 is specified, CAPTCHA on the Login form will be always available).

  • Specify the CAPTCHA Timeout (in minutes) before the session expires.

  • Enter the range for the Number of Symbols to appear in Magento CAPTCHA (maximum at 8).

  • Define the Symbols Used in CAPTCHA (Please use only letters (a-z or A-Z) or numbers (0-9) in this field. No spaces or other characters are allowed).

  • Choose Case Sensitive (Yes or No based on your preference).

Step 6: Configure Google reCAPTCHA Account in Magento 2

Navigate to Store > Settings > Configuration > Security > Google reCAPTCHA Admin Panel.

Google reCaptcha v2 (“I am not a robot”)

I’m not a robot

  • Insert the key you generated for this reCAPTCHA type into the Google API Website Key field.

  • Input the secret key linked to your Google reCAPTCHA account into the Google API Secret Key field.

  • Size: Choose the desired size for the box: Normal or Compact

  • Theme: Light Theme or Dark Theme

  • Language Code (Optional) Specify a language code to force rendering in a specific language. If unspecified, it auto-detects the user’s language. Refer to supported Language Codes.

Google reCaptcha v2 Invisible

V2

Google reCaptcha v3 Invisible

V3

  • Insert the key you generated for this reCAPTCHA type into the Google API Website Key field.

  • Input the secret key linked to your Google reCAPTCHA account into the Google API Secret Key field.

  • Minimum Score Threshold: Identifies when a user might be a bot; 0.0 is likely a bot, the default is 0.5, and 1 indicates a normal user.

  • Invisible Badge Position determines where the reCAPTCHA badge should display: Inline, Bottom Right or Bottom Left

  • Theme: Light Theme or Dark Theme

  • Language Code (Optional) Specify a language code to force rendering in a specific language. If unspecified, it auto-detects the user’s language. Refer to supported Language Codes.

Get Google Recaptcha for Magento 2

Free Google reCaptcha on Github

Image Description
Sam is the CEO & co-founder of Mageplaza, a company established to support Magento merchants with different powerful tools and resources. Sam Nguyen is also the CEO & founder of Avada Commerce, an e-commerce solution provider headquartered in Singapore – aiming to support more than a million online businesses to grow and develop.
Website Support
& Maintenance Services

Make sure your store is not only in good shape but also thriving with a professional team yet at an affordable price.

Get Started
mageplaza services
x

    People also searched for

    Subscribe

    Stay in the know

    Get special offers on the latest news from Mageplaza.

    Earn $10 in reward now!

    Earn $10 in reward now!

    comment
    iphone
    go up