Blocking videos

Some video players like Youtube uses cookies and process personal data as a part of the service. For this reason, you as a website operator are obligated to collect a Prior Consent, before the video players are loaded on your website.

There are several different video players but for this example, we will show how to use the Cookie Control SDK together with an embedded youtube video player. Most embedded video players will use a standard iframe implementation like the one below:

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


To enable the Cookie Control SDK simply place the iframe inside and change the cookie_cat_category to the correct categorization:

  • cookie_cat_functional
  • cookie_cat_statistic
  • cookie_cat_marketing
<iframe
width="560" height="315" data-category-consent="cookie_cat_category"
src="" data-consent-src="PLACE VIDEO URL HERE"
frameborder="0" allow="autoplay; encrypted-media" allowfullscreen>
</iframe>

This would be the final example that you find will end up having on your website:

<iframe
width="560" height="315" data-category-consent="cookie_cat_marketing"
src="" data-consent-src="https://www.youtube.com/embed/videoseries?list=PLx0sYbCqOb8TBPRdmBHs5Iftvv9TPboYG"
frameborder="0" allow="autoplay; encrypted-media" allowfullscreen>
</iframe>

Expected behavior:

Once you have implemented the Cookie Control SDK the videos will not be shown on your website before the user has given their consent in the consent pop-up. If the user declines the cookie_cat_category the video will not be shown. In this case, it might be a good idea to provide the users with a placeholder text asking them to give their consent to show the video.


Providing a placeholder

*This implementation will work only for YouTube and Vimeo videos.

If you are using the Cookie Control SDK to control cookies set by Youtube or Vimeo videos. The result will be that the video is invisible until the user gives consent.

You can give the user a placeholder consent-text to let them know that there is a video placed on the page and by renewing their consent, they can watch it.

*The implementation in the Cookie Information Platform can be found at the bottom

Youtube implementation example

<iframe width="560" height="315" src="" data-category-consent="cookie_cat_statistic" data-consent-src="https://www.youtube.com/embed/3EeY_7ujsew" frameborder="0" allow="autoplay;"></iframe>


How to enable consent-text

Use this JS-variable to enable the consent-text

window.CookieInformation.enableYoutubeNotVisibleDescription = true;

Setup the category

You need to specify the cookie category you used to block the videoes by, in order for the function to work.

window.CookieInformation.youtubeCategorySdk = 'cookie_cat_statistic';

Setup description for consent-text

You can provide your own custom consent-text for this function and will be placed on the page in the spot where the video should be. They will be removed again once the user has consented to the category.

window.CookieInformation.youtubeNotVisibleDescription = 'You have to consent to statistic cookies to see this content.<br /><span>Click here to renew consent</span>';

Styling

You can set up a class-name for the consent-text to target CSS-styling.

window.CookieInformation.youtubeBlockedCSSClassName = 'youtube-consent-text';

How to set this up

You can easily add these four variables in the Javascript section of the pop-up template.

  • Navigate to your consent solution and then go to the POP-UP tab.
  • Go and click the "Advanced settings" to fold out the three code fields.
  • Paste the four variables in the Javascript section and click SAVE & PUBLISH
mceclip0.png

Did this answer your question?