Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #874394

    Jeremy P
    Participant

    I have the facebook ad pixel installed in the functions.php file of my child theme. It looks like this:

    // Add Facebook custom audience pixel Code
    // =============================================================================
    function add_facebook_audience_pixel_code(){
    ?>

    <!– 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’, ‘482251681967209’);
    fbq(‘track’, “PageView”);</script>
    <noscript><img height=”1″ width=”1″ style=”display:none”
    src=”https://www.facebook.com/tr?id=482251681967209&ev=PageView&noscript=1″
    /></noscript>
    <!– End Facebook Pixel Code –>

    add_action( ‘wp_head’, ‘add_facebook_audience_pixel_code’ );
    // End Facebook custom audience pixel Code
    // =============================================================================

    Problem is, it’s not working. Facebook says there’s no pixel found on my site. I’ve cleared caches but it still doesn’t show up. Help?

    #874886

    Christopher
    Moderator

    Hi there,

    Please activate child theme and add following code in child theme’s functions.php file :

    // Add Facebook custom audience pixel Code
    // =============================================================================
    function add_facebook_audience_pixel_code(){
    ?>
    
    <!-- Insert Facebook custom audience pixel Code starts here -->
    
    <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', '482251681967209');
    fbq('track', "PageView");</script>
    <noscript><img height="1" width="1" style="display:none"
    src="https://www.facebook.com/tr?id=482251681967209&ev=PageView&noscript=1"
    /></noscript>
    
    <!-- Insert Facebook custom audience pixel Code Code ends here -->
    
    <?php 
    }
    add_action( 'wp_head', 'add_facebook_audience_pixel_code' );
    // End Facebook custom audience pixel Code
    // =============================================================================

    Hope it helps.