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’);
}
// Revoke consent initially
fbq(‘consent’, ‘revoke’);
fbq(‘init’, ‘XXXXX’);
fbq(‘track’, ‘PageView’);
// Grant consent since we are inside onAccept
fbq(‘consent’, ‘grant’);
// End Facebook PixelWhere 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 to see the link]
- The topic ‘Javascript and pys_disable_by_gdpr’ is closed to new replies.