Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide the Google Invisible reCAPTCHA badge

When implementing the new Google Invisible reCATPTCHA, by default you get a little "protected by reCAPTCHA" badge in the bottom right of the screen that pops out when you roll over it.

enter image description here

I'd like to hide this.

like image 546
James Law Avatar asked Jun 14 '17 11:06

James Law


People also ask

Can I hide Google reCAPTCHA badge?

Yes! according to Google's FAQ about the reCAPTCHA you are allowed to hide the badge. However, you have to add a note in the “user flow”. You are allowed to hide the badge as long as you include the reCAPTCHA branding visibly in the user flow.

Where do I put the Grecaptcha-badge visibility hidden?

The CSS Way use display: none or visibility: hidden to hide the reCaptcha batch.


9 Answers

Google now allows to hide the Badge, from the FAQ :

I'd like to hide the reCAPTCHA badge. What is allowed?

You are allowed to hide the badge as long as you include the reCAPTCHA branding visibly in the user flow. Please include the following text:

This site is protected by reCAPTCHA and the Google
    <a href="https://policies.google.com/privacy">Privacy Policy</a> and
    <a href="https://policies.google.com/terms">Terms of Service</a> apply.

For example:

enter image description here

So you can simply hide it using the following CSS :

.grecaptcha-badge { 
    visibility: hidden;
}

enter image description here Do not use display: none; as it appears to disable the spam checking (thanks @Zade)

like image 171
Yann39 Avatar answered Oct 01 '22 02:10

Yann39


I have tested all approaches and:

WARNING: display: none DISABLES the spam checking!

visibility: hidden and opacity: 0 do NOT disable the spam checking.

Code to use:

.grecaptcha-badge { 
    visibility: hidden;
}

When you hide the badge icon, Google wants you to reference their service on your form by adding this:

<small>This site is protected by reCAPTCHA and the Google 
    <a href="https://policies.google.com/privacy">Privacy Policy</a> and
    <a href="https://policies.google.com/terms">Terms of Service</a> apply.
</small>

Example result

like image 42
Helenesh Avatar answered Oct 01 '22 03:10

Helenesh


Set the data-badge attribute to inline

<button type="submit" data-sitekey="your_site_key" data-callback="onSubmit" data-badge="inline" />

And add the following CSS

.grecaptcha-badge {
    display: none;
}
like image 20
James Law Avatar answered Oct 01 '22 04:10

James Law


For Google reCaptcha v3, the FAQ says:

You are allowed to hide the badge as long as you include the reCAPTCHA branding visibly in the user flow. Please include the following text:

This site is protected by reCAPTCHA and the Google
    <a href="https://policies.google.com/privacy">Privacy Policy</a> and
    <a href="https://policies.google.com/terms">Terms of Service</a> apply.

For example:

Example showing the message

Note: if you choose to hide the badge, please use

.grecaptcha-badge { visibility: hidden; }

It isn't clear whether it applies to reCaptcha v2. I suggest upgrading to v3 as it's a better experience for your visitors.

like image 45
codesmith Avatar answered Oct 01 '22 04:10

codesmith


Since hiding the badge is not really legit as per the TOU, and existing placement options were breaking my UI and/or UX, I've come up with the following customization that mimics fixed positioning, but is instead rendered inline:

Collapsible "invisible" captcha

You just need to apply some CSS on your badge container:

.badge-container {
  display: flex;
  justify-content: flex-end;
  overflow: hidden;
  width: 70px;
  height: 60px;
  margin: 0 auto;
  box-shadow: 0 0 4px #ddd;
  transition: linear 100ms width;
}
.badge-container:hover {
    width: 256px;
}

I think that's as far as you can legally push it.

like image 37
krukid Avatar answered Oct 01 '22 03:10

krukid


I decided to hide the badge on all pages except my contact page (using Wordpress):

/* Hides the reCAPTCHA on every page */
.grecaptcha-badge {
    visibility: hidden !important;
}

/* Shows the reCAPTCHA on the Contact page */
/* Obviously change the page number to your own */
.page-id-17 .grecaptcha-badge {
    visibility: visible !important;
}

I'm not a web developer so please correct me if there's something wrong.

EDIT: Updated to use visibility instead of display.

like image 33
Leon Avatar answered Oct 01 '22 02:10

Leon


Yes, you can do it. you can either use css or javascript to hide the reCaptcha v3 badge.

  1. The CSS Way use display: none or visibility: hidden to hide the reCaptcha batch. It's easy and quick.
.grecaptcha-badge {
    display:none !important;
}
  1. The Javascript Way
var el = document.querySelector('.grecaptcha-badge');
el.style.display = 'none';

Hiding the badge is valid, according to the google policy and answered in faq here. It is recommended to show up the privacy policy and terms of use from google as shown below.

google policy and terms of use

like image 29
Kiran Maniya Avatar answered Oct 01 '22 04:10

Kiran Maniya


A slight variant of Matthew Dowell's post which avoids the short flash, but displays whenever the contact form 7 form is visible:

div.grecaptcha-badge{
    width:0 !important;
}

div.grecaptcha-badge.show{
    width:256px !important; 
}

I then added the following to the header.php in my child theme:

<script>
jQuery( window ).load(function () { 
    if( jQuery( '.wpcf7' ).length ){ 
        jQuery( '.grecaptcha-badge' ).addClass( 'show' );
    }
});
</script>
like image 6
Nigel Dyer Avatar answered Oct 01 '22 04:10

Nigel Dyer


Note: if you choose to hide the badge, please use
.grecaptcha-badge { visibility: hidden; }

You are allowed to hide the badge as long as you include the reCAPTCHA branding visibly in the user flow. Please include the following text:

This site is protected by reCAPTCHA and the Google
<a href="https://policies.google.com/privacy">Privacy Policy</a> and <a href="https://policies.google.com/terms">Terms of Service</a> apply.

more details here reCaptacha

like image 6
Mohsin Saeed Avatar answered Oct 01 '22 04:10

Mohsin Saeed