Skip to content
LandexHub

YouTube, maps and chat: the cookies everyone forgets

· 4 min read

On this page
  1. Why it matters
  2. Where scripts hide
  3. YouTube and youtube-nocookie.com
  4. A preview instead of a video or map
  5. Scripts controlled by the banner
  6. Web fonts
  7. How to clean up
  8. Common mistakes

Your cookie banner blocks Google Analytics, but the video on the homepage or the map on the contact page stores cookies as soon as the page loads. This guide shows which elements most often start without consent, how to find them on your website and how to change them so they load only after consent. It is for website owners and the people who manage their websites.

Why it matters

A banner can only block what it knows about. Tracking code usually goes through Tag Manager, where the banner controls it. Videos, maps and chat widgets, however, are often pasted straight into page content by an editor or added by a plugin. They then start regardless of the visitor’s choice.

Embedded third-party content is a separate page inside an iframe. Once it loads, it can store its own cookies and send data to its provider. The banner on your website cannot see inside it.

Where scripts hide

Element What it does when it loads Usual category
YouTube video loads the YouTube player, may store cookies marketing
Google Maps loads the map from Google, may store cookies depends on the provider, often marketing
Chat and feedback widgets loads the provider’s script, often with cookies depends on the tool
Meta Pixel, LinkedIn, TikTok tracks visits for advertising marketing
Web fonts from Google Fonts passes the IP address to Google no cookies, but data transfer
Reviews, ratings, calendars the provider’s widget depends on the tool

The tool’s documentation or privacy policy says which cookies it stores and why. Use that to put the tool into a category in your banner.

YouTube and youtube-nocookie.com

YouTube offers a privacy-enhanced mode. You embed the video from youtube-nocookie.com instead of youtube.com:

HTML
<iframe
  src="https://www.youtube-nocookie.com/embed/VIDEO_ID"
  width="560" height="315"
  title="Product demo"
  allow="encrypted-media; picture-in-picture"
  allowfullscreen></iframe>

It is a better default, but the player still loads from Google’s servers and may store data in the browser. Only a placeholder that loads the player after a click gives you certainty.

A preview instead of a video or map

Instead of the iframe, show an image and a button. The player loads only when the visitor clicks it. Say on the button where the content comes from, so the visitor knows what the click starts. The other option is to load the player automatically once the visitor agrees to the matching category in the banner.

video-preview.htmlHTML
<div class="video-preview" data-video-id="VIDEO_ID">
  <img src="/images/video-preview.jpg" alt="Product demo" width="560" height="315">
  <button type="button">Play video (loads from YouTube)</button>
</div>

<script>
  document.querySelectorAll('.video-preview').forEach(function (box) {
    box.querySelector('button').addEventListener('click', function () {
      var iframe = document.createElement('iframe');
      iframe.src = 'https://www.youtube-nocookie.com/embed/' + box.dataset.videoId + '?autoplay=1';
      iframe.width = 560;
      iframe.height = 315;
      iframe.title = 'Product demo';
      iframe.allow = 'autoplay; encrypted-media; picture-in-picture';
      iframe.allowFullscreen = true;
      box.replaceChildren(iframe);
    });
  });
</script>

Store the preview image on your own website. An image loaded straight from YouTube would contact Google’s servers again. You can handle a map the same way: a static image with the address and a button that inserts the map iframe. For a contact page, an “Open in Maps” link that loads nothing in advance is often enough.

Scripts controlled by the banner

Most cookie banners can block a script and run it only after consent to a given category. This is usually done by changing the script type and adding an attribute with the category:

HTML
<script type="text/plain" data-category="marketing">
  // chat or pixel code, runs only after consent to marketing
</script>

The exact attribute name depends on the banner; you will find it in its documentation. If you run scripts through Google Tag Manager, set a consent requirement on the tag or a trigger tied to consent.

Web fonts

According to Google, Google Fonts do not set cookies, but when the browser downloads them, the visitor’s IP address is passed to Google. The solution without any banner is to host the fonts on your own website:

styles.cssCSS
@font-face {
  font-family: 'Inter';
  src: url('/fonts/inter-regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

Then remove the links to fonts.googleapis.com and fonts.gstatic.com from the page head. Watch the theme and plugins too, as they may add them on their own.

How to clean up

  1. Find all embedded elements

    Go through the homepage, contact page, blog, products and cart. In the developer tools (F12), on the Network tab, filter for youtube, maps, facebook, fonts and the name of your chat tool.

  2. Find out the cookies and purpose of each

    On the Application tab, under Cookies, you also see third-party domains. Look up the purpose in the tool’s documentation.

  3. Put the tools into categories

    In the banner’s settings, assign each tool to a category and add its description to your cookie information.

  4. Change how they are embedded

    Videos and maps through a preview, chat and pixels through banner blocking or Tag Manager, fonts hosted on your own website.

  5. Check the result

    In a private window without consent, the cookies must contain nothing from YouTube, Google, Meta or the chat tool. The steps are in How to check that your cookie banner waits for consent.

Common mistakes

  • A video added by an editor. The theme is fine, but a blog post contains a YouTube iframe.
  • A map in the footer. It loads on every page of the website.
  • Chat outside the banner. The provider supplied a snippet and it went straight into the page head.
  • A preview from someone else’s server. The video thumbnail loads from YouTube, so Google is contacted anyway.
  • A plugin that adds fonts. The fonts are hosted locally, but a form plugin or page builder still loads Google Fonts.
  • Wrong category. Chat or maps listed as necessary so that they always work.

LandexHub Consent scans your homepage for scripts, iframes and pixels that load before consent, and runs scripts marked with a category only after the visitor agrees.

Frequently asked questions

Is it enough to embed videos from youtube-nocookie.com?
It helps, but it is not enough on its own. The video still loads from Google's servers. The safest option is to show a preview instead of the video and load the player only after a click or after consent.
Which category does a chat widget belong to?
It depends on what the chat stores and whether it collects data for analytics or marketing. Check the tool's documentation for the cookies it uses. If it only keeps the conversation going, it may be necessary; statistics and targeting need consent.
Do Google Fonts set cookies?
According to Google, no. When fonts load from its servers, though, the visitor's IP address is passed to Google. It is simpler to host the fonts on your own website; then there is no consent question at all.

Similar guides

5 min read

Google Consent Mode v2, explained simply

What Google Consent Mode v2 is, which four consent signals it sends, how to set it up in code and in Tag Manager, and how to check that it works.