How connect Facebook pixel with Cookie consent rule in Yootheme Pro

According to the Facebook documents, we must first download the script with the revoke option, then set the cookie if the user has given his consent.

So we need added the main code in Theme > Settings > Custom code > Script where need set the revoke option (blue line)

fbq('consent', 'revoke');


Then we need added grant option in Cookie banner settings Theme > Settings > Cookie Banner

fbq('consent', 'grant');


Thus, we were able to activate the pixel installation only after obtaining the consent of the user.

Let's check:

About noscript block in Facebook sample code

The <noscript> tag is needed only if JavaScript is disabled in the user's browser.

This option was relevant at the dawn of the Internet, but now its use is meaningless, because many of the features of the theme, such as the installation of tracking scripts, menus, modal window - all work only with JS enabled.

I recommend removing this block from all scripts.

However, if you want to keep it, then you need to take it out for js code to avoid errors in Yootheme Pro.
paste js code here
<img src="/path_here..."/>

If the existing script content is not wrapped in <script> and </script> tags but immediately starts with a line of code you need add the <script> and </script> tags.

If the existing script content is wrapped in <script> and </script> tags insert the additional script also wrapped in <script> and </script> tags.

You can order script connect for your site for 5€ or full optimization the Facebook events analitics.

Subscribe to Our Newsletters

Yootheme Tricks

Newsletter Yootheme tricks

Yootheme news
For developers

Newsletter for developers