MA
(@gasparnemes)
Hi there,
Thanks for your comments.
Our plugin works with javascript, load the scripts with javascript to prevent the caching issues. This means, I can’t provide you a solution for this FB pixel plugin. My suggestion is to disable the Facebook pixel plugin and add the FB pixel tracking script to the GDPR plugin settings.
Thanks
@gaspar Nemes
Some Facebook Pixel Plugins offer more options so its not always possible to just use the Generic Facebook Pixel Code.
And in some cases its not possible to use Javascript for interacting with the Cookie Consent.
@nickfr
Here is a solution I made for my website:
/**
* Disable Facebook Pixel based on Cookie Consent
*
* This snippet disables the Facebook Pixel Tracking Code based on the specific cookie settings.
* @link https://ww.wp.xz.cn/plugins/pixelyoursite/
* @link https://ww.wp.xz.cn/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' );
}
}
Thread Starter
nickfr
(@nickfr)
thanks @wpsight worked great!
do you have any solution for
enhanced-e-commerce-for-woocommerce-store
https://el.ww.wp.xz.cn/plugins/enhanced-e-commerce-for-woocommerce-store/
@wpsight
Do you have solution for Facebook Official plugin for WooCommerce and FB Pixel https://github.com/facebookincubator/facebook-for-woocommerce?
This plugin help us in lot of stuff regarding Facebook, so its not good to remove it and add manually in GDPR plugin.
Is there a way to make it automatically disable when users disable in GDPR modal ?
@kinderjaje
Best would be to check back with the authors of that plugin to see how it would be possible to programmatically disable/enable the facebook pixel. In the plugin I use it works with the filter method like so:
add_filter( 'pys_disable_by_gdpr', '__return_true' );
From that you can then probably just modify the snippet above and customize it for your needs.
@wpsight thanks for response man.
I gonna write to them and make an issue on Github.