Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simonporter007/8b8374502430d330f00c28e398f42019 to your computer and use it in GitHub Desktop.
Save simonporter007/8b8374502430d330f00c28e398f42019 to your computer and use it in GitHub Desktop.
Facebook for WooCommerce: Only load tracking scripts if Cookie Notice is active and customer has accepted the cookie
@lioncatde
Copy link

Thank you very much!

How can I configure this script to work with any other cookie notice / cookie consent plugin?

@simonporter007
Copy link
Author

Hey @lioncatde!

The meat of the code is where it calls the check_cn_has_been_accepted function. This needs to be a custom function that runs a check to see if the customer has consented to the cookie. If so, then it should return true, otherwise false, to prevent Facebook pixel from loading.

I'd suggest reaching out to your cookie plugin developer and ask if there's a way for you to tell if a customer has accepted a cookie notice!

Cheers,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment