• Resolved andreas95

    (@andreas95)


    I can’t for the life of me, figure out, how I get the GDPR consent to work, with Cookieinformation (https://cookieinformation.com/).
    I have spoken to them, and they can’t help me.

    I have found out how to block the Facebook Pixel using the filter in the functions.php file. But I can’t figure out how to activate the Pixel again.
    I will need to do it using JavaScript.
    If I could control the embedding of the Pixel script, I could just wrap it in a consent, and it should work, but that does not seem possible.

    I find the documentation for this feature, shockingly lacklustre, since the plugin is so feature rich in all other ways.
    I hope some of you can guide me in the right direction.

    Also: “Enable the Facebook Pixel tracking before consent is captured” does not work. It fires no matter what, if I don’t have the filter.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author PixelYourSite

    (@pixelyoursite)

    Hi,

    Unfortunately I don’t have a solution for this problem.

    We don’t have an integration with cookieinformation.

    The filters you mention are design for developers, so the developers of cookieinformation should be the ones using them.

    It’s worth mentioning that we do no provide support for custom development.

    Thread Starter andreas95

    (@andreas95)

    Should this:
    apply_filters('pys_disable_facebook_by_gdpr',TRUE);
    in the functions.php not disable the Facebook Pixel?

    Because it does not…

    • This reply was modified 3 years, 9 months ago by andreas95.
    Thread Starter andreas95

    (@andreas95)

    I ended up making it work myself. Here is what I did:

    In the functions.php I add this code, to block the Facebook Pixel:

    <?php
    //Disable facebook
    function disableStuff() {
        return true;
    }
    add_filter('pys_disable_facebook_by_gdpr','disableStuff');
    ?>

    Then, in my header, I insert the following script, that runs when the user is giving consent, and also on page load, checking if the user have consented. I then use the utility function I found on the pys object, to activate the Facebook Pixel on consent:

    window.addEventListener('CookieInformationConsentGiven', function (event) {
    if (CookieInformation.getConsentGivenFor('cookie_cat_marketing')) {
    
    //Activate the pixel when the page is loaded
        window.onload = function() {pys.Facebook.loadPixel();};
    
    //If the page is already loaded, and the user gives consent, activate the pixel
    if(typeof pys !== 'undefined') {
        pys.Facebook.loadPixel();
    }
    }}, false);

    I am posting this, in the hopes that it will help other devs in my position. Please flesh out your docs for devs, PixelYourSite. You plugin is awesome.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘GDPR Consent and Cookieinformation’ is closed to new replies.