Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1353478
    Ian
    Participant

    My Facebook pixel is happily residing in my X-child theme’s functions.php.

    Here’s what she looks like:

    // 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', '731910656982251'); // Insert your pixel ID here.
    fbq('track', 'PageView');
    </script>
    <noscript><img height="1" width="1" style="display:none"
    src="https://www.facebook.com/tr?id=731910656982251&ev=PageView&noscript=1"
    /></noscript>
    <!-- DO NOT MODIFY -->
    <!-- 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
    // =============================================================================

    My question now being – how do I go about “pixelling” individual events?

    Facebook suggest adding code on a per-page basis, for example a registration page would need the additional code:

    <script>
    fbq('track', 'CompleteRegistration', {
    value: 25.00,
    currency: 'USD'
    });
    </script>

    Okie-dokie. But where on the individual page do I add the code? Would this be the RAW shortcode? Or Javascript?

    Please help.

    #1353544
    Thai
    Moderator

    Hi There,

    You can add that code the raw content element.

    Let us know how it goes!

    #1354171
    Ian
    Participant

    For some strange reason, Cornerstone is not happy saving any changes made when I add the code via the raw content element.

    #1354581
    Nico
    Moderator

    Hi There,

    You could try adding the code in your custom JS of your cornerstone page.

    IF still not working, Would you mind sharing us your admin credentials so we could check your setup. Please share us also the URL where you added the code.

    Don’t forget to set it as private reply.

    Thanks.

    #1355044
    Ian
    Participant

    Hi there,

    Adding the code into the Custom JS of the Cornerstone page did the trick.

    Thank you!

    #1355153
    Christian
    Moderator

    Glad you’ve sorted it out.

    #1373026
    EpiphanyHealth
    Participant

    Do you include the full pixel with the event to the Custom JS of the cornerstone page, or just the event?

    #1373076
    EpiphanyHealth
    Participant

    I’m having the same issue. Can you help me? I added the code to the Customer JS but it the pixel isn’t firing.

    #1373196
    Rad
    Moderator

    Hi there,

    The first set of code goes to child theme’s functions.php since it requires proper embedding of its library. While the second code (the event code) is added is custom js (either customizer’s custom js or cornerstone’s custom js).

    It shouldn’t have <script></script> block, like this

    fbq('track', 'CompleteRegistration', {
    value: 25.00,
    currency: 'USD'
    });

    Hope this helps.

    #1373796
    EpiphanyHealth
    Participant

    I tried putting it there, and the pixel wouldn’t fire. Am I perhaps putting it in the wrong place still? I’m pretty sure I was in the Customizer JS

    #1374203
    Friech
    Moderator

    Hi There,

    Can you confirm you added the Pixel base code on the child theme’s functions.php file?

    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.

    #1375182
    EpiphanyHealth
    Participant
    This reply has been marked as private.
    #1375617
    Friech
    Moderator

    Hi There,

    Please remove the event code from the base pixel code, because having that on your pixel base means it will track all your pages. I’m referring to this line:

    fbq('track','Lead');

    Lets separate that, add this on your child theme’s functions.php file. This way it will only track the page http://www.epiphanyhealthcounseling.com/almost-done/

    Make sure you added this below the base code, because base code need to be called first.

    function fb_print_pixel_event(){
     if (is_page(717) ) : ?>
    
        <script id="fb-pixel-event">
        fbq('track', 'Lead', {
        value: 10.00,
        currency: 'USD'
        });
        </script>
    
     <?php endif; }
    
     add_action( 'wp_head', 'fb_print_pixel_event' );

    Hope it helps, Cheers!

    #1376301
    EpiphanyHealth
    Participant

    It broke my site. I installed underneath the base pixel

    #1376302
    EpiphanyHealth
    Participant

    It broke my site. I installed underneath the base pixel though I my have done something else wrong.

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