Skip to content
Advanced
External services

External services

YouTube

You can ensure that YouTube videos respect user consents from CookieHub by using the "data-consent" attribute for iframes, similar to how you would with script tags. In addition to adding the "data-consent" attribute, you'll need to change the "src" attribute to "data-src." This way, the YouTube video will only load if the user has provided their consent.

Here's an example:

<iframe data-consent="analytics" data-src="https://www.youtube.com/embed/NHEaYbDWyQE" frameborder="0" width="560" height="315" allowfullscreen></iframe>

In this example, the "data-consent" attribute is set to "analytics," indicating that the video is related to analytics. This ensures that the video will only load if the user has consented to the "analytics" category through CookieHub. By making this adjustment, you can respect user consents and maintain compliance with data privacy regulations while embedding YouTube videos on your website.

Vimeo

When embedding videos from Vimeo, users can enhance the functionality of the Vimeo player by appending various URL parameters to the end of the player's URL. One of these parameters is "dnt," which stands for "Do Not Track." Enabling this option prevents the player from tracking any session data, including cookies and analytics.

To activate the "Do Not Track" setting on your Vimeo embed video, simply add "?dnt=true" to the end of the URL within the "src" attribute:

<iframe src="https://player.vimeo.com/video/76979871?dnt=true" width="640" height="360"></iframe>

If you already have other parameters enabled, replace the "?" with "&" to ensure proper URL formatting:

<iframe src="https://player.vimeo.com/video/76979871?embedparameter=value&dnt=true" width="640" height="360"></iframe>

By using this method, you can control the tracking preferences for your Vimeo embedded videos, aligning them with your data privacy and user experience goals.

Facebook Pixel

Facebook Pixel provides methods to enable or disable consent mode based on user preferences regarding specific cookie categories. The default implementation for this feature is not set, as the appropriate cookie category can vary depending on how you use Facebook Pixel on your website. However, it's relatively straightforward to implement this functionality with a few modifications to your existing code.

Here's a step-by-step guide on how to implement Facebook Pixel consent mode with CookieHub:

Update Your Facebook Pixel Code

Add the fbq('consent'...) line to your Facebook Pixel code just before the init method. This line sets the consent mode to either 'grant' or 'revoke' based on the user's choice. Here's an example of how to do it:

<!-- Facebook Pixel Code -->
<script>
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,'script',
'https://connect.facebook.net/en_US/fbevents.js');
 
fbq('consent', 'revoke');  // Set the default consent to 'revoke'
fbq('init', 'xxxxxxxxxxxxxxxxxxx');  // Your Pixel ID
fbq('track', 'PageView');
</script>
<!-- End Facebook Pixel Code -->

Modify Your CookieHub Implementation

Update your CookieHub implementation code to include triggers for the onAllow and onRevoke events. These triggers will change the consent mode in Facebook Pixel when users make choices regarding specific cookie categories.

Here's an example of how to do it:

var cpm = {
  onAllow: function(category) {
    if (category == 'marketing') {
      fbq('consent', 'grant');  // Set consent to 'grant' for marketing category
    }
  },
  onRevoke: function(category) {
    if (category == 'marketing') {
      fbq('consent', 'revoke');  // Set consent to 'revoke' for marketing category
    }
  }
};

In this example, we've set up Facebook Pixel to respond to the user's choices in the "marketing" category. If you wish to use the "analytics" category instead, simply replace 'marketing' with 'analytics' in both the onAllow and onRevoke sections.

By following these steps, you can ensure that Facebook Pixel's consent mode aligns with your users' preferences, allowing you to maintain compliance with data privacy regulations and offer a more personalized experience on your website.