Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load reCAPTCHA on focus only #556

Closed
fredericalpers opened this issue Jun 12, 2023 · 5 comments · Fixed by #600
Closed

Load reCAPTCHA on focus only #556

fredericalpers opened this issue Jun 12, 2023 · 5 comments · Fixed by #600
Assignees
Labels
QA Issue or Pull request that is in review
Milestone

Comments

@fredericalpers
Copy link
Member

Current state

When activated, reCAPTCHA significantly reduces the pagespeed.

Desired state

To achieve a better pagespeed when reCAPTCHA is not needed or in use the scripts should only be loaded when the user focuses on an input field.

@fredericalpers fredericalpers added this to the v4.16 milestone Jun 12, 2023
@onOffice-Web-Org onOffice-Web-Org locked and limited conversation to collaborators Jun 12, 2023
@fredericalpers fredericalpers modified the milestones: v4.16, v4.15 Jun 19, 2023
@onOffice-Web-Org onOffice-Web-Org unlocked this conversation Jun 20, 2023
@dai-eastgate
Copy link
Contributor

dai-eastgate commented Jul 21, 2023

Hi @fredericalpers, I would like to confirm some points:

  1. "When reCAPTCHA is not needed" means: When the user has Google reCAPTCHA's "site key" and "secret key" installed but the "Requires Captcha" checkbox is not enabled in the Backend of the Forms => We don't load the reCAPTCHA javascript file right?

  2. "When reCAPTCHA is in use the scripts should only be loaded when the user focuses on an input field." means:

  • The word "focus on" that you mention is the Onfocus attribute of HTML DOM Events, right?
    image

=> When the user clicks (focus) on any input of the form, we will start loading the javascript file of reCAPTCHA right?

@fredericalpers
Copy link
Member Author

"When reCAPTCHA is not needed" means: When the user has Google reCAPTCHA's "site key" and "secret key" installed but the "Requires Captcha" checkbox is not enabled in the Backend of the Forms => We don't load the reCAPTCHA javascript file right?

Yes, that would be ideal for this case.

"When reCAPTCHA is in use the scripts should only be loaded when the user focuses on an input field." means:
255137306-d5547a71-0457-4673-a69f-37383ead67fc
=> When the user clicks (focus) on any input of the form, we will start loading the javascript file of reCAPTCHA right?

Yes, thats the idea. We will have to see if the google score will be affected and more normal visitors will be recognized as spam. But for now we want to imporve the performance with this.

@dai-eastgate
Copy link
Contributor

Yes, I got it. I will try implementing it and test "if the Google score will be affected and more normal visitors will be recognized as spam" and let you know as soon as possible. Thanks!

@dai-eastgate
Copy link
Contributor

dai-eastgate commented Aug 7, 2023

Hi @fredericalpers, I have completed implementing and testing the cases we discussed above. Please watch the attached video and let me know your opinion.
https://files.fm/u/j4gvjefe3

Concerning the question about the potential impact of Google score and spam recognition, I also researched and had the following comments:

  1. By loading reCAPTCHA only when the user interacts: Google's score will increase on plugin pages that don't need to load recaptcha (because it doesn't need time to load the recaptcha file). For example: The Estate List
    image

And on pages that need to load recaptcha, Google score will not be affected or increase a bit because we are loading asynchronously (limiting the possibility of HTML being blocked while waiting to load the js reCAPTCHA file).
image
image
image
image

  1. Normal visitors will be recognized as spam:
    The evaluation of a user as a spam bot or a real user when accessing the website is due to Google captcha's algorithm
    => The fact that we only load the js file when the focus does not interfere or have anything to do with the Google captcha algorithm => Normal visitors will not be considered spam

@fredericalpers
Copy link
Member Author

fredericalpers commented Aug 9, 2023

@dai-eastgate Looks good to me. Can't wait to test and release this! thank you :)

EDIT:

 Normal visitors will not be considered spam

Thats good to know! thank you for your feedback :)

@fredericalpers fredericalpers added QA Issue or Pull request that is in review and removed 1 week labels Aug 16, 2023
@andernath andernath modified the milestones: v4.15, v4.15.1 Oct 30, 2023
@dai-eastgate dai-eastgate self-assigned this Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
QA Issue or Pull request that is in review
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants