
Google reCAPTCHA helps protect your site from bots or malware submitting fake entries through your contact forms.
While it is extremely useful, the introduction of GDPR and stricter Cookie Policy requirements means that you need to install it properly to prevent cookies from being set without user consent.
Let's see how to install GDPR-compliant Google reCAPTCHA with the help of My Agile Privacy.
Installation is straightforward and requires just one step: enable Automatic Scan, which is available in PRO versions of My Agile Privacy.
Automatic Scan
The Cookie Shield can automatically detect Google reCAPTCHA.
Set it to "Training" mode, and remember to disable any caching and minification plugins. Then, browse your site as a regular user would.
Navigating the site allows the system to detect cookies that are set on your site.
Once you have verified that Google reCAPTCHA appears in the list of cookies, you just need to set the Shield to "LIVE" mode in order to detect and block this tool.
Inform the User
If you wish to enhance user experience by showing a notification message when the Captcha-related cookie is not active, you can do so easily.
In each of your forms, insert this shortcode:
[myagileprivacy_blocked_content_notification api_key="google_recaptcha"]
Or, add this block of code:
<div class="map_custom_notify map_api_key_google_recaptcha">
Warning: your cookie settings may prevent the form from being submitted.
</div>
Insert the code just before the form's submit button. In this way, any user who has NOT given consent to Google reCAPTCHA will see a message before the submit button, warning them that the form may fail to submit due to unaccepted cookies (specifically, Google reCAPTCHA).
This message will appear only while the cookie is not accepted—once the user consents to Google reCAPTCHA, the message will automatically disappear.
At this point, all you need to do is test your setup by browsing your site. You will see that Google reCAPTCHA is not activated until explicit consent is given by the user.