formie
formie copied to clipboard
Load recaptcha when user interacts with form
What are you trying to do?
It would be great if there was option in Formie to only load recaptcha once the user interacts with a form. Google lighthouse always shows loading Google recaptcha as something that slows down the page load (mainly on mobile) due to the JS file being around 150kb.
This is a feature on Freeform and would be great to have the ability to do this on Formie too.
What's your proposed solution?
Add a script, to only load the google recaptcha JS file once the user interacts with the first required field on a form.
Additional context
No response
Sounds like a good idea, thanks!
Hi, I don't suppose you have any plans to implement this feature in the near future? :)
We certainly do, yes, but no ETA. Likely in 2.1 early next year.
Ok sounds great, thanks!
Chipping in my desire for this too :) Having the recaptcha thing show up on every page of the site is annoying.
Hi,
Just re-visiting this - is there any plan to include this feature in the near future? We use google re-captcha on our sites, and it's size is 385.5KiB, which is negatively impacting our google lighthouse page speeds.
Thanks
It's 100% on our radar, and will be implemented in Formie 3 for Craft 5. In fact, this is already available in the craft-5
branch. We'll look to back-port this to Craft 4 if there's demand for this but it will be after our Craft 5 work.
In addition, Formie 3 will also not initialize its JS until the form is visible, bringing even further improvements.
That second part will be super awesome. We have a site that has a contact form in the footer of every page, so not initialising the JS until you scroll down will be a big deal :)
@engram-design hey Josh, I second that. Are there any updates on back-porting to Craft 4 yet? We have a quote form on every page, Lighthouse reports Captcha is the biggest culprit
I’m hesitant to backport it as-is without it being a breaking change, so might have to enable the behaviors behind a flag.
I’ll look into it.