• Resolved johnrellis

    (@johnrellis)


    As part of readiness for Google’s May 2021 incorporation of Core Web Vitals, I replaced the default Youtube embeddings on my site with WP YouTube Lyte, which was straightforward and works well. However, I’m observing strange, concerning results with the Pagespeed Insights metrics on a simple test page. It’s not clear whether I’m doing something wrong, there’s a bug in the plugin, or a bug in Pagespeed Insights.

    Pagespeed Insights reports that the Mobile test downloads 541 KB of Javascript from youtube-nocookie.com:

    https://www.youtube-nocookie.com/s/player/03226028/player_ias.vflset/en_US/base.js
    https://www.youtube-nocookie.com/s/player/03226028/www-embed-player.vflset/www-embed-player.js

    And it thinks that these scripts blocked the main thread for 1.635 seconds. The overall Mobile score was a mediocre 59.

    BUT the Desktop metrics don’t call out those scripts, nor do they report those scripts blocking the main thread. The overall Desktop score was 99.

    Even more curiously, when I use Chrome’s Developer Tools to monitor network requests, I don’t see those scripts being downloaded until I click the play button of the video.

    I’m not experienced with WordPress — could I be doing something screwy? Or is Pagespeed Insights improperly clicking the video play button in its Mobile measurements? Given the supposed importance of Core Web Vitals to ranking starting in May, I’m forced to be more interested in “coding to the test” rather than delivering the best user experience.

    If you’d like to see what I’m observing, I implemented a simple test page in a virgin WordPress 5.6, along with the same page sans the video:

    https://3.232.69.144/youtube-test/
    https://3.232.69.144/null-test/

    I’m running Pagespeed Insights on those URLs:

    https://developers.google.com/speed/pagespeed/insights/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    by default LYTE does not work the same way on mobile as users have to click “play” twice (once to load the real video and once to have that start play, as opposed to desktop where the video starts playing immediately when loaded). you can alter that behavior by ticking the “cache thumbnails locally”.

    hope this helps,
    frank

    Thread Starter johnrellis

    (@johnrellis)

    Cache Thumbnails Locally made a very large improvement in the Pagespeed Insights mobile metrics, thanks!

    But I’m curious — when thumbnails aren’t cached, why are the Youtube Javascript files being downloaded on mobile before the user clicks play?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    Well; as I wrote to avoid forcing mobile users to have to click twice to play, LYTE loads the YouTube video immediately, but this can be changed with a filter (add_filter( 'lyte_do_mobile', '__return_true' );).

    On the other hand we have the “cache thumbnails locally” option, which is mainly a privacy feature, so if someone enables that option, LYTE assumes they want max. privacy and switches to “lyte do mobile” to avoid any YouTube resource being loaded before one clicks “play”.

    Thread Starter johnrellis

    (@johnrellis)

    Now I understand, thanks much.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    you’re welcome, feel free to leave a review of the plugin and support here! ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Worrying results with Pagespeed Insights’ is closed to new replies.