Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Only want to pull Facebook pixel if on thank you page

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #186122
    amidigital
    Participant

    I am trying to use basic PHP like this to pull facebook audience tracking.

    This doesn’t work, is there a better way?

    Thanks!

    <?php if ( is_page('thank-you')) 
    echo('
    
    <!-- Facebook Conversion Code for Thank you page Fall -->
    <script>(function() {
      var _fbq = window._fbq || (window._fbq = []);
      if (!_fbq.loaded) {
        var fbds = document.createElement('script');
        fbds.async = true;
        fbds.src = '//connect.facebook.net/en_US/fbds.js';
        var s = document.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(fbds, s);
        _fbq.loaded = true;
      }
    })();
    window._fbq = window._fbq || [];
    window._fbq.push(['track', 'xxx', {'value':'0.00','currency':'USD'}]);
    </script>
    <noscript><img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/tr?ev=xxx&cd[value]=0.00&cd[currency]=USD&noscript=1" /></noscript>
    ');    
    ?>
Viewing 1 post (of 1 total)
  • The forum ‘Back End’ is closed to new topics and replies.