Meta Pixel Guide | Blue Frog Docs

Meta Pixel Guide

Complete guide to Meta Pixel (formerly Facebook Pixel) - tracking, events, and conversion optimization for Meta advertising.

Meta Pixel Guide

The Meta Pixel (formerly Facebook Pixel) is a piece of JavaScript code that tracks visitor actions on your website. It enables you to measure ad effectiveness, build audiences, and optimize campaigns.

What Meta Pixel Does

  • Tracks Conversions: Measure actions like purchases, sign-ups, and form submissions
  • Builds Audiences: Create Custom Audiences from website visitors
  • Optimizes Delivery: Help Meta find people likely to take action
  • Retargets Visitors: Show ads to people who visited your site

Getting Started

1. Create Your Pixel

  1. Go to Meta Events Manager
  2. Click "Connect Data Sources" → "Web"
  3. Select "Meta Pixel" and click "Connect"
  4. Name your pixel and enter your website URL
  5. Copy your Pixel ID (16-digit number)

2. Install the Base Code

Add this code to the <head> section of every page:

<!-- Meta 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', 'YOUR_PIXEL_ID');
fbq('track', 'PageView');
</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=YOUR_PIXEL_ID&ev=PageView&noscript=1"
/></noscript>
<!-- End Meta Pixel Code -->

Standard Events

Meta supports these predefined events:

Event Description Typical Use
PageView Page load Automatically tracked
ViewContent Product page view E-commerce
AddToCart Add to cart E-commerce
InitiateCheckout Start checkout E-commerce
Purchase Complete purchase E-commerce
Lead Form submission Lead gen
CompleteRegistration Sign up SaaS, membership
Contact Contact form Service businesses
Search Site search All sites

Example: Purchase Event

fbq('track', 'Purchase', {
  value: 99.99,
  currency: 'USD',
  content_ids: ['SKU123'],
  content_type: 'product',
  num_items: 1
});

Example: Lead Event

fbq('track', 'Lead', {
  content_name: 'Newsletter Signup',
  content_category: 'Marketing'
});

Custom Events

For actions not covered by standard events:

fbq('trackCustom', 'DownloadPDF', {
  document_name: 'Product Guide',
  file_type: 'pdf'
});

Platform-Specific Setup

Installation varies by platform. Select yours for detailed instructions:

E-commerce Platforms

Conversions API (CAPI)

The Conversions API sends events server-side, improving:

  • Data accuracy in iOS 14+ environments
  • Reliability when ad blockers are used
  • Attribution through better event matching

Learn about Conversions API setup

Debugging

Pixel Helper Extension

Install the Meta Pixel Helper Chrome extension to:

  • Verify pixel installation
  • Check events are firing
  • Debug parameter values

Events Manager

In Meta Events Manager:

  1. Go to "Test Events"
  2. Enter your website URL
  3. Perform actions on your site
  4. View real-time event data

Common Issues

Pixel Not Firing

  • Check for JavaScript errors in console
  • Verify pixel ID is correct
  • Ensure code is in <head> section
  • Test with Pixel Helper extension

Duplicate Events

  • Check for multiple pixel installations
  • Verify GTM isn't firing the same event
  • Look for duplicate code in themes/plugins

Event Parameters Missing

  • Ensure values are passed correctly
  • Check variable types (strings vs numbers)
  • Verify data layer is populated before event fires

Privacy & Compliance

Implement consent management before firing the pixel:

// Only init pixel after consent
if (hasConsent) {
  fbq('init', 'YOUR_PIXEL_ID');
  fbq('track', 'PageView');
}

GDPR Considerations

  • Obtain consent before tracking
  • Provide opt-out mechanism
  • Document data processing in privacy policy
  • Consider Limited Data Use mode
// SYS.FOOTER