The Ultimate Guide on FB Pixels for Developers can be found here
<aside> 💡
DISCLAIMER: Anything noted on the official documentation from Meta supersedes any recommendation given here - this is meant to be a general guideline and should be manicured to fit the needs of each funnel specifically.
</aside>
<aside> 💡
PLEASE ADD THIS CODE TO EVERY PAGE ON YOUR DOMAIN - INCLUDING PAGES THAT ARE NOT IN THE DIRECT FUNNEL OF TRAFFIC. This will help tag users from other sources and will increase the potency of your pixel data
</aside>
Paste the pixel code at the bottom of the header section, just above the </head> tag. Facebook pixel code can be added above or below existing tracking tags (such as Google Analytics) in your site header.
<aside> 💡
Replace ‘REPLACETHISWITHYOUURPIXELID’ as seen in the code snippet below with your actual pixel ID. You Pixel ID can be found in the Event Manager within Facebook. If you need help, please reach out to your PM @ TNT and we’ll send it to you happily.
</aside>
<!-- 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', 'REPLACETHISWITHYOURPIXELID');
fbq('track', 'PageView');
</script>
<noscript>
<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=REPLACETHISWITHYOURPIXELID&ev=PageView&noscript=1"/>
</noscript>
<!-- End Facebook Pixel Code -->
<aside> 💡
IMPORTANT: In addition to the event snippets below, the above base pixel must also be fired (fbq init) on the same page. The code snippets below will not have any effect if they are not implemented AFTER the above base pixel code has run and fbq has been called.
</aside>
Add To Cart Event Snippet
<script>
fbq('track', 'AddToCart');
</script>
Initiate Checkout Event Snippet
<script>
fbq('track', 'InitiateCheckout');
</script>
Purchase Event Snippet
To be placed on the first upsell page (preferable) the following:
<script>
fbq('track', 'Purchase', {
value: {value},
currency: 'USD'
});
</script>
Where {value} is dynamically populated numeric value
Upsells
On each following upsell, if, and only if, someone takes the upsell, either on the button click or on the next upsell page (but then {value} would have to be conditional), the following (again):