Facebook will provide you with a sample code to paste to the website header of your choice. Within Advanced Billing, you will insert the code from Facebook on all receipt pages by adding the code under one or all of the following locations:
- Config Tab –> Public Page Default Settings –> JavaScript (modern or classic).
- Individual Public Signup Pages –> JavaScript (modern or classic)
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.
//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 Advanced Billing-hosted receipt page, you must add the JavaScript to your default Public Signup Page Settings. These can only be reached via Config –> Settings Public Signup Page Default Settings.
- Installing JavaScript to fire a tracking pixel on a receipt page assumes that you’re using Advanced Billing’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