Support » Plugin: Contact Form 7 » Recaptcha v3 script is being added to all pages

  • dukeo

    (@dukeo)


    Forcing the upgrade to Recaptcha v3 seems highly unproductive.

    Now we have the Recaptcha script being added to ALL PAGES on our website. We don’t want the pesky bottom-right sticky logo on every single page of our website. You really think Google doesn’t have enough data on our visitors already that you want to help them track everyone everywhere?

    That’s great advertising for Recaptcha, but interferes with our user experience and is an horrible eye sore.

    We’ve been using the wpcf7_load_js hooks for years to add Contact Form 7 script ONLY on contact pages, but your integration of Recaptcha v3 doesn’t respect it and is being added everywhere.

Viewing 15 replies - 1 through 15 (of 25 total)
  • dukeo

    (@dukeo)

    tl;dr: I don’t mind using the v3, but load the google script inside wpcf7_load_js so we can disable it on pages where there is no contact form!

    robwent

    (@robwent)

    Probably easiest to only load it when the shortcode has been called?

    Also, I don’t think v2 has been deprecated yet? But if you had v2 keys set then they now seem to have been removed.
    So people who previously had a working recaptcha, now just show [recaptcha] and have no protection.

    WillPresleyEV

    (@willpresleyev)

    reCaptcha v3 works by analyzing behavior across an entire site (and I’m sure aggregated somehow) to build a ‘profile’ of the user well before they click to submit a form. The v3 code loading on all pages is fine, but showing the badge in the bottom-right corner all the time is obnoxious. A note in the footer or somewhere that gives the user info that it is in use (Google is tracking their behavior while on this site) and then showing the badge ONLY when an input field is focused would be far preferable. I’ve seen a working solution for this on StackOverflow (or WordPress Stack Exchange), I can try to find the link again tomorrow.

    dukeo

    (@dukeo)

    Altering or hiding the recaptcha badge is against Google Recaptcha TOS. (which is why I was inquiring about simply not loading it on pages it’s not needed).

    v2 has always been fine. People are now used to having to check an extra box before sending a contact form.

    If the badge needs to be there on all pages at all times, I guess it’s time to find an alternative to CF7 and Recaptcha…

    Recaptcha is a tool to protect contact forms from spam. I don’t want it to track visitors everywhere and see everything they do on my sites. That’s a massive invasion of privacy from Google. And the underlying excuse to track everyone everywhere is that it will help protect forms? No thank you. I’ll use another contact form that doesn’t reach beyond what it’s supposed to do.

    And in the meantime, roll back to a previous version of CF7 until Rechaptcha v2 gets entirely removed by Google.

    Just imagine the outcry if WordPress was saying: “If you use WordPress as a CMS we will add our own analytics to every page on every website you build”. That would send shockwaves across the entire web…. Or if it was coming from every plugin publisher… “you want to use our plugin to change your header color? We can do that, but in exchange we will track all your visitors everywhere.”

    Iamhere

    (@iamhere)

    @dukeo

    1) Please don’t blindly spread mis-information! A little Googling will lead you to find it is perfectly OK to hide the badge, read here: https://developers.google.com/recaptcha/docs/faq

    2) Yes, it would have been good if @takayuki could include a simple fix for you, but you can achieve it yourself fairly easily, again, with a little bit of sleuthing.

    You can hide the badge on all pages except your contact page:

    /* Hides the reCAPTCHA on every page */
    .grecaptcha-badge {
        display: none !important;
    }
    
    /* Shows the reCAPTCHA on the Contact page */
    .page-id-17 .grecaptcha-badge {
        display: block !important;
    }

    3) if you want to rollback to v2, un-install CF7 and re-install https://plugins.trac.wordpress.org/browser/contact-form-7/tags/5.0.5

    Good luck!

    dukeo

    (@dukeo)

    1) Technically you’re right you can hide the badge… But only if (1) you advertise them “visibly in the user flow” and (2) add 2 do-follow links to Google.

    Plus, to be clear, all visitors are still tracked across your entire website. CSS is not going to stop the tracking.

    Finally, to respect the law in most countries, you need to alter the Privacy Policy of all your websites to indicate that users are now being tracked by Google Recaptcha across all pages of your website.

    mitchpowell

    (@mitchpowell)

    I’m interested in solutions too.

    corderization

    (@corderization)

    Also faced with this trouble. The captcha icon is displayed on all pages. I added the above code to the CSS, but it did not work. The icon continues to appear on all pages.

    seowebua

    (@seowebua)

    This is just stupid to load unnecessary code on all hundreds of pages, if I have 1 contact page with form.
    If this won’t be fixed – I will have to say goodbye to recaptcha.

    lofesa

    (@lofesa)

    Perhaps some like this @dukeo

    function contactform_dequeue_scripts() {
    
        $load_scripts = false;
    
        if( is_singular() ) {
        	$post = get_post();
    
        	if( has_shortcode($post->post_content, 'contact-form-7') ) {
            	$load_scripts = true;
    			
    		}
    
        }
    
        if( ! $load_scripts ) {
            wp_dequeue_script( 'contact-form-7' );
    	wp_dequeue_script('google-recaptcha');
            wp_dequeue_style( 'contact-form-7' );
    		
        }
    
    }
    add_action( 'wp_enqueue_scripts', 'contactform_dequeue_scripts', 99 );
    • This reply was modified 7 months ago by  lofesa.
    wzub

    (@wzub)

    Having the ability to selectively disable/enable recaptcha on individual contact forms would also be helpful.

    Yeah..This was a huge annoyance and I have done away with recaptcha for now. It is really annoying to have the badge on every page and user tracked.

    @lofesa

    Nice solution and thank you

    I used Invisible reCAPTCHA (https://wordpress.org/plugins/invisible-recaptcha/) for Contact Form 7 invisible reCAPTCHA integration previously, and it was able to determine if the page had a Contact Form 7 form on it or not to then decide whether to load reCAPTCHA.

    It’d be nice if CF7 were to do that by default since it’s shown to be possible with other plugins (and is their default behavior) and it’s much nicer for visitors.

    Thanks for the solution in the meantime, @lofesa !

    henkv74

    (@henkv74)

    Very good solution @lofesa. Thanks!

Viewing 15 replies - 1 through 15 (of 25 total)
  • You must be logged in to reply to this topic.