RELATED TO: RealHomes Theme

Facebook Pixel is an official analytics tool from Facebook. It helps you measure, target, and enhance your Facebook ad campaigns. You can integrate Facebook Pixel in two simple steps without installing any third-party plugin.

Step 1: Getting Facebook Pixel ID:

First, go to your Facebook Event Manager to find your Facebook Pixel ID.

Step 2: Add Tracking Code to the website:

It’s recommended to use the child theme for changes to functions.php. If you don’t, your edits will simply be wiped out the next time your theme updates. A pre-built ready-to-use child theme is included in the main theme pack you downloaded from ThemeForest. It is commonly called rh-main-package.zip.

Copy and paste the following code into functions.php and replace the {your-pixel-id-goes-here} with pixel id.

add_action('wp_head', function () {
?>
<!-- Facebook Pixel Code -->
<script>
!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');
fbq('init', '{your-pixel-id-goes-here}');
fbq('track', 'PageView');
</script>
<noscript>
<imgheight="1"width="1"style="display:none"
src="https://www.facebook.com/tr?id={your-pixel-id-goes-here}&ev=PageView&noscript=1"/>
</noscript>
<!-- End Facebook Pixel Code -->
<?php
}
,0);

Please sign up at our support center and create a support ticket for any further assistance, and our support team will be happy to assist you.