How to handle module_captchav2 migrated from BC in Treepl?

Hi,

I searched our forum, and one of the posts mentioned that the BC to Treepl app v7.2 can do the conversion of modules: {module_ccsecurity}, {module_captchav2}, {module_recaptcha}.

In my Treepl, one of the pages got a {module_captchav2,#5d5d5d} {module_ccsecurity}, which doesn’t work. Would anyone know how to converse it to Treepl module?

Thank you so much!

Hi @Linda.
Just replace both of those 2 BC tags with this:

<div class="g-recaptcha" data-sitekey="6Lf2cGcUAAAAABbL4aDrclASNZx9S3uaI9EvpvlI"></div>

That will give you the standard reCaptcha v2.
And make sure you have reCaptcha v2 added to your form in the FormBuilder.

To change the theme/colour, reCaptcha v2 only has a light/dark mode (so you can’t set the specific colour) add data-theme:

<div class="g-recaptcha" data-theme="dark" data-sitekey="6Lf2cGcUAAAAABbL4aDrclASNZx9S3uaI9EvpvlI"></div>

See reCaptcha docs for more options:
https://developers.google.com/recaptcha/docs/display

1 Like

Hi @Adam.Wilson,

Thank you so much! It really is working on my website!

May I ask you two more questions?

  1. Where does the data-sitekey come from? (Thank you so much for providing the sitekey directly)
  2. Is there a way that I can change the current “I am not a robot” to some numbers? Please see the picture below.
    image

Thank you so much for your help!

The data-sitekey comes from Treepl’s Google API which they provide for all sites (as far as I’m aware).

The number/letter thing is old-school :slight_smile: and not as effective against spam now-a-days.

Have you looked at reCaptcha v3 to do away with any user interaction all together?

You’d simply replace the above v2 code with this:

<script>
	grecaptcha.ready(function() {
		grecaptcha.execute('6Ld5QIoUAAAAAKznGOlK7z6mgqJ8ajRUc3CK5M17', { action: 'general_form_{{this.Alias | replace: "-","_"}}'}).then(function(token)
{document.querySelector('.g-recaptcha-response-v3-{{this.Alias}}').value = token;});	});
	</script>
<input type="hidden" class="g-recaptcha-response-v3-{{this.Alias}}" name="g-recaptcha-response-v3">

…and again, insure reCaptcha v3 is added to the Form Builder and v2 removed.

1 Like

Hi @Adam.Wilson,

Thank you for the info, I just created my first form in Treepl…

There is a small issure though. First I added reCAPTCHA v3, but nothing shows up on the web page, then I changed it to reCAPTCHA v2, the “I am not a robot” module appeared. Do you have any idea what could be the reason?

Thank you so much!

That sounds like everything is working correctly.

v2 looks like this:
image

and v3 is invisible (no user input needed), but you should see a little badge in the lower right of your site:
image

1 Like

The idea / beauty of v3 is that nothing should appear on the page (except the little tab at the bottom right of the page depending if you hid it with css or not) :slight_smile:
EDIT: What Adam said :slight_smile:

2 Likes

Thank you so much @Adam.Wilson!

Thank you for your reply @James!

If everyone is using the same Treepl provided sitekey number, could we eventually run into a problem with too many submissions being made in one day? I think I read in the recaptcha document you can only have 1000 per day?? @Adam.Wilson @James