-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't disable Pixel when website is cached. GDPR + CDN #2576
Comments
Is there any hook to paste: |
You can use you the Here's an axample implementation you can use in your child's theme function.php: function prepend_fb_consent_to_pixel_init( $original_script ) {
// Your consent code to prepend
$consent_code = "fbq('consent', 'revoke');\n";
// Prepending the consent code to the original pixel init code
$modified_script = $consent_code . $original_script;
return $modified_script;
}
// Adding your custom filter to modify the facebook_woocommerce_pixel_init output
add_filter( 'facebook_woocommerce_pixel_init', 'prepend_fb_consent_to_pixel_init', 10, 1 );
|
@rawdreeg Facebook tell us to do this way but this action does make it track te user since the scripts are already loaded on page before this action. The right way should be simply not include the scripts on the page, to not make any request to the Facebook servers. |
Thanks for your reply @edirpedro Yes, the https://connect.facebook.net/en_US/fbevents.js script is loaded before . I'll keep this issue open for client site solution for preventing fbevents.js from getting included into the page. But the goal is to revoke the consent then |
I'm getting problems when combining Pixel with cached pages, using Varnish or a CDN. this is my scenario:
What I think that could be a solution, just an ideia, not tested.
Instead of add the scripts direct on the page, we need a JS Hook to check if this can be done or not and only after that we add the script source and all the rest to start up the Pixel or any other third party application. Like this using WP JS Hooks:
Without checking the user consent on the server side, there is no problem creating caches on the server or using a CDN, the Pixel will be on the HTML but only injected on the page after checking it on the client side, according to user consent.
Additional information
https://developers.facebook.com/docs/meta-pixel/implementation/gdpr
There is an option at documentation, using
fbq('consent', 'revoke');
. But it has to be setted before thefbq('init', '<your pixel ID>');
and this can't be done with the plugin since the script don't have this option.But wait, this solution still allows Facebook to track the user since it revokes after the scripts are loaded! This is not a GDPR solution.
Originally posted by @edirpedro in #301 (comment)
The text was updated successfully, but these errors were encountered: