YouTube Embed and GDPR: Cookie-Free Approaches

Steven | TrustYourWebsite · May 15, 2026 · Last updated: May 2026

A standard YouTube embed on a website is one of the most common GDPR cookie issues. The default iframe at https://www.youtube.com/embed/... connects to Google servers and sets tracking cookies (VISITOR_INFO1_LIVE, YSC, GPS, PREF and others) the moment the page loads, regardless of whether the visitor ever clicks play. Under Article 5(3) of the ePrivacy Directive, this processing requires prior consent.

This guide covers the three patterns available and what each one actually does: the default embed, the privacy-enhanced youtube-nocookie.com mode, and the click-to-load facade. Plus the joint-controllership question that the Fashion ID ruling (C-40/17, 29 July 2019) raised for any third-party embed. For a quick check of which third-party trackers your pages already load, run a free scan.

What a standard YouTube embed actually does

Copy a YouTube embed code today and paste it into a webpage. The HTML looks like this:

<iframe
  src="https://www.youtube.com/embed/VIDEO_ID"
  width="560"
  height="315"
  frameborder="0"
  allow="autoplay; encrypted-media"
  allowfullscreen
></iframe>

When the page loads, the browser:

  1. Sends an HTTP request to youtube.com for the iframe content
  2. Receives the player HTML and assets
  3. Establishes connections to Google's tracking and ad infrastructure (google.com, googleadservices.com, doubleclick.net in some cases)
  4. Sets cookies on the visitor's device for the youtube.com domain (and parents)
  5. Reports the page view to Google Analytics infrastructure

All of this happens before the play button has been clicked. From an Article 5(3) ePrivacy perspective, the cookies are placed without prior consent. From an Article 6 GDPR perspective, the personal data (IP, user agent, page URL) is processed without a legal basis.

The privacy-enhanced mode: youtube-nocookie.com

YouTube provides a "privacy-enhanced" alternative domain at www.youtube-nocookie.com. The embed URL is identical except for the host:

<iframe
  src="https://www.youtube-nocookie.com/embed/VIDEO_ID"
  width="560"
  height="315"
  frameborder="0"
  allow="autoplay; encrypted-media"
  allowfullscreen
></iframe>

What changes:

  • Persistent tracking cookies are not set on the initial load
  • Some cookies appear only after the user plays the video
  • The connection to Google servers still happens on the initial load (IP and user-agent disclosure)

What does not change:

  • A request is still sent to Google on every page load that contains the embed
  • The visitor's IP address still reaches Google
  • Once playback starts, cookies are set

National supervisory authority positions vary. The German Conference of Independent Data Protection Authorities has generally accepted youtube-nocookie.com as a significant improvement that may still need consent depending on how it is configured. The French CNIL treats the initial load as personal data processing requiring a legal basis. The Italian Garante has taken similar positions in individual decisions.

The cautious interpretation is that youtube-nocookie.com reduces but does not eliminate the need for consent or for a compliant cookie banner. Use it as a defense-in-depth layer, not as a stand-alone solution.

The click-to-load facade: the cleanest pattern

A facade replaces the iframe with a static image plus a play button. Only when the user clicks does the actual iframe load. No connection to Google before the click. The click itself constitutes the affirmative user action that creates consent for the subsequent processing.

The minimal pattern in vanilla HTML and JavaScript:

<div class="youtube-facade"
     data-video-id="VIDEO_ID"
     style="position:relative;cursor:pointer;aspect-ratio:16/9;
            background:#000;display:flex;align-items:center;justify-content:center">
  <img src="/thumbnail.jpg" alt="Video preview"
       style="position:absolute;width:100%;height:100%;object-fit:cover" />
  <button aria-label="Play video"
          style="position:relative;width:80px;height:80px;border-radius:50%;
                 background:rgba(255,255,255,0.9);border:0;cursor:pointer">
    <svg viewBox="0 0 24 24" width="40" height="40">
      <path d="M8 5v14l11-7z" fill="#000"/>
    </svg>
  </button>
</div>

<script>
document.querySelectorAll('.youtube-facade').forEach(el => {
  el.addEventListener('click', () => {
    const id = el.dataset.videoId;
    const iframe = document.createElement('iframe');
    iframe.src = `https://www.youtube-nocookie.com/embed/${id}?autoplay=1`;
    iframe.allow = 'autoplay; encrypted-media';
    iframe.allowFullscreen = true;
    iframe.style.cssText = 'position:absolute;inset:0;width:100%;height:100%;border:0';
    el.replaceChildren(iframe);
  });
});
</script>

Three properties:

  1. No request to Google on page load. The thumbnail can be served from your own CDN or downloaded at build time. No fetch to i.ytimg.com or googlevideo.com until the user clicks.
  2. Click is affirmative action. The user has unambiguously chosen to play the video. This is the Article 4(11) GDPR standard for consent.
  3. youtube-nocookie.com on the actual iframe for defense in depth, reducing the post-click tracking footprint.

For thumbnails: YouTube provides image URLs at https://i.ytimg.com/vi/VIDEO_ID/maxresdefault.jpg, but fetching them at page-load time also makes a request to Google. Best practice is to download the thumbnails at build time and serve them from your own infrastructure.

The Fashion ID joint-controllership analysis

In Fashion ID (C-40/17), the Court of Justice of the EU ruled that a website operator embedding a Facebook Like button was a joint controller with Facebook for the collection and transmission of personal data triggered by the embed. The operator was responsible for ensuring a lawful basis at the moment of collection on their page. Facebook was responsible for what it did with the data afterwards.

The reasoning extends directly to YouTube embeds:

  • The website operator chose to embed the YouTube player
  • The choice has a direct, intended consequence of transmitting visitor data to Google
  • The website operator therefore co-determines the means of the processing (the fact of transmission), even though Google determines the purposes after receipt

What this means in practice:

  • The operator must ensure a lawful basis for the collection and transmission triggered on their page
  • That lawful basis is, in almost all cases, consent
  • The operator must inform visitors about the joint controllership in the privacy notice
  • An Article 26 joint-controller arrangement is required, but for major platforms like YouTube the arrangement is typically established by accepting the platform's terms (Google's Joint Controller Terms for relevant products)

The click-to-load facade resolves most of this elegantly: before the click, there is no transmission, so no joint controllership arises. After the click, the click is the documented consent action.

Privacy notice disclosure

For pages that use YouTube embeds, the privacy notice should include something along these lines:

We embed videos hosted by YouTube, a service operated by Google LLC, 1600 Amphitheatre Parkway, Mountain View, CA 94043, United States. When you play an embedded video, your IP address, browser metadata and interaction with the player are transmitted to Google. Google LLC is certified under the EU-US Data Privacy Framework approved by Commission Implementing Decision (EU) 2023/1795. We act as joint controllers with Google for the collection and transmission of personal data triggered by the embed, in line with the CJEU ruling in Fashion ID (C-40/17). Our legal basis for this processing is your consent under Article 6(1)(a) GDPR, expressed by your click on the play button.

The disclosure aligns the technical pattern (click-to-load) with the legal basis (consent via the click).

Pattern selection: which to use

NeedUse
Maximum compliance, no banner relianceClick-to-load facade with youtube-nocookie post-click
Consent banner already covers analytics + marketing categories, video plays automatically after consentyoutube-nocookie.com with banner-gated load
Legacy site with embedded videos and no bannerReplace with click-to-load as soon as possible
Static landing pages without third-party trackingClick-to-load facade

The click-to-load facade is the recommended default in 2026 for new pages.

Common failure modes

Standard youtube.com embed left in place. The single most common failure. Default WordPress embeds, Squarespace embeds and Webflow embeds use the standard domain.

youtube-nocookie.com without a banner. Improves the cookie footprint but does not address the page-load connection to Google.

Thumbnail fetched from i.ytimg.com on page load. A click-to-load facade that fetches the thumbnail from Google at page load defeats half the purpose. Self-host the thumbnail.

Player widget that loads even when no video appears. The YouTube player API JavaScript loaded globally on every page "just in case" a video is embedded. Load on-demand only.

Privacy notice does not mention YouTube. A common omission. YouTube is a recipient of personal data and a joint controller, so it must be disclosed.

Implementation patterns

WordPress

Several plugins implement the click-to-load pattern: Embed Privacy, WP YouTube Lyte and Lazy Load for Videos. They replace the default embed with a facade automatically. After installation, audit the resulting pages to confirm no youtube.com request appears before the click.

Next.js / React

The react-lite-youtube-embed or @lite-youtube-embed web component implements the facade pattern. Add the package and replace any <iframe src="youtube.com/embed/..."> with the component.

Static HTML

The script in the section above can be pasted directly into any HTML page.

Headless CMS

If the CMS exposes video embeds as a content type, replace the front-end render template with the facade pattern. No need to touch each piece of content individually.

For the broader compliance map of third-party embeds, see do I need a cookie banner for the decision flow and Google Fonts and GDPR for a comparable embed-side issue.

Final checklist

  • No youtube.com/embed requests fire before the user clicks play
  • Thumbnails self-hosted or fetched at build time, not on page load
  • Post-click iframe uses youtube-nocookie.com as defense in depth
  • Privacy notice discloses YouTube as a recipient and Google LLC under the DPF
  • Joint controllership with Google acknowledged in the privacy notice
  • No legacy plugins or themes silently inject youtube.com scripts elsewhere
  • Page-load network audit confirms no Google requests before the play click

This is technical analysis, not legal advice. For sites with extensive video integration, live streaming or paid YouTube features, consult a lawyer who specialises in data protection.

Share this article