Google reCAPTCHA: integrating with Contact Form 7 to eliminate spam request

You can easily integrate the Google reCAPTCHA with Contact Form 7 WordPress Plugin by signing up for free API keys, henceforth help in protect your website or blog from spam contact submissions.

When it comes to fighting with spammers or spam contact requests, Google reCAPTCHA is a savior and does its job perfectly. Thankfully, my WordPress blog which uses Contact Form 7 for contact us page has an inbuilt integration feature with Google reCAPTCHA V3.

All you need is to sign up for the API keys from Google reCAPTCHA and submit in the CF7 plugin settings to complete integration.

After integration, all your pain to manage the spam contact request will be gone forever. And there won’t be a bunch of contact emails every day asking to try the service or sharing explicit content links, and you never win a coca-cola lottery. 😉

Sign up Google reCAPTCHA v3 site and secret key

reCAPTCHA V3 is an advanced version of earlier reCAPTCHA versions, and it has always been free since the beginning. In order to sign up for the site key and secret key, we need to have a Google account.

  1. Head over to Google reCAPTCHA website
  2. Log in with your Google account to access the Admin console
  3. Click to register a new site
  4. Enter the label name and select the reCAPTCHA v3
  5. Enter your blog URL or domain name
  6. Fill out the rest form with correct details including your email address
    Google reCAPTCHA registration
  7. Submit the registration form
  8. You will be navigated to a page where site key and secret key applicable for your blog will be displayed

reCAPTCHA site key and secret key

You can always log in to see the Analytics of spam protection in the reCAPTCHA admin console. Also, there is no limit on a number of sites that you can register for free site key and secret key.

Integrating reCAPTCHA v3 with Contact Form 7

Copy those reCAPTCHA v3 site key and secret key into the CF7 setting. I’m assuming that you already have a contact form 7 up and working on your blog.

  1. Login to blogs WordPress dashboard
  2. Navigate to Contact
  3. Select the Integration
  4. Entered the copied Site Key and Secret Key in respective fields
  5. Hit on Save button

Contact Form 7 integration with Google reCAPTCHA

That’s all. Contact Form 7 has now integrated with Google reCAPTCHA and will protect your contact form spam. There is no need to make any adjustment to the contact form template or add any element on the page, everything is handled backend.

Even there won’t be any CAPTCHA validation checkbox or image selection based on context like it was earlier in reCAPTCHA Version 2.

Remove or hiding the reCAPTCHA banner

Immediately after integration, I noticed a small banner on the right side of the blog floating on the scroll. The annoying part was that the floating banner was appearing all over the website. If it was only appearing only on the Contact page, then I won’t mind but at least not all places.

When checking the blog on a mobile browser, hovering over the banner actually covers the lower part of the site. Hence thought of removing from all over the blog and restrict to load on my contact page.

I have added a small code snippet in my function.php file that has removed the reCAPTCHA v3 banner. Below is the snippet on hiding, read about code customizations and removing the Google reCAPTCHA banner.

function restorebin_load_recaptcha_badge_page(){
if ( !is_page( array( 'contact') ) ) {
wp_dequeue_script('google-recaptcha');
}
}
add_action( 'wp_enqueue_scripts', 'restorebin_load_recaptcha_badge_page' );

Conclusion

I had integrated and set up Google reCAPTCHA with Contact Form 7 on my blog. I can proudly say that it’s the best thing to happen against spam protection. Since it’s backed by Google spam protection technology, no need to worry about spam anymore.

Here is the screengrab of spam blocked on restoreBin for the last 7 days after integration.

Google reCAPTCHA Analytics

Amazing, isn’t it? This integration has not only eliminated the spam from Contact submission but also helped in reducing the spam comments that I use to receive on the blog post.

If you've any thoughts on Google reCAPTCHA: integrating with Contact Form 7 to eliminate spam request, then feel free to drop in below comment box. Cheers!

Share
Kushal Azza
Kushal Azza
Fond of latest technologies and gadgets. I'm a digital dev and analytics consultant. Also, the geek behind this blog!

Leave a Reply

Your email address will not be published. Required fields are marked *