Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1363342

    The Enfold Theme dynamically loads the Google Recaptcha Script, which connects the form with Google reCAPTCHA (/wpcontent/themes/enfold/framework/js/conditional_load/avia_google_recaptcha_api.js) via JavaScript.

    Sadly, this means that Real Cookie Banner (a very good GDPR/DSGVO cookie banner for WordPress) cannot block the script via the HTML (because it can’t detect dynamic loading).

    In order to support this, they provided me with a working solution that might be added in a future Enfold release: https://gist.github.com/matzeeable/42b5f167bd5cc17c010bfde928a59111

    Could you consider this maybe? :-)

    #1363594

    Hey Boris,

    Thank you for the inquiry.

    How did you setup the services or content blocker cookie in the RCB panel? We do not have a premium or pro account for the plugin so we are not able to add the default content blocker template for Google ReCAPTCHA.

    If you created a custom Services (cookies) in the Statistics group, you can try and add the following scripts in the Technical handling section.

    Code executed on opt-in:

    <script type="module">
    Cookies.set('enableAviaRecaptchaRCB', 1, { expires : 30, path: '/' });
    </script>
    

    Code executed on opt-out:

    <script type="module">
    Cookies.remove('enableAviaRecaptchaRCB', 1, { path: '/' });
    </script>
    

    Code executed on page load:

    <script type="module" src="https: (Email address hidden if logged out) /dist/js.cookie.min.js"></script>
    
    <script type="module">
    (function ($)
    {
        function disableRecaptchaJS()
        {
    		var recaptchaEnabled = $("body").is(".av-recaptcha-enabled");
            var recaptchaFront = $("#avia_google_recaptcha_front_script-js");
    		var recaptchaAPI = $("#avia_google_recaptcha_api_script")
    		var recaptchaArea = $(".av-recaptcha-area");
            
            if (recaptchaEnabled)
            {
                recaptchaFront.remove();
                recaptchaAPI.remove();
    			recaptchaArea.remove();
    			
    			$('#top').removeClass('av-recaptcha-enabled av-recaptcha-extended-errors');
            } 
    		
    		return false;
        }
        
        $(document).ready(function() {
    		if(Cookies.get('enableAviaRecaptchaRCB')) return;
    
            disableRecaptchaJS();
        });
    })(jQuery);
    </script>
    

    The script will disable the reCAPTCHA API on load and only enable it once the user opt-in to the custom statistics service or once the enableAviaRecaptchaRCB cookie is set.

    Best regards,
    Ismael

    #1363601

    Hi Boris,

    We wrote a few instructions on how to create an RCB service to control the theme’s Google ReCAPTCHA integration. Please check the following link.

    // https://github.com/KriesiMedia/enfold-library/tree/master/integration%20plugins/3rd%20party%20plugins/Real%20Cookie%20Banner

    Regards,
    Ismael

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.