Title: Javascript and pys_disable_by_gdpr
Last modified: June 5, 2018

---

# Javascript and pys_disable_by_gdpr

 *  Resolved [David 279](https://wordpress.org/support/users/david-279/)
 * (@david-279)
 * [8 years ago](https://wordpress.org/support/topic/javascript-and-pys_disable_by_gdpr/)
 * Is it possible to use javascript to run the pys_disable_by_gdpr option ?
 * I have the CIVIC Cookie Control 8 plugin, this is a really neat GDPR plugin BUT
   I’m having real issues with the wretched Facebook pixel, following their instructions
   last night I deactivated the pixel your site plugin and placed the following 
   code in their plugin
 * in the On accept callback function:
    // Add Facebook Pixel if it does not exist
   if (typeof fbq !== “function”) { !function(f,b,e,v,n,t,s) {if(f.fbq)return;n=
   f.fbq=function(){n.callMethod? n.callMethod.apply(n,arguments):n.queue.push(arguments)};
   if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version=’2.0′; n.queue=[];t=b.createElement(
   e);t.async=!0; t.src=v;s=b.getElementsByTagName(e)[0]; s.parentNode.insertBefore(
   t,s)}(window,document,’script’, ‘[https://connect.facebook.net/en_US/fbevents.js&#8217](https://connect.facebook.net/en_US/fbevents.js&#8217););}//
   Revoke consent initially fbq(‘consent’, ‘revoke’); fbq(‘init’, ‘XXXXX’); fbq(‘
   track’, ‘PageView’); // Grant consent since we are inside onAccept fbq(‘consent’,‘
   grant’); // End Facebook Pixel
 * Where XXXXX is my pixel ID
 * and in the On revoke callback function
 *  fbq(‘consent’, ‘revoke’);
 * The result was no Facebook pixel no matter if it were switched on or off, I then
   tried reactivating the pixel your site plugin and now the result is that the 
   pixel is permanently ON no matter the settings
 * I asked them about the pixel your site dedicated filter and got the reply “You
   cannot put PHP code inside onAccept/onRevoke callbacks, just javascript”
 * So is there a way of activating/deactivating the plugin/pixel just using Javascript
   that I can try out ?
 * In desperation ……
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fjavascript-and-pys_disable_by_gdpr%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

The topic ‘Javascript and pys_disable_by_gdpr’ is closed to new replies.

 * ![](https://ps.w.org/pixelyoursite/assets/icon-256x256.jpg?rev=3178123)
 * [PixelYourSite - Your smart PIXEL (TAG) & API Manager](https://wordpress.org/plugins/pixelyoursite/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/pixelyoursite/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/pixelyoursite/)
 * [Active Topics](https://wordpress.org/support/plugin/pixelyoursite/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/pixelyoursite/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/pixelyoursite/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [David 279](https://wordpress.org/support/users/david-279/)
 * Last activity: [8 years ago](https://wordpress.org/support/topic/javascript-and-pys_disable_by_gdpr/)
 * Status: resolved