How to Add Google reCAPTCHA to Magento 2 AMP Pages

In this article, you will learn how to integrate Google reCAPTCHA into Magento 2 AMP plugin. Please follow the steps below to configure it correctly.

Google reCAPTCHA helps you protect your website from fraudulent activities, spam, and abuse. You can also enable it on the Newsletter subscription form to prevent spam submissions on AMP pages. Please note that for AMP pages, Google reCAPTCHA v3 is required.

Please follow the guide below in order to create a Google reCAPTCHA Site Key and Secret Key for your AMP pages correctly. If you already use Google reCAPTCHA v3 for your website, skip to how to find the Site Key and Secret Key.

How to Generate Google reCAPTCHA Keys

Step-by-step guide:

Go to the Google reCAPTCHA site and sign in to your Google Account.

  1. Label: enter a label to easily identify your website later.
  2. reCAPTCHA type: choose a reCAPTCHA v3 type that is required for AMP pages.
  3. Domains: specify domains where you want to register reCAPTCHA.
  4. Accept the reCAPTCHA terms of service to use reCAPTCHA for your site. 
  5. Click Submit.
register google recaptcha 1.png

Step-by-step guide:

  1. Copy the newly generated Site Key to paste in the Magento admin panel when integrating reCAPTCHA with your AMP pages.
  2. Copy the newly generated Secret Key to paste in the Magento admin panel when integrating reCAPTCHA with your AMP pages.
  3. Click Go to Settings for more configurations.
register google recaptcha 2.png

Step-by-step guide:

  1. Check the Allow this key to work with AMP pages box in order for Google reCAPTCHA to work properly on your AMP pages.
  2. Click Save.

register google recaptcha 3.png

How to Find Google reCAPTHCA Keys

If you already use Google reCAPTCHA v3 on your website, you can enable it on your AMP pages instead of generating new keys. Follow the steps below to find your Google reCAPTCHA keys and enable them on your AMP pages.

Step-by-step guide:

  1. Go to the Admin Console and select your site.
  2. Go to settings by clicking the gear icon and check the Allow this key to work with AMP pages box in order to enable Google reCAPTCHA on your AMP pages. You can also find your reCAPTCHA Keys (Site key and Secret key) on this page.
find google recaptcha keys.png

How to Integrate Google reCAPTCHA With Magento 2 AMP Extension

In the main Magento menu, go to the Plumrocket -> AMP -> Configuration, and scroll down to Integrations -> Google reCAPTCHA v3.

Step-by-step guide:

  1. Enable: set to Yes to enable Google reCAPTCHA on your AMP pages.
  2. Google API Website Key: insert your Google reCAPTCHA Site Key in this field.
  3. Google API Secret Key: insert your Google reCAPTCHA Secret Key in this field.
  4. Enable for Newsletter Subscription: set to Yes if you want to enable reCAPTCHA for the Newsletter Subscription form to prevent spam subscriptions.
  5. Enable for Product Review: set to Yes to enable reCAPTCHA for product review form to prevent spam submissions.
  6. Click Save Config to apply settings.
Google reCAPTCHA Configuration in Magento 2 AMP Extension

Google reCAPTCHA integration with the Magento 2 AMP extension is now completed.

Was this article helpful?