How to Add Google reCAPTCHA to Magento

How to Add Google reCAPTCHA to Magento

Previously, you read how to add Google reCAPTCHA to Magento 2.

Today, I’ve come up with a similar solution for Magento 1.

Captcha, i.e., Completely Automated Public Turing test to tell Computers and Humans Apart, is a service by Google that prevents the store from spam and bots. Implementing Google reCAPTCHA v2 helps to identify if a visitor in your site is a human or a bot.

As Magento, by default, does not offer a reliable solution for security against spams, merchants have to rely on 3rd party solutions and the best choice is Google-developed anti-spam reCAPTCHA that displays the  “I’m not a robot” checkbox.

To add Google reCAPTCHA to Magento, you need to follow the given method.

Additionally, check these steps prior to implementing the programmatic method:

  1. Register for the public and secret key pair Magento store’s domain.
  2. Ensure if the reCAPTCHA authentication works for the subdomains as well to avoid any error.
  3. Refer to Google reCAPTCHA documentation.

Method to Add Google reCAPTCHA to Magento :

  1. Add the below script to any head or where you want to use google recaptcha
  2. Add captcha code to phtml or block/page where you want to add v2  google recaptcha in the form
  3. If the captcha does not validate then add below code
    In any form, add onSubmit event like :

That’s it.

Please feel free to mention any doubts on the topic in the Comments section below.

Stay Secure 🛡️


(based on 8 Reviews)

Sanjay is a co-founder at Meetanshi. He is a certified Magento developer who loves creating Magento E-commerce solutions. When he is not engrossed with anything related to Magento, he loves to play cricket.

Leave a Reply