Support » Plugin: Pixel Caffeine » Making Pixel Caffeine GDPR compliant

  • Albert


    Please add an option for having and opt out in the privacy section. If the users click that, the facebook pixel won’t be loaded.

    For example, use this code:

    // Facebook Pixel with GDPR OPT OUT via Cookie 
    var fp_disableStr = 'fb-pixel-is-disabled';
    if (document.cookie.indexOf(fp_disableStr + '=true') > -1) {
    window[fp_disableStr] = true;
    console.log("Facebook-Pixel is deactivated - Cookie recognized");
    } else {
          if (navigator.doNotTrack !== '1') {
    // no cookie has been found, load this:
    // Set pixel ID  below
    / --------------------------------------------------------------------
    fbq('init', 'Pixel-ID'); // Your FB Pixel ID
    fbq('track', 'PageView');
    // --------------------------------------------------------------------
    console.log("Facebook-Pixel Code loaded");
    function fbOptout() {
    document.cookie = fp_disableStr + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/';
    window[fp_disableStr] = true;
    console.log("Facebook pixel deactivated, reload this page.");

    Then, we just have to use this code on the Privacy page:

    <a onclick="alert('Facebook Pixel was deactivated');" href="javascript:fbOptout()">Facebook Pixel Opt-Out</a>

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Antonino Scarfì


    Thank you for the suggestion.

    I will add this need and solution to my backlog, in order to do that as soon as possible.

    Thank you for sharing, it might be useful for other users too.

    could you please explain how to install the optout option?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Making Pixel Caffeine GDPR compliant’ is closed to new replies.