Support » Plugin: Civic Cookie Control » Embedded YouTube videos

  • Resolved mtrehearn



    I have embedded iframe YouTube videos on my site and although I use the YouTube enhanced privacy / no cookie solution to remove most tracking cookies it still sets some cookies when the user plays the video for preferences etc.

    Is there a way to remove the YouTube videos altogether and instead place a “you must consent to the YouTube cookies” type message then once the user turns on consents to those cookies then reveal the iframe and therefore video (similar to the process for analytics)?

    Thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Tasos Fel



    You can create the youtube iframes dynamically inside the onAccept callback. That way the iframes will not be on the page until the user consents. So the onAccept could be like this:

    onAccept: function() {
        var iframe = document.createElement("iframe");
        iframe.src = <youtube-url>; = "youtube-iframe";
        var youtubeHolder = document.getElementById("yt-holder");

    You should use a similar snippet for all videos on the page. Similarly, inside the onRevoke you could remove all of these iframes, using the removeChild() method:

    onRevoke: function() {
      var frame = document.getElementById("youtube-iframe");
    Thread Starter mtrehearn



    Thank you for your help.

    Appreciate this.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Embedded YouTube videos’ is closed to new replies.