Meta Ads Integration

Server-side Conversions API (CAPI) forwarding for Meta (Facebook) ads.

Prerequisites#

  • Meta Business Manager account
  • Facebook Dataset (Pixel) created in Events Manager

Setup#

  1. In Meta Events Manager → Data Sources → select your pixel → Settings → copy the Dataset ID.
  2. In Meta Business Settings → System Users → create a system user → generate an access token with the ads_management permission.
  3. In the AppRefer dashboard → Settings → Integrations → Meta: paste the Dataset ID and Access Token → Save.
  4. Click "Test Connection" to verify your credentials are valid.

How It Works#

When a user attributed to Meta (has an fbclid) triggers an event, AppRefer sends it to the Conversions API:

Meta CAPI Endpoint
POST graph.facebook.com/v24.0/{datasetId}/events

The fbclid is formatted as fb.1.{timestamp}.{fbclid} in the fbc parameter of the request payload.

Event Mapping#

AppRefer EventMeta CAPI Event
installLead
purchase / INITIAL_PURCHASE / RENEWALPurchase
sign_upCompleteRegistration
start_trial / qualified_trialStartTrial
subscribeSubscribe
add_to_cartAddToCart
initiate_checkoutInitiateCheckout
searchSearch
view_contentViewContent

Advanced Matching#

When available, hashed PII is included in the user_data object sent to Meta. Supported fields:

FieldKeyFormat
EmailemSHA256(lowercase(trim(email)))
PhonephSHA256(E.164 format)
First NamefnSHA256(lowercase(trim(name)))
Last NamelnSHA256(lowercase(trim(name)))
Date of BirthdbSHA256(YYYYMMDD)

Improve Match Rates

Advanced Matching improves match rates by 20-30%. Call setAdvancedMatching() in the SDK after user login to provide hashed PII for better conversion attribution.

Deduplication#

Each event is sent with a unique event_id. Meta automatically deduplicates events with the same event_id within a 48-hour window.