• Resolved nickfr

    (@nickfr)


    here is a workaround for gdpr plugin and facebook pixel plugin to block cookies
    can i use a filter in your plugin too? like pys_disable_by_gdpr

    
    /**
     * Disable Facebook Pixel based on Cookie Consent
     *
     * This snippet disables the Facebook Pixel Tracking Code based on the specific cookie settings.
     * @link https://wordpress.org/plugins/pixelyoursite/
     * @link https://wordpress.org/plugins/gdpr-cookie-compliance/
     */
    add_action( 'after_setup_theme', 'pixel_cookie_consent' );
    function pixel_cookie_consent() {
    	
    	$cookie = ( isset( $_COOKIE['moove_gdpr_popup'] ) ) ? $_COOKIE['moove_gdpr_popup'] : false;
    
    	$cookie = stripslashes( $cookie );
    	$cookie = json_decode( $cookie, true );
    	
    	// disabled by default	
    	add_filter( 'pys_disable_by_gdpr', '__return_true' );
    	
    	// enabled based on user setting
    	if ( $cookie['thirdparty'] == 1 ) {
    		add_filter( 'pys_disable_by_gdpr', '__return_false' );
    	}
    	
    }
    
    • This topic was modified 7 years, 11 months ago by nickfr.
Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author SweetCode

    (@alekv)

    That should be possible.

    I’ll look into it.

    Thread Starter nickfr

    (@nickfr)

    Thanks!

    Plugin Author SweetCode

    (@alekv)

    That’s done now.

    I’ve also integrated it with two more Cookie Consent Management plugins which are more popular in case you ever switch to one of those:

    https://wordpress.org/plugins/cookie-notice/
    https://wordpress.org/plugins/cookie-law-info/

    Thread Starter nickfr

    (@nickfr)

    Thanks! So it works out of the box with the cookie plugin or I have to add the filter?
    Please consider adding the functionality through Ajax also because if cache is enabled then accept or remove pixel does not work most times very well!
    Thanks again!

    Plugin Author SweetCode

    (@alekv)

    Yes, it works out of the box.

    Our plugin reads the browser cookie set by the GDPR Compliance Cookie plugin. If that plugin doesn’t set the cookie as it should, we can’t to much about it.

    Thread Starter nickfr

    (@nickfr)

    Thank you again! But keep in mind that many users will use the function
    add_filter( 'wgdr_third_party_cookie_prevention', '__return_true' );
    if they want for example to enable filter when users accepts thrird part cookies in the cookie plugin.
    This function works great but it does not work with cache plugins.
    i will try to make possible to Enable AJAX filter values update
    Thank you again!

    Plugin Author SweetCode

    (@alekv)

    This function works great but it does not work with cache plugins.

    This means you are caching HTML in a WooCommerce shop, which you shouldn’t anyway.

    Thread Starter nickfr

    (@nickfr)

    Thank you again!

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘integrate this plugin with gdpr plugin filter’ is closed to new replies.