We know that web visitors love to watch short videos on a website – see real people talking and quickly learn about whatever it is they want to know. So it makes sense from a customer perspective to include some of your best videos right there on your website. But videos have one major disadvantage – they slow websites down. That’s bad for search engine optimisation (SEO) but also for the user experience (UX).

Embedding your YouTube videos is an easy way to add video content to a website so it seems like a great solution. After all YouTube is owned by Google so surely doing that would be an efficient way to include video content? Nope! Actually, YouTube’s default embedding format can significantly slow down a web page because it uses scripts and third-party tracking.

Why Embedding YouTube Videos Affects Page Speed

The standard HTML code generated by YouTube to embed a video on a web page will also load code that enables multiple external requests which track users and influence their behaviour. For instance:

  • Google Tracking using Google Tag Manager
  • Google Ads tracking
  • Engagement & Tracking Features such as other YouTube recommendations

But, fortunately, there is an option to reduce the resources included in the embed HTML code and avoid slowing down your website speed. Google just like to hide it away so most people don’t know about it!

Let’s take a look then at how to prevent videos slowing down your website.

How to Optimise Embedded YouTube Videos

YouTube has what’s commonly known as a “No-Cookie” option to embed videos via the “Enable privacy-enhanced mode”. The desirable side-effect of this non-default privacy option is that it reduces third-party requests and improves page speed.

Let’s look at how to use this option:

Step 1: Understand how to embed a YouTube video

In case you need a reminder of how to find the standard embed code for a particular YouTube video, all you have to do is click “Share” underneath any video.

no cookie youtube embed step 1

Then select the Embed option from the popup box that appears:

privacy-enhanced mode - youtube embed

You’ll see some HTML code on the right of the next popup box that appears – scroll down until you see the “Enable privacy-enhanced mode” checkbox and select it. Then click the Copy button:

youtube embed - speed improvement

Step 2: Add the Embed Code

Now, instead of using the standard YouTube embed HTML code we’re using a much more efficient version that will improve your page speed. It will look something like this (note the red highlighted section will be the unique ID of your own video):

<iframe width=”560″ height=”315″ src=”https://www.youtube-nocookie.com/embed/W_T-VvPCgIM?si=KaFxEAlxWnI7AB_6″ title=”YouTube video player” frameborder=”0″ allow=”accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share” referrerpolicy=”strict-origin-when-cross-origin” allowfullscreen></iframe>

You can then add this to your web page. For example, on a WordPress website simply add a Custom HTML block on the page where you want the video to appear and then paste the embed code into that block.


Step 3: Further modifications

However, for even more speed improvement you can also use “lazy loading” to ensure a browser only loads the video when it becomes visible on screen. We always recommend placing videos below the fold and lazy-loading them so they are only loaded if a web visitor scrolls or swipes down the page.

Here’s what the HTML code will look like with lazy loading tag:

<iframe width=”560″ height=”315″loading=”lazy” src=”https://www.youtube-nocookie.com/embed/W_T-VvPCgIM?si=KaFxEAlxWnI7AB_6″ title=”YouTube video player” frameborder=”0″ allow=”accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share” referrerpolicy=”strict-origin-when-cross-origin” allowfullscreen></iframe>

After you have added the code to your web page just add loading=”lazy” as shown above to implement this feature.

By using YouTube’s privacy-enhanced mode you can limit third-party requests from your web page, which results in:

  • Faster load times
  • No automatic tracking of visits by YouTube
  • Better user experience

Michelle Symonds - SEO Consultant - Ditto Digital

Established as an SEO specialist since 2009, after a career as a software engineer in the oil industry and investment banking. Michelle draws on her technical experience to develop best-practice processes for implementing successful SEO strategies. Her pro-active approach to SEO enables businesses to reach new audiences, both nationally and internationally. She has a wealth of cross-industry experience from startups to Fortune 500 companies.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.