Hi, I have a YouTube embeded video on some of my product pages and it increased my page load time by 4-7 seconds. I know that I can add the media through Shopify instead, but I do not want to go that route and I read that it doesn’t help much.
So, does anyone know how to have my YouTube embeds load after everything else? Or at least speed up the page load time while keeping the video?
If your youtube video is bellow the fold, you can add a attribute of loading=“lazy” to the youtube iframe and that will do the trick, however, I’m assuming its above the fold you added it to the product pages, in which case, unless you are autoplay the videos, then you will need to use the “Facade” method.
Never mind my last comment…I definitely didn’t understand.
But YOU WERE RIGHT!
My videos are all in the product description (so below the fold) and all I had to do was add loading=“lazy” after <iframe and it works without any other coding needed! Thanks!
Example for others:
This also works for images by putting loading=“lazy” after <img.
However, it only works for certain browsers such as Google Chrome, Firefox and a few other popular ones. Safari is implementing it soon too.