Jump to content

reCaptcha a performance drag?


volteq

Recommended Posts

we recently upgraded to CC6.5.1 and are really pleased about the result.

when we enabled the reCaptcha, we found it adding quite some extra time to significantly impacted the google core vitals. I was wondering if there are ways to get around it?

Link to comment
Share on other sites

  • 1 month later...

Please examine the templates 'content.recaptcha.head.php', content.recaptcha.php', and element.recaptcha.php'.

These templates call the recaptcha script, and the <script src=""> tag should have async defer in it.

That should cause the browser to continue loading the HTML and rendering it without waiting for the script to finish loading. (Nor does the script wait for the HTML to finish loading.)

Link to comment
Share on other sites

Thanks - the first two files mentioned contain the async defer; the third - element.recaptcha.php doesn't seem to exist in the currrent template folder for foundation skin.  the file listed is element.recaptcha.invisible.php which apparently is left intentionally blank.

It's a bit of a mystery, then because the recaptcha is mentioned in the speed check on pagespeed.web.dev for the mobile and the desktop site ...

Thanks for replying, Brian - much appreciated, Margaret.

googlerecaptcha.png.ce90c8cc794cb8d7d8e421ec339a4faf.png

 

 

Link to comment
Share on other sites

Sorry, 'element.recaptcha.php' is new to CubeCart v6.5.2 (not yet released).

So, I am thinking that, even though the script tag in the template has async defer, which allows the script to run without waiting for the HTML to finish, the script that gets fetched then constructs a new piece of the web page and loads another script - what seems to be that /recaptcha__en.js filename.

The keywords async and defer do not need both to be used. Some say that async will be used, but if the browser is old enough to not support it, then the fallback is to use defer.

In those files I mentioned, you can try to have only defer. (You may need to have CubeCart clear its internal cache if you make changes to the templates.)

See:

https://pagespeedchecklist.com/async-and-defer

 

Edited by bsmither
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...