Skip to main content
Some campaigns require more precise optimization than simply firing Facebook pixels on form loads. This integration uses Facebook’s Conversions API (CAPI) to send server-side events directly from Pingtree, giving you better attribution and match rates. Use this when you need to:
  • Optimize ads toward offline conversions (e.g., successful sales, funding events).
  • Fire different events depending on which buyer receives the lead.
  • Track multiple funnel events across the same session (e.g., submission, sale, upsell).
This guide walks you through setting up Facebook’s Conversions API (CAPI) with Pingtree’s routing logic, and how to use stored identifiers like facebook_fbc and facebook_fbp to improve attribution and match rates.

Capturing FBP & FBC Automatically

When a lead hits a Pingtree-hosted form or funnel that includes a Facebook ad click, we automatically extract and store the following cookies:
Cookie NameField Stored InPurpose
fbpfacebook_fbpIdentifies browser session for retargeting
fbcfacebook_fbcStores Facebook Click ID (from fbclid) for attribution
These values are attached to each lead object and included in any Facebook Conversions API requests made from Pingtree. Including these increases event match rate, which directly improves optimization performance in Meta Ads Manager.

Step 1: Obtain Access Token from Business Manager

To send events through the Facebook API, you must request to generate a token:
  1. Log into Facebook Business Manager
  2. Go to Events Manager
  3. Select the Pixel associated with the campaign
  4. Go to the Settings tab
  5. Find the Conversions API section
  6. Click Generate Access Token under Set up manually
Facebook/Meta Bearer Token Important:
Only users with developer privileges can generate tokens. Once generated, copy and store the token securely—it will only be shown once and expires in 60 days.
We recommend creating a recurring calendar reminder to rotate tokens, until we roll out automated refresh support. Reference: Facebook Conversions API Docs

Step 2: Determine the Event Trigger

Facebook conversion events can be fired from different parts of the funnel depending on campaign goals. Pingtree supports custom event triggers via postbacks, API events, and routing filters.

Available Trigger Types

You can map any standard Facebook event name — or custom events created in your Business Manager — to any Pingtree event. Here are common trigger points:
TriggerWhen It FiresConfigure At
Form SubmissionUser submits a formSource > Postbacks > On Form Submit
Lead SoldLead is accepted and sold to a buyerDistribution > Posting API
Offer Wall ClickUser clicks on an offerSource > Postbacks > On Offer Click
Offer Wall ConversionUser completes a third-party offerRequires conversion pixel or S2S postback from the offer network
Custom Buyer-Based EventsLead is routed to a specific buyerDistribution > Routing Rules with event conditions
Tip: Buyer-based events let you fire different Facebook events depending on which buyer receives the lead. This is useful for A/B testing ad optimization across different buyer segments.
Facebook Event Static Field

Step 3: Send Events to Facebook

Endpoint:
POST https://graph.facebook.com/v25.0/{PIXEL_ID}/events
Headers:
Authorization: Bearer {ACCESS_TOKEN}
Content-Type: application/json
Replace {PIXEL_ID} and {ACCESS_TOKEN} with the appropriate values provided by the Business Manager.

Required Fields and Hashed Data

Facebook requires all personally identifiable information (PII) to be SHA-256 hashed before being sent. Pingtree handles this automatically via data transformers.

Pingtree Field → Facebook CAPI Mapping

Pingtree FieldFacebook Field KeyJSON Path in PayloadNotes
emailemdata.0.user_data.emSHA-256 hashed
mobilephdata.0.user_data.phSHA-256 hashed
first_namefndata.0.user_data.fnSHA-256 hashed (optional, improves match rate)
last_namelndata.0.user_data.lnSHA-256 hashed (optional, improves match rate)
facebook_fbpfbpdata.0.user_data.fbpHelps with browser/session-level attribution
facebook_fbcfbcdata.0.user_data.fbcCaptures original Facebook ad click via fbclid
ipclient_ip_addressdata.0.user_data.client_ip_addressRequired if user agent is missing
user_agentclient_user_agentdata.0.user_data.client_user_agentStrongly recommended
utc_timestampevent_timedata.0.event_timeUNIX timestamp in UTC
event_nameevent_namedata.0.event_nameex: Lead, CompleteRegistration, etc.
custom_data.valuevaluedata.0.custom_data.valueRevenue or sale amount
custom_data.currencycurrencydata.0.custom_data.currencyUsually "USD"
(static or dynamic)action_sourcedata.0.action_sourceTypically "web"
fbclid(used to build fbc)data.0.user.fbclidUsed if facebook_fbc not directly available
test_event_codetest_event_codedata.0.test_event_codeUsed for testing only — Do not use in production

Use these mappings to ensure accurate event payloads and maximize match rates across Facebook Ads.

Sample Payload

{
  "data": [
    {
      "event_name": "CompleteRegistration",
      "event_time": 1655321234,
      "action_source": "web",
      "user_data": {
        "em": "c3fcd3d76192e4007dfb496cca67e13b",
        "ph": "b7c3d3d131bde4123ac85b9e6807631f",
        "fbp": "fb.1.1621245218912.1234567890",
        "fbc": "fb.1.1621245218912.AbCdEfGhIjKlMnOpQrStUvWxYz"
      },
      "custom_data": {
        "value": 50.0,
        "currency": "USD"
      }
    }
  ]
}

Attribution Accuracy Tips

  • Always include fbp and fbc if available.
  • Use real event timestamps in UTC to avoid time drift issues.
  • Don’t reuse old tokens — Facebook will silently reject or downrank expired tokens.
  • Consider hashing additional identifiers (first name, last name, IP) to improve matching.

FAQ

Do I need extra consent to send hashed PII to Facebook? If you already display a consent disclosure or cookie banner and your privacy policy references Facebook Ads, you are covered under standard CAPI usage. Hashing PII before transmission complies with Facebook’s terms. Can I send multiple events per session? Yes. Pingtree supports triggering multiple events (e.g., form submit, sale, upsell) in sequence. Each event can be tied to routing logic or source filters. What if I want to suppress Facebook events for specific buyers? Pingtree supports conditional filtering at the buyer or source level. You can define postback conditions per route or event type.

Troubleshooting

To test your server-side events with Facebook, retrieve a test_event_code from your Meta Events Manager:
  1. In Meta Events Manager, locate the pixel you’re using and copy the test_event_code.
  2. Go to your Postback Setup in Pingtree (Source or Distribution).
  3. Scroll to the bottom and create a new Static Field:
    • Key: test_event_code
    • Value: the code you copied.
Once saved, use the Test Postback tool at the top of the Postback Settings page.

Testing Guidelines

  • Use a transaction_id tied to a real ad-clicked lead whenever possible.
  • If unavailable, construct the payload manually using known test data.
  • Use a SHA-256 hashing tool to hash sensitive fields like email and phone.
  • Use a current UNIX timestamp from epochconverter.com for the event_time field.

For implementation help, contact your account manager or reach out via Live Support in the Pingtree app.