Optimize Critical Images - Collect the viewport size when sending the beacon data
Before submitting an issue please check that you’ve completed the following steps:
- Made sure you’re on the latest version ✅
- Used the search feature to ensure that the bug hasn’t been reported before ✅
Describe the bug It can happen that the LCP image detected by the Optimize Critical Images feature is different than the one detected by PageSpeed Insights, probably because the LCP was checked in a resolution with a shorter height where the bottom image was partially visible.
We don't have a way to prevent that because only the minimum height and width can be controlled for now. We should ideally control both the min and max.
To be able to check this, we'd need to collect the viewport size when sending the beacon data.
Expected behavior The LCP image detected by Optimize Critical Images feature should always be the same as the one detected by PageSpeed Insights
Additional context Slack thread: https://wp-media.slack.com/archives/C072P5EU5DF/p1717488388163419?thread_ts=1717420579.652189&cid=C072P5EU5DF
Acceptance Criteria (for WP Media team use only) Clear instructions for developers, to be added before the grooming