Platforms

Integrating Facebook Conversion API with Salesforce

Connect your Salesforce CRM data with Facebook's advertising platform for enhanced lead tracking and conversion attribution.

Why Connect Salesforce with Facebook CAPI

For B2B companies and enterprise organizations using Salesforce as their CRM, connecting conversion data with Facebook's advertising platform unlocks a powerful optimization loop. When you send offline conversion data—such as qualified leads, closed deals, and pipeline stages—back to Facebook through the Conversion API, the platform can optimize campaigns for actual business outcomes rather than just form submissions.

This is transformative for businesses with long sales cycles. Instead of optimizing Facebook ads for top-of-funnel metrics like clicks or landing page views, you can optimize for the conversions that actually matter: qualified leads, sales meetings booked, proposals sent, and deals closed. Facebook's algorithm learns which user profiles are most likely to become real customers, dramatically improving lead quality.

The Conversion API makes this possible by accepting offline event data with flexible timestamps, meaning you can send conversion data days or even weeks after the initial ad interaction. This is essential for B2B sales cycles that typically span weeks to months.

Salesforce Pipeline to Facebook Events

Map each stage of your Salesforce pipeline to a Facebook custom conversion event for full-funnel optimization:

1

Lead Created

→ Lead

Value: Low

Delay: Immediate

2

Marketing Qualified (MQL)

→ CustomEvent: MQL

Value: Medium

Delay: Days

3

Sales Qualified (SQL)

→ CustomEvent: SQL

Value: Medium-High

Delay: 1-2 weeks

4

Opportunity Created

→ CustomEvent: OpportunityCreated

Value: High

Delay: 2-4 weeks

5

Proposal Sent

→ CustomEvent: ProposalSent

Value: High

Delay: 3-6 weeks

6

Closed-Won

→ Purchase

Value: Deal Value

Delay: 4-12 weeks

Integration Architecture

Salesforce to CAPI Data Flow

The integration typically works by monitoring Salesforce lead and opportunity status changes. When a lead progresses through your pipeline—from MQL to SQL to closed-won—each stage change triggers a server-side event to Facebook via CAPI, passing hashed customer data for matching.

Automation Platforms

Tools like Zapier, Make (Integromat), or Salesforce Flow can automate the connection between Salesforce triggers and Facebook CAPI endpoints. These platforms handle the API authentication, data transformation, and event formatting, making integration accessible without custom development.

Custom Apex Integration

For maximum control and reliability, Salesforce developers can build custom Apex classes that call Facebook's Conversion API directly. Using Salesforce's HTTP callout framework, you can create triggers that fire CAPI events whenever records are created, updated, or reach specific pipeline stages.

Comparing Integration Methods

MethodDifficultyFlexibilityCost
Zapier / MakeLowMedium$20-100/mo
Salesforce FlowMediumHighIncluded
Custom ApexHighMaximumDev hours
Marketing CloudMediumHighEnterprise pricing
CDP (Segment, etc.)MediumHigh$120+/mo

Implementation Guide

Begin by defining which Salesforce events you want to send to Facebook. Common choices include Lead Created, Lead Qualified (MQL), Opportunity Created, and Opportunity Won. Each of these maps to a custom conversion event in Facebook that you can use for campaign optimization.

Set up your Facebook Business Manager with custom conversion events that match your Salesforce pipeline stages. Create a CAPI access token and configure your integration tool to authenticate with Facebook's API. Ensure that lead email addresses and phone numbers from Salesforce are hashed using SHA-256 before transmission.

Use Facebook's Offline Event Sets to manage your Salesforce conversion data. Upload test data first to verify matching rates and event processing. Monitor the data quality indicators in Events Manager to ensure high match rates between your Salesforce contacts and Facebook user profiles.

Common Salesforce CAPI Challenges

Low match rates for B2B contacts

B2B leads often use company email addresses that don't match their personal Facebook profiles. Include phone numbers, first/last name, and company domain alongside email. Consider enriching lead data with personal email addresses from data providers.

Attribution window limitations

Facebook's attribution window is typically 7 days for clicks and 1 day for views. For long B2B sales cycles, send conversion events as close to the original ad interaction as possible. Use the event_time parameter to backdate events to the original lead creation date.

Apex callout governor limits

Salesforce enforces limits on HTTP callouts (100 per transaction). For bulk lead imports or mass status updates, use @future methods or Queueable Apex to process CAPI events asynchronously and avoid hitting governor limits.

Data privacy and consent

Ensure your Salesforce lead records include consent flags for data sharing with Facebook. Implement consent checks in your CAPI trigger logic to only send events for leads who have opted in to marketing communications.

Best Practices

  • Map your complete Salesforce pipeline stages to Facebook custom conversion events
  • Include as many customer parameters as possible (email, phone, name, company) for higher match rates
  • Send conversion events within 7 days of the associated ad click for optimal attribution
  • Use Salesforce's lead scoring data to enrich Facebook event values for value-based optimization
  • Set up regular data quality audits to ensure consistent event delivery and matching
  • Consider using Salesforce Marketing Cloud for enterprise-grade CAPI integration

Salesforce CAPI FAQ

Can I optimize Facebook campaigns for Salesforce pipeline stages?

Yes! Once you send pipeline stage events to Facebook via CAPI, you can create custom conversions in Events Manager and select them as campaign optimization events. For example, optimize for 'SQL' instead of 'Lead' to attract higher-quality prospects.

How do I send Salesforce opportunity values to Facebook?

Include the opportunity amount as the 'value' parameter in your CAPI event. For Closed-Won opportunities, send the deal value with the Purchase event. Facebook can then use value-based optimization to find prospects likely to generate high-value deals.

What if my leads don't have Facebook accounts?

Not all B2B leads will match to Facebook profiles, especially those using corporate emails only. This is expected—focus on maximizing match rates by including multiple data points. Even partial matching provides valuable optimization signals to Facebook's algorithm.

Can I use Salesforce Pardot with CAPI?

Yes. Pardot (now Marketing Cloud Account Engagement) can trigger automation rules based on prospect activity that send events to CAPI. You can also use Pardot's completion actions on forms and emails to fire CAPI events for engagement tracking.

How do I handle deleted or disqualified leads?

There's no 'undo' for CAPI events. Instead, focus on only sending events for leads that pass your qualification criteria. Use Salesforce validation rules and Process Builder to ensure only valid, qualified leads trigger CAPI events.