Meta Pixel
JavaScript snippet installed on your website that tracks user actions and sends conversion data to Meta. Required for conversion optimization, retargeting, and lookalike audiences.
Syntax
meta-ads
<!-- Meta Pixel Code -->
<script>
!function(f,b,e,v,n,t,s) { ... }
fbq('init', 'PIXEL_ID');
fbq('track', 'PageView');
</script>Example
meta-ads
// Standard events to track:
fbq('track', 'ViewContent'); // Product page view
fbq('track', 'AddToCart'); // Cart addition
fbq('track', 'InitiateCheckout'); // Checkout start
fbq('track', 'Purchase', { // Purchase
value: orderTotal,
currency: 'USD'
});
fbq('track', 'Lead'); // Lead gen formMeta Ads, Facebook, Instagram are trademarks of Meta Platforms, Inc.. DevForge Academy is not affiliated with, endorsed by, or sponsored by Meta Platforms, Inc.. Referenced for educational purposes only. See full disclaimers