Meta Ads Troubleshooting & Debugging | Blue Frog Docs

Meta Ads Troubleshooting & Debugging

Troubleshooting playbook for Meta Pixel and Conversions API.

Meta Ads Troubleshooting & Debugging

Comprehensive diagnostic guide for resolving Meta Pixel, Conversions API, and campaign tracking issues.

Symptom Library

Pixel Issues

  • Pixel not firing - No events appearing in Events Manager
  • Duplicate pixels detected - Multiple pixel instances on same page
  • Events missing - Some standard events not tracking
  • Delayed event reporting - Events appearing hours after occurrence
  • Wrong pixel firing - Incorrect pixel ID detected

Event Quality Issues

  • Event Match Quality (EMQ) below 6.0 - Poor attribution quality
  • Missing parameters - Events lacking required data
  • Partial event matching - Low match rates in Advanced Matching
  • Incorrect event values - Currency or value mismatches
  • Custom event not tracking - Custom events failing to fire

Conversions API Issues

  • 400 Bad Request errors - Malformed API requests
  • 401 Unauthorized - Authentication failures
  • 429 Rate limiting - Too many requests
  • Event deduplication failures - Double-counting events
  • Test events not appearing - Server events not visible in diagnostics

iOS 14+ Attribution Issues

  • 7-day attribution window - Limited tracking window
  • Aggregated events only - Individual event data unavailable
  • Domain verification required - Events not tracking without verification
  • 8-event limit - Cannot track more than 8 unique events
  • Delayed conversion reporting - 3-day delay in aggregated data

Campaign Performance Issues

  • Zero conversions reported - Ads running but no conversions
  • Conversion value discrepancies - Mismatch between pixel and actual revenue
  • Attribution window confusion - Different windows showing different data
  • Cross-device attribution gaps - Mobile-to-desktop conversions missing
  • Ad disapprovals - Policy violations blocking ads

Investigation Workflow

Level 1: Quick Diagnostics (5 minutes)

Step 1: Check Pixel Status

1. Open Meta Events Manager
2. Navigate to Data Sources > Pixels
3. Look for green "Active" status indicator
4. Check "Events Received" in last hour
5. Verify most recent event timestamp

Expected: Green active status, events within last 15 minutes

Step 2: Browser Extension Check

1. Install Meta Pixel Helper (Chrome)
2. Visit your website
3. Click extension icon
4. Verify:
   - Green checkmark (pixel active)
   - Correct pixel ID
   - PageView event firing
   - No error messages

Step 3: Real-Time Event Verification

1. Events Manager > Test Events
2. Copy your browser's test event code
3. Perform action on site
4. Verify event appears within seconds

Level 2: Deep Diagnostics (15-30 minutes)

Event Parameter Analysis

  1. Check Event Details in Test Events
// Expected event structure
{
  "event_name": "Purchase",
  "event_time": 1234567890,
  "event_source_url": "https://example.com/checkout",
  "user_data": {
    "em": "hashed_email",
    "ph": "hashed_phone",
    "client_ip_address": "192.168.1.1",
    "client_user_agent": "Mozilla/5.0...",
    "fbc": "_fbc_cookie_value",
    "fbp": "_fbp_cookie_value"
  },
  "custom_data": {
    "value": 99.99,
    "currency": "USD",
    "content_ids": ["product-123"]
  }
}
  1. Validate Browser Console
// Run in browser console
console.log('Pixel loaded:', typeof fbq !== 'undefined');
console.log('Pixel version:', window._fbq?.version);
console.log('Pixel queue:', window._fbq?.queue);

// Check for errors
window.addEventListener('error', (e) => {
  if (e.filename && e.filename.includes('fbevents')) {
    console.error('Pixel error:', e);
  }
});
  1. Network Request Inspection
1. Open Chrome DevTools > Network tab
2. Filter: "facebook.com/tr"
3. Reload page
4. Check for successful requests (Status 200)
5. Examine request payload

Event Match Quality Analysis

Navigate to: Events Manager > Data Sources > Your Pixel > Event Match Quality

Score Quality Action Required
8.0-10.0 Excellent Maintain current implementation
6.0-7.9 Good Implement Advanced Matching
4.0-5.9 Fair Add CAPI, improve data quality
0-3.9 Poor Critical: Review entire implementation

Improvement Checklist:

  • Enable Automatic Advanced Matching
  • Implement manual Advanced Matching (hashed email, phone)
  • Add Conversions API (server-side events)
  • Include fbp and fbc cookie parameters
  • Send client_ip_address and client_user_agent

Level 3: Advanced Diagnostics (30-60 minutes)

Conversions API Validation

  1. Test API Connection
curl -X POST \
  'https://graph.facebook.com/v18.0/PIXEL_ID/events?access_token=ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "data": [{
      "event_name": "Purchase",
      "event_time": '$(date +%s)',
      "action_source": "website",
      "event_source_url": "https://example.com",
      "user_data": {
        "em": "309a0a5c3e211326ae75ca18196d301a9bdbd1a882a4d2569511033da23f0abd",
        "ph": "254aa248acb47dd654ca3ea53f48c2c26d641d23d7e2e93a1ec56258df7674c4"
      },
      "custom_data": {
        "value": 99.99,
        "currency": "USD"
      }
    }],
    "test_event_code": "TEST12345"
  }'
  1. Review API Response
// Success response
{
  "events_received": 1,
  "messages": [],
  "fbtrace_id": "A1B2C3D4E5F6"
}

// Error response
{
  "error": {
    "message": "Invalid OAuth access token",
    "type": "OAuthException",
    "code": 190,
    "fbtrace_id": "A1B2C3D4E5F6"
  }
}

Attribution Debugging

Check for attribution discrepancies:

// Compare pixel data with server data
const pixelConversions = getPixelConversions();
const serverConversions = getActualConversions();

const discrepancy = Math.abs(pixelConversions - serverConversions) / serverConversions;

if (discrepancy > 0.1) {
  console.warn('Attribution discrepancy detected:', {
    pixelConversions,
    serverConversions,
    difference: Math.abs(pixelConversions - serverConversions),
    percentageOff: (discrepancy * 100).toFixed(2) + '%'
  });
}

Common Issues & Solutions

Issue 1: Pixel Not Firing

Symptoms:

  • Meta Pixel Helper shows no pixel
  • No events in Events Manager
  • Browser console shows no fbq function

Diagnostic Steps:

  1. Verify Installation
// Check if pixel code is present
document.querySelector('script[src*="fbevents.js"]')
// Should return: <script> element

// Check if fbq is defined
typeof fbq
// Should return: "function"
  1. Common Causes & Fixes:

Cause: Ad Blockers

Solution:
1. Test in incognito mode
2. Disable ad blockers
3. Implement Conversions API (unblockable)

Cause: Script Loading Error

// Check for loading errors
window.addEventListener('error', (e) => {
  if (e.filename?.includes('fbevents')) {
    console.error('Pixel failed to load:', e.message);
  }
}, true);

Solution:
1. Verify script source URL is correct
2. Check for Content Security Policy blocking
3. Ensure script loads in <head> section

Cause: Incorrect Placement

<!-- WRONG: Missing wp_head() call -->
<head>
  <title>My Site</title>
</head>

<!-- CORRECT: wp_head() present -->
<head>
  <title>My Site</title>
  <?php wp_head(); ?>
</head>

Cause: Conflicting Scripts

// Check for multiple pixel instances
console.log('Pixel instances:', window._fbq_instances);

Solution:
1. Remove duplicate pixel code
2. Use single pixel instance
3. Consider GTM for centralized management

Issue 2: Low Event Match Quality

Target EMQ Score: 6.0+ (8.0+ ideal)

Improvement Strategies:

1. Implement Advanced Matching

// Basic pixel (EMQ: ~3.0)
fbq('init', 'PIXEL_ID');
fbq('track', 'PageView');

// With Advanced Matching (EMQ: ~7.0)
fbq('init', 'PIXEL_ID', {
  em: '7d6fd7774f0d87624da6dcf16d0d3d104c3191c5b77614e0fd9a9e0b5c4aa' + '1c0',
  ph: '5f86b2ad5cc6d64a96a69c45f326fde52b8bac37ea6e24c48f831f7e72a8' + '4c57',
  fn: '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f0' + '0a08',
  ln: '3f47a7f0e9e7f5f1c5e3f1f0f1f0f1f0f1f0f1f0f1f0f1f0f1f0f1f0f1f0'
});

2. Add Conversions API

// Server-side event (higher match quality)
$event = (new Event())
  ->setEventName('Purchase')
  ->setEventTime(time())
  ->setUserData((new UserData())
    ->setEmails([hash('sha256', $email)])
    ->setPhones([hash('sha256', $phone)])
    ->setClientIpAddress($_SERVER['REMOTE_ADDR'])
    ->setClientUserAgent($_SERVER['HTTP_USER_AGENT'])
    ->setFbc($_COOKIE['_fbc'] ?? null)
    ->setFbp($_COOKIE['_fbp'] ?? null)
  );

3. Include Cookie Parameters

// Get Facebook cookies for better matching
function getFacebookCookies() {
  const fbc = document.cookie.match(/(?:^|;)\s*_fbc=([^;]*)/)?.[1];
  const fbp = document.cookie.match(/(?:^|;)\s*_fbp=([^;]*)/)?.[1];
  return { fbc, fbp };
}

// Send with events
fbq('track', 'Purchase', {
  value: 99.99,
  currency: 'USD'
}, {
  fbc: getFacebookCookies().fbc,
  fbp: getFacebookCookies().fbp
});

Issue 3: Conversions API Errors

Error 400: Bad Request

{
  "error": {
    "message": "Invalid parameter",
    "type": "FacebookApiException",
    "code": 100
  }
}

Common Causes:

  1. Invalid Event Time
// WRONG: Future timestamp
$event_time = time() + 3600;

// CORRECT: Current or past timestamp (within 7 days)
$event_time = time();
  1. Missing Required Fields
// WRONG: Missing action_source
$event = (new Event())
  ->setEventName('Purchase')
  ->setEventTime(time());

// CORRECT: All required fields
$event = (new Event())
  ->setEventName('Purchase')
  ->setEventTime(time())
  ->setActionSource('website') // Required!
  ->setEventSourceUrl('https://example.com');
  1. Invalid Currency Code
// WRONG: Numeric currency
'currency' => 840  // USD numeric code

// CORRECT: ISO 4217 alpha code
'currency' => 'USD'

Error 401: Unauthorized

Solution:
1. Regenerate access token in Events Manager
2. Verify token has correct permissions
3. Check token hasn't expired
4. Ensure pixel ID is correct

Error 429: Rate Limit Exceeded

Limits:
- Browser events: No practical limit
- CAPI: 100,000 events per hour per pixel

Solution:
1. Implement exponential backoff
2. Batch events (up to 1000 per request)
3. Distribute load across time
// Batch events example
$events = [];
foreach ($orders as $order) {
  $events[] = createPurchaseEvent($order);
}

// Send in batches of 1000
$batches = array_chunk($events, 1000);
foreach ($batches as $batch) {
  (new EventRequest(PIXEL_ID))
    ->setEvents($batch)
    ->execute();

  // Rate limiting: wait between batches
  usleep(100000); // 0.1 second
}

Issue 4: iOS 14+ Attribution Problems

Symptoms:

  • Sudden drop in iOS conversions (April 2021+)
  • 7-day attribution window enforced
  • Aggregated events only
  • 3-day reporting delay

Required Solutions:

1. Verify Your Domain

1. Business Settings > Brand Safety > Domains
2. Add your domain
3. Add Meta verification meta tag or DNS record
4. Verify ownership
<!-- Add to <head> -->
<meta name="facebook-domain-verification" content="your-verification-code" />

2. Configure Aggregated Event Measurement

1. Events Manager > Aggregated Event Measurement
2. Select verified domain
3. Configure up to 8 events (in priority order)
4. Assign value to each event

Priority Example:

  1. Purchase (highest value)
  2. InitiateCheckout
  3. AddToCart
  4. Lead
  5. CompleteRegistration
  6. ViewContent
  7. Search
  8. PageView

3. Implement Conversions API

CAPI benefits for iOS 14+:
- Not affected by ATT (App Tracking Transparency)
- No 7-day attribution limit
- Better match rates
- More reliable data

Issue 5: Event Deduplication Failures

Symptom: Same events counted twice (browser + server)

Solution: Use Event IDs

// Browser-side
const eventId = 'order_' + orderId + '_' + Date.now();

fbq('track', 'Purchase', {
  value: 99.99,
  currency: 'USD'
}, {
  eventID: eventId
});
// Server-side (same event ID)
$event = (new Event())
  ->setEventName('Purchase')
  ->setEventId('order_' . $order_id . '_' . time()) // Must match!
  ->setCustomData($customData);

Verification:

1. Events Manager > Test Events
2. Send both browser and server events
3. Verify "Event Deduplication" shows:
   - "Events Received: 2"
   - "Events Processed: 1"

Issue 6: Incorrect Event Values

Symptoms:

  • Revenue in wrong currency
  • Values showing as 0
  • Decimal precision issues

Solutions:

Currency Mismatch

// WRONG: Mixed currencies
fbq('track', 'Purchase', {
  value: 99.99,
  currency: 'EUR'  // But value is in USD!
});

// CORRECT: Consistent currency
const orderCurrency = 'USD';
const orderValue = 99.99;

fbq('track', 'Purchase', {
  value: orderValue,
  currency: orderCurrency
});

Decimal Precision

// WRONG: Too many decimals
value: 99.999999

// CORRECT: 2 decimal places
value: parseFloat(99.999999.toFixed(2))  // 100.00

Missing Value

// WRONG: Value as string
value: '$99.99'

// CORRECT: Numeric value
value: 99.99

Tools & Debugging Resources

Essential Tools

1. Meta Pixel Helper (Chrome Extension)

Download: Chrome Web Store
Use cases:
- Verify pixel firing
- Check event parameters
- Identify errors
- View multiple pixels

2. Events Manager Test Events

Access: Events Manager > Test Events
Features:
- Real-time event monitoring
- Parameter inspection
- CAPI event validation
- Event deduplication testing

3. Meta Pixel Debugger Console

// Enable debug mode
fbq.push(['setDebug', true]);

// Or via URL parameter
https://yoursite.com?fbq_debug=1

// View debug info
fbq.getState().pixels  // Pixel configuration
fbq.getState().events  // Tracked events

4. Chrome DevTools Network Tab

1. Open DevTools (F12)
2. Network tab
3. Filter: "facebook.com/tr"
4. Examine requests:
   - Status: Should be 200
   - Method: GET or POST
   - Query params: Check event data

5. Conversions API Debugger

# Test CAPI endpoint
curl -X POST \
  'https://graph.facebook.com/v18.0/PIXEL_ID/events' \
  -H 'Authorization: Bearer ACCESS_TOKEN' \
  -d @event_payload.json \
  -w "\nHTTP Code: %{http_code}\n"

Debugging Scripts

Comprehensive Pixel Test

function debugMetaPixel() {
  console.log('=== Meta Pixel Debug Report ===');

  // 1. Check if loaded
  console.log('Pixel loaded:', typeof fbq !== 'undefined');

  if (typeof fbq === 'undefined') {
    console.error('❌ Pixel not loaded!');
    return;
  }

  // 2. Check pixel state
  const state = fbq.getState();
  console.log('Pixel ID:', state.pixels);
  console.log('Tracked events:', state.events);

  // 3. Check cookies
  const cookies = document.cookie;
  console.log('_fbp cookie:', cookies.match(/_fbp=([^;]+)/)?.[1] || 'Missing');
  console.log('_fbc cookie:', cookies.match(/_fbc=([^;]+)/)?.[1] || 'Missing');

  // 4. Test event
  fbq('track', 'PageView', {}, {
    eventID: 'debug_' + Date.now()
  });
  console.log('✓ Test event fired');

  // 5. Check for errors
  console.log('Recent errors:', window._fbq_errors || 'None');

  console.log('=== End Debug Report ===');
}

// Run diagnostic
debugMetaPixel();

Event Match Quality Calculator

function calculateEMQScore(eventData) {
  let score = 0;
  const weights = {
    email: 3,
    phone: 2,
    firstName: 1,
    lastName: 1,
    city: 0.5,
    state: 0.5,
    zip: 0.5,
    country: 0.5,
    fbc: 1,
    fbp: 1
  };

  for (const [field, weight] of Object.entries(weights)) {
    if (eventData[field]) {
      score += weight;
    }
  }

  const maxScore = Object.values(weights).reduce((a, b) => a + b, 0);
  const normalizedScore = (score / maxScore) * 10;

  console.log('EMQ Score:', normalizedScore.toFixed(1));
  console.log('Quality:',
    normalizedScore >= 8 ? 'Excellent' :
    normalizedScore >= 6 ? 'Good' :
    normalizedScore >= 4 ? 'Fair' : 'Poor'
  );

  return normalizedScore;
}

Error Code Reference

Code Error Solution
100 Invalid parameter Check API documentation for required fields
190 Invalid OAuth token Regenerate access token
200 Permission denied Verify user has pixel access
368 Temporarily blocked Wait and retry with exponential backoff
613 Rate limit exceeded Reduce request frequency
803 Duplicate event Implement event deduplication
1487 Invalid event time Use current or recent timestamp (within 7 days)
2635 Invalid action source Use valid source: website, email, app, phone_call

Monitoring & Alerts

Set Up Automated Monitoring

1. Event Volume Alerts

// Check for significant drops in event volume
function monitorEventVolume() {
  const today = getEventCount(0); // today
  const yesterday = getEventCount(1); // yesterday
  const lastWeek = getEventCount(7); // last week average

  const drop = (yesterday - today) / yesterday;

  if (drop > 0.3) {  // 30% drop
    sendAlert({
      type: 'Event Volume Drop',
      drop: (drop * 100).toFixed(0) + '%',
      today: today,
      yesterday: yesterday
    });
  }
}

2. EMQ Score Monitoring

Setup:
1. Events Manager > Event Match Quality
2. Review weekly trends
3. Set alerts for drops below 6.0
4. Investigate sudden decreases

3. CAPI Health Checks

// Monitor CAPI response rates
function monitorCAPIHealth() {
  $response = sendCAPIEvent($testEvent);

  if (!isset($response['events_received']) || $response['events_received'] != 1) {
    logError('CAPI Health Check Failed', $response);
    sendAlert('CAPI endpoint not responding correctly');
  }
}

// Run hourly via cron

Escalation & Support

When to Escalate

Immediate Escalation:

  • Complete pixel failure (no events for 1+ hours)
  • CAPI authentication errors
  • Account suspended or restricted
  • Policy violations

Escalate Within 24 Hours:

  • EMQ score below 4.0
  • 50%+ drop in event volume
  • Attribution window issues
  • Persistent error codes

Support Channels

1. Meta Business Help Center

URL: business.facebook.com/business/help
Topics:
- Technical issues
- Policy questions
- Account access

2. Meta Business Support (For Business Accounts)

Access: Business Settings > Support
Response time: 1-2 business days

3. Developer Documentation

Meta for Developers: developers.facebook.com/docs/meta-pixel
Conversions API: developers.facebook.com/docs/marketing-api/conversions-api

4. Community Forums

Facebook Marketing API Developers Group
Stack Overflow (#facebook-pixel tag)

Escalation Template

Subject: [URGENT] Meta Pixel Issue - Events Not Tracking

Pixel ID: 123456789
Domain: example.com
Issue: PageView events stopped firing at 2025-01-15 14:30 UTC

Details:
- Last successful event: 2025-01-15 14:25 UTC
- Events Manager shows "No activity"
- Meta Pixel Helper shows pixel active
- No recent site changes

Troubleshooting completed:
✓ Verified pixel code present
✓ Tested in multiple browsers
✓ Checked Events Manager diagnostics
✓ Reviewed domain verification
✓ CAPI events also affected

Request: Urgent investigation of pixel/account status

Business Impact: Unable to track $50K/day in ad spend

Fbtrace ID: [from most recent API call]

Preventive Maintenance

Daily Checks (Automated)

// Daily pixel health check
async function dailyPixelHealthCheck() {
  const checks = {
    pixelFiring: await checkPixelStatus(),
    eventVolume: await checkEventVolume(),
    emqScore: await checkEMQScore(),
    capiStatus: await checkCAPIStatus()
  };

  const issues = Object.entries(checks)
    .filter(([key, status]) => !status.healthy)
    .map(([key, status]) => ({ check: key, ...status }));

  if (issues.length > 0) {
    sendDailyReport(issues);
  }

  return checks;
}

Weekly Reviews

  • Review Event Match Quality trends
  • Check for new error codes in CAPI logs
  • Verify all standard events still tracking
  • Test critical conversion paths
  • Review attribution window settings
  • Update documentation for any changes

Monthly Audits

  • Full pixel implementation review
  • CAPI endpoint performance analysis
  • EMQ score improvement opportunities
  • iOS 14+ attribution review
  • Aggregated Event Measurement configuration
  • Security: Rotate access tokens
  • Team training on new features

Quarterly Reviews

  • Complete tracking stack audit
  • Update to latest API version
  • Review and optimize event priorities
  • Analyze attribution model performance
  • Competitive analysis of tracking capabilities
  • Budget for new tools or plugins

Best Practices

Implementation Checklist

  • Single pixel instance per page
  • Pixel loads in <head> section
  • PageView tracked on all pages
  • Standard events using correct parameters
  • Advanced Matching implemented
  • Conversions API configured
  • Event deduplication working
  • Domain verified for iOS 14+
  • Aggregated events prioritized
  • Error monitoring in place
  • Documentation maintained
  • Team trained on troubleshooting

Performance Benchmarks

Metric Target Warning Critical
EMQ Score 8.0+ under 6.0 under 4.0
Event Match Rate 80%+ under 60% under 40%
CAPI Success Rate 99%+ under 95% under 90%
PageView Coverage 100% under 95% under 90%
Event Latency under 5 sec under 30 sec over 60 sec
// SYS.FOOTER