Facebook Tracking Pixel

To install the Facebook Tracking Pixel on your Chargify Receipt pages, you can use one of the two following code snippets depending on if you use the modern pages or classic pages:

//modern pages RECEIPT PAGE ONLY
if ($('.public-signup-page__success').length === 1) {
  !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');

  //Replace 123456789 with your real number
  fbq('init', '123456789');
  fbq('track', 'PageView');
  fbq('track', 'InitiateCheckout');
}

//classic pages RECEIPT PAGE ONLY
if ($('#hosted-payment-history').length !== 0) {
  !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');

  //Replace 123456789 with your real number
  fbq('init', '123456789');
  fbq('track', 'PageView');
  fbq('track', 'InitiateCheckout');
}

You can insert your code on all receipt pages by adding the code under the Settings Tab –> Public Page Default Settings –> Javascript (modern or classic).

Please note that the <noscript> section of the Pixel is not included in this code. The <noscript> section only affects the minimal amount of users who do not have Javascript enabled on their browser. If a given user does not have Javascript enabled in their browser, they will not be tracked by the Pixel.