Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1130674
    Jodi D
    Participant

    Hi there

    Despite scouring numerous knowledgebase questions already asked, I can’t figure out why my Facebook Pixel isn’t working.

    Here is the contents of my child theme’s functions.php file:

    <?php
    
    // =============================================================================
    // FUNCTIONS.PHP
    // -----------------------------------------------------------------------------
    // Overwrite or add your own custom functions to X in this file.
    // =============================================================================
    
    // =============================================================================
    // TABLE OF CONTENTS
    // -----------------------------------------------------------------------------
    //   01. Enqueue Parent Stylesheet
    //   02. Additional Functions
    // =============================================================================
    
    // Enqueue Parent Stylesheet
    // =============================================================================
    
    add_filter( 'x_enqueue_parent_stylesheet', '__return_true' );
    
    // Additional Functions
    // =============================================================================
    
    // Add Facebook custom audience pixel Code
    // =============================================================================
    function add_facebook_audience_pixel_code(){
    ?>
    
    <!-- Insert Facebook custom audience pixel Code starts here -->
    
    <!-- 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', '1189970867726547');
    fbq('track', "PageView");</script>
    <noscript><img height="1" width="1" style="display:none"
    src="https://www.facebook.com/tr?id=1189970867726547&ev=PageView&noscript=1"
    /></noscript>
    <!-- End Facebook Pixel Code -->
    
    <!-- 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
    // =============================================================================
    
    // Add Google Analytics Tracking code
    // =============================================================================
    add_action( 'wp_head', 'x_google_code' );
    function x_google_code(){
    	?>
    	<!-- Your Google Analytics Code Go Here -->
    <script>
      (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
      })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
    
      ga('create', 'UA-51872828-1', 'auto');
      ga('send', 'pageview');
    
    </script>
    	<?php
    }
    

    Can you please tell me what I’ve done wrong?

    Thank you

    Jodi

    #1130703
    Christian
    Moderator

    Hey Jodi,

    Would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:

    – Link to your site
    – WordPress Admin username / password
    – FTP credentials

    Don’t forget to select Set as private reply. This ensures your information is only visible to our staff.

    Thanks.

    #1132897
    Jodi D
    Participant
    This reply has been marked as private.
    #1133137
    Christopher
    Moderator

    Hi there,

    Please activate child theme.

    Thanks.

    #1133215
    Jodi D
    Participant
    This reply has been marked as private.
    #1133443
    Lely
    Moderator

    You’re welcome Jodi!

    Yes, any customization you made on the child theme will not work if i is not activated.

    Cheers!

  • <script> jQuery(function($){ $("#no-reply-1130674 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>