-
Notifications
You must be signed in to change notification settings - Fork 2
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
Performance Improvements: Load YouTube JavaScript when needed on Home and Product pages #2154
Comments
@briangrossman, I looked around this and it looks like we are currently using wagtail's embeds that give us the `embed/iframes for youtube videos and there are some thoughts I would want to share:
I think this might not be possible since the player loads the thumbnail and other configs from the script and waiting for clicking the play button might need some kind of placeholder that would take the place of youtube embed which will then be replaced with a youtube embed when the user clicks a play button in the placeholder. I couldn't exactly produce the same lighthouse results for youtube as the attached screenshots but,
There might be a possibility to just defer the youtube script but we should look into the above points before diving in deep. |
@arslanashraf7 At a high level, we have been using the Lighthouse reporting as a benchmark our sites. We made a number of changes recently that we hoped would have a significant impact... but they did not. We should try to identify a couple focused changes that we think will have a measurable impact. The reports were pointing to this particular code being the most significant issue on a couple pages... it would be good to know if you think it's reasonable to try to defer this code. Take a look at this page about Web Vitals which gives an overview of how the scoring works. Thanks! |
@briangrossman, I took a deeper look at this, and below are some insights that might be useful:
It might be a good idea to reduce the cover image size of this program. |
The associated PR was tested with dummy embeds since an issue was faced where |
@arslanashraf7 Why does this rely on #2155, BTW? I'm happy to test when we're ready. Thanks! |
@briangrossman, While working on this issue the wagtail mitxpro/cms/templates/partials/hero.html Line 44 in 0b33804
Due to the above issue, I was only able to test the #2179 by adding dummy iframes instead of
I would take another look at the PR to see if there could be a possibility of getting able to test the PR and I'll keep you posted! |
@arslanashraf7 - Can this be unblocked now that #2155 has been taken care of? |
@briangrossman Correct, The draft PR for this issue is already up at #2179 and since the |
Closing, Since the associated PR has been merged and deployed on Prod. |
If you look at the Lighthouse reports for the Home and Product pages, the JavaScript for YouTube is listed first under
Remove unused JavaScript
(see image below). Ideally, the YouTube would only load if it is needed (i.e if the user plays the video). If possible, please change the behavior to only load when needed.Designs and Mockups
Acceptance Criteria:
The text was updated successfully, but these errors were encountered: