-
Notifications
You must be signed in to change notification settings - Fork 132
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
LG-15612 Load reCAPTCHA script earlier in the page #11880
LG-15612 Load reCAPTCHA script earlier in the page #11880
Conversation
@@ -1,5 +1,6 @@ | |||
<%= content_for(:head) do %> | |||
<%= javascript_include_tag('init.js', nopush: false, integrity: 'sha256-eMXV2njRJxgQrFbuljRT/UTWePGrhl83bHHDDd+jFPw=') %> | |||
<%= render CaptchaScriptComponent.new %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we want this on every page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you try using content_for
inside the existing component?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was right there in the Technical notes! 😢 I have now and it seems to be working smashingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added to content_for with 7d1ac2b
Fixed up tests from slack conversation with 10eba3a
0d82c16
to
97755d0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested with live reCAPTCHA in local environment and works as expected! 🚀
🎫 Ticket
Link to the relevant ticket:
LG-15612
🛠 Summary of changes
Moves the reCAPTCHA script to the document head. Adds a new Yield area in the base html template so the script occurs before the stylesheets are loaded.
The intent is to optimize loading of the reCAPTCHA initializer to improve accuracy of scoring.
📜 Testing Plan
Prerequisite config settings
In application.yml set placeholder values for
recaptcha_secret_key
andrecaptcha_site_key
To test if enterprise script loads set a value for
recaptcha_enterprise_api_key
andrecaptcha_enterprise_project_id
https://www.google.com/recaptcha/api.js
script appears near the top just after the fonts are loaded and before the style sheets.https://www.google.com/recaptcha/enterprise.js