Skip to main content

Meta Conversions API (CAPI)

The Meta Conversions API (CAPI) sends purchase-funnel events directly from the Globber server to Meta — independently of the browser. This means ad attribution data is captured even when the Meta Pixel is blocked by browsers, ad-blockers, or iOS privacy restrictions.

How it fits with the Meta Pixel

The browser-side Meta Pixel fires via Google Tag Manager (GTM) as usual. CAPI sends a server-side mirror of the same events. Meta uses a shared event_id to deduplicate both signals so events are not counted twice.

Events Tracked

EventTriggerevent_id format
ViewContentSingle product page loadvc_{product_id}_{unique}
InitiateCheckoutWooCommerce checkout order createdinitiate_checkout_{order_id}
PurchaseWooCommerce payment completepurchase_{order_id}

Configuration

Credentials are stored in WordPress → Theme Options → General Settings (ACF options page).

FieldDescription
Meta Pixel ID (meta_pixel_id)Your numeric Meta Pixel ID
CAPI Access Token (meta_capi_access_token)System user access token from Meta Events Manager
Test Event Code (meta_capi_test_event_code)Optional — use during testing; remove before going live
Test Event Code

If a test event code is set, all CAPI hits will be routed to the Meta Test Events tool and will not be counted as real conversions. Always clear this field in production.

To find or generate your credentials:

  1. Go to Meta Events Manager
  2. Select your Pixel → Settings
  3. Under Conversions API, click Generate Access Token
  4. Copy the token and your Pixel ID into the ACF settings fields above

How Deduplication Works

Both the browser Pixel (via GTM) and the server CAPI hit carry the same deterministic event_id.

Browser (GTM Pixel tag)  ──┐
├──► Meta ──► deduplicated ──► 1× conversion
Server (CAPI) ──┘

For Purchase, the event_id (purchase_{order_id}) is pushed into the dataLayer by the theme alongside the purchase GA4 event. The GTM Pixel tag is configured to read meta_event_id from that dataLayer push.

For ViewContent, a unique event_id is generated per page load and injected into window.dataLayer as meta_vc_event_id so the GTM tag can read it.

User Data & Privacy

All personally identifiable information (PII) sent to Meta is SHA-256 hashed before transmission. Fields hashed include:

  • Email address
  • Phone number
  • First name / Last name
  • City, postcode, country

Cookie-based identifiers (_fbp browser ID and _fbc click ID) are captured at checkout and stored on the order. They are forwarded as-is (unmodified) to Meta as required by the CAPI spec.

No raw PII is ever sent in plaintext.

When a customer submits the checkout form, the theme captures and saves the following cookies to the WooCommerce order:

CookieStored asPurpose
_fbp_meta_fbp order metaMeta Pixel browser ID
_fbc_meta_fbc order metaMeta click ID (visitors from Meta ads)
_ga_ga_client_id order metaGA4 client ID (used for GA4 Measurement Protocol refund tracking)

This ensures that even on server-side hooks (which run outside the browser session), the correct user identifiers are available for attribution.

Idempotency

The Purchase event includes an idempotency guard: once the CAPI hit fires successfully, _meta_capi_purchase_tracked is saved on the order. If the woocommerce_payment_complete hook fires more than once for the same order (e.g. webhook retries), no duplicate event is sent.

Out of Scope (Deferred)

The following events were intentionally excluded from this implementation:

EventReason deferred
AddToCartRequires a dedicated AJAX endpoint and mid-session cookie handling
PageViewHigh volume, low marginal attribution value compared to Purchase