Facebook Tracking Pixel

Facebook will provide you with a sample code to paste to the website header of your choice. Within Chargify, you will insert the code from Facebook on all receipt pages by adding the code under one or all of the following locations:

You will need to augment the existing code that is provided to you by Facebook to match the formatting in the snippet examples below. Use one of the two following code snippets in your Site. This will depend entirely on if you use the modern pages or classic pages. Some merchants who are using Classic and Modern Public Signup Pages will use both snippets.

Please be aware that classic pages are referred to as V1. Modern pages are referenced to V2 in Public Signup Page settings.
//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');
}

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.

Tracking Pixel Limitations

  • If your Facebook tracking pixel is tracking confirmed signups, or anything after signup proces has completed, the pixel needs to be placed on the receipt page.

  • If you are adding a tracking pixel to the Chargify-hosted receipt page, you must add the JavaScript to your default Public Signup Page Settings. These can only be reached via Settings –> Public Signup Page Default Settings.

  • If you place the JavaScript for the Facebook tracking pixel on an individual Public Signup Pages’s JavaScript customization field, the tracking pixel will not fire. Please view instructions above for proper placement.

  • Installing JavaScript to fire a tracking pixel on a receipt page assumes that you’re using Chargify’s receipt page. If you have a “redirect URL after successful signup” on the intended Public Signup Page the tracking pixel must be hosted on the redirect URL page.

Chrome Facebook Pixel Helper

As a courtesy to our Facebook Pixel users, we recommend using Chrome’s Facebook Pixel Helper to indentify if the JavaScript is functioning properly on the intended pages.

To use this tool:

  • Install the extention in Chrome
  • Visit your Public Signup Page
  • Click the Chrome Facebook Helper icon in the Chrome toolbar
  • View confirmation of pixel, or pixel errors