-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
3rd party code affecting score #5209
Comments
If your iframes don't block initial render and are lazy loaded correctly, they definitely should not affect your performance score. You can implement lazy loading via IntersectionObserver API for yourself or use existing libraries like https://github.com/ApoorvSaxena/lozad.js for example. |
For sure tho if it's in the viewport (above the fold) it will render anyway? In our score it shows YouTube as being the largest network payload w/ base.js at 423Kb. |
Or does lighthouse account for intersection observer entries differently? |
Yes, your iframe will render above the fold in any case. But you can reduce time for You don't need to use IntersectionObserver for this task to fullfill. But this modern API comes quite handy in this case, as you don't want to use a costly onscroll handler for your elements to detect when they enter viewport. |
Absolutely intersection observer FTW; I use it a lot already including our own viewport analytics |
I guess my question should be does the Performance, Diagnostics section: enormous network payloads affect the performance score? |
This issue goes into account for sure as well. |
Thanks for filing @derekoakley! Few things...
Only the metrics affect your performance score, so if you can do well on those then you're 💯. The opportunities/diagnostics are just there to help you diagnose what's going on and find easy room for improvement.
As @midzer has said, if the content isn't critical then you can defer their load until a later time when the user has interacted with the page. Time To Interactive waits until there has been 5s of network and CPU quiet, so whatever lazy load mechanism you use would need to wait until after that point to not affect TTI. If they're a critical part of your page though and you cannot defer their loading, there's not much you can do to avoid them impacting the metrics. We've gotten this feedback a lot and are exploring ways to better surface the impact of 3rd parties on the ecosystem. |
It's interesting that you specify |
@derekoakley If it's your content anyway, why not self-host and include it as HTML5 |
@midzer sadly it's not and we have to support various platforms that our customers use |
duping into #4516 |
Hi, we have iframes above the fold that load YouTube videos and such like and it affects our score. Currently they fire at DOMContentLoaded tho wonder if there is a better way or a method for dealing with 3rd party content that is outside of our control?
The text was updated successfully, but these errors were encountered: