Meta Ads Install / Embed Tag or SDK | Blue Frog Docs

Meta Ads Install / Embed Tag or SDK

Deployment strategies for Facebook Pixel and Conversions API across web, mobile, and server environments.

Delivery Options to Evaluate

  • Preferred: Google Tag Manager with Facebook Pixel base code and event-specific tags for standard and custom events.
  • Enforce consent mode integration with your CMP (OneTrust, Cookiebot) to respect user privacy choices before pixel fires.
  • Use GTM variables for environment-specific pixel IDs and test event codes to avoid mixing dev/staging data with production.
  • Consider Conversions API for server-side redundancy and privacy-compliant tracking, especially for high-value events like purchases.

Tag Manager Deployment

  • Create a base Facebook Pixel tag in GTM that fires on all pages with your pixel ID.
  • Build separate event tags for each standard event (ViewContent, AddToCart, Purchase) triggered by dataLayer pushes or page-specific rules.
  • Bind pixel ID, access token (for CAPI), and consent state to GTM variables per environment.
  • Use GTM Preview mode to validate pixel firing, event parameters, and consent signal integration before publishing.
  • Test advanced matching parameters (hashed email, phone) in Test Events to confirm they are properly formatted.

Direct Embed or Hard-Coded Scripts

  • If GTM is not available, place the Facebook Pixel base code in the document <head> section with async loading.
  • Add fbq('init', 'PIXEL_ID') followed by fbq('track', 'PageView') immediately after the base code.
  • For event tracking, call fbq('track', 'EventName', {parameters}) on user actions (button clicks, form submissions).
  • Keep pixel IDs environment-aware via server-rendered variables or feature flags so staging never sends data to production pixels.
  • Implement consent checks before initializing the pixel to comply with GDPR and CCPA requirements.

Mobile & App SDKs

  • Use Facebook SDK for iOS and Android to track app events that mirror web pixel events.
  • Initialize the SDK with your app ID and enable Automatic Event Logging for basic app lifecycle events (app opens, purchases).
  • Manually log custom events with AppEvents.logEvent() for in-app actions aligned with your tracking plan.
  • Configure App Events Test Events in Events Manager to validate mobile event payloads during development.
  • Align event names and parameters between web pixel and mobile SDK for consistent cross-platform reporting.

Server-Side Collection (Conversions API)

  • Deploy Conversions API endpoints on your backend to send server-side events for high-value conversions (purchases, leads, registrations).
  • Use the same event names as the pixel to enable Meta's deduplication logic (match on event_id and event_time).
  • Send hashed user data (email, phone, external_id) and browser information (user_agent, IP address, fbp/fbc cookies) for improved Event Match Quality.
  • Retrieve fbp (Facebook browser cookie) and fbc (Facebook click ID) from the user's browser and pass them to your server for CAPI events.
  • Implement retry logic, error logging, and monitoring for CAPI requests to surface failed events quickly.
  • Test server events in Events Manager Test Events tab before enabling production traffic.

Validation Checklist

  • Check Facebook Pixel Helper extension for pixel status, event firing, and parameter accuracy on key pages.
  • Review Events Manager Test Events for both pixel and CAPI events, confirming event names, parameters, and deduplication.
  • Verify Event Match Quality score is above 6.0 (preferably 7.0+) by sending sufficient user matching parameters.
  • Confirm domain ownership in Business Manager and Aggregated Event Measurement configuration for iOS campaigns.
  • Screenshot GTM Preview and Events Manager Diagnostics for documentation and compliance evidence.

Open Decisions & Follow-Ups

  • Decide whether to enable automatic advanced matching in the pixel or handle hashing manually.
  • Plan migration from older pixel implementations or consolidation of multiple pixel IDs.
  • Evaluate Conversions API Gateway (partner-hosted solutions) for easier CAPI setup without custom backend development.
  • Consider using Meta's official Shopify, WordPress, or BigCommerce plugins for streamlined e-commerce integrations.
// SYS.FOOTER