They introduce a new internet where:
Consumer privacy comes first.
Only first-party data survives.
Browsers are less reliable tools to share data back to advertising platforms.
Facebook’s answer to this new internet is the Conversions API (formerly known as the “server-side pixel”, also known as the “CAPI”).
This article will explain what Facebook’s Conversions API is, why it’s worth focusing on now, and a step-by-step guide on using Segment (an official Facebook Integration Partner) to collect your first-party data and sync to Facebook for retargeting.
What is the Facebook Conversions API?
Currently, most businesses use the standard Facebook pixel to run ads. They do this by installing the Facebook pixel directly on their website or by using Segment to bundle and share pixel events automatically.
With this setup, when users land on a website and complete actions (such as Product Viewed, Demo Requested, etc.), the pixel collects and sends these events to Facebook directly from the browser (user’s device).
While this is a powerful way to send first-party data to Facebook (and it’s not going anywhere soon), the introduction of new browser privacy policies, the death of third-party cookies, and the adoption of ad-blockers are making this type of tracking less reliable. Furthermore, iOS 14 changes will heavily limit how apps and websites on Apple devices can directly share conversion event information.
Facebook’s Conversions API is a way to send your first-party data directly from your application servers (not the user’s device) to Facebook.
This type of server-side communication is extremely reliable and allows you to choose exactly what data to share with Facebook, instead of only relying on data the Facebook pixel collects. Conversions API also allows you to share conversion events lower in the funnel that may not even take place on your website (e.g. within your app, CRM, Support Tool, etc.)
How can Segment help?
Segment allows companies to unify customer data collection to a single API, and then streams this data anywhere without requiring additional engineering effort.
Instead of having your engineers build one-off integrations directly with the Facebook Conversions API (and every other tool), the idea is to track your events once to Segment, and then Segment can stream these events to your entire tech stack - Analytics, Data Warehouse, CRM, Marketing tools, as well as the Conversions API.
For any data destination, Segment will perform all the data mappings and translations, so the data is being received by the partner destination properly. For example, with the Conversions API, Segment will do relevant data mappings and hash appropriate PII, as required by Facebook.
Today there are two main use-cases to implement this Facebook CAPI destination via Segment:
More Reliable Website Tracking: Use Segment to send web events using both the pixel and the Conversions API, where the server-side events are a backup for times the client-side Facebook pixel fails. For collecting website behavior, currently we still recommend loading Facebook’s standard pixel, and if you do this through Segment, Facebook will deduplicate when it receives the same events from both the pixel vs. Conversions API.
New Additional Events: There may be key events that you only track server-side, or additional events that happen somewhere else lower in the funnel (e.g., In-app, CRM, Support, etc.). With Segment you can simply stream these server-side events over to Facebook.
In this article, we’ll teach you how to retarget anonymous users with Segment and Facebook’s Conversions API in three simple steps.
What do you need?
For example, let’s assume we’re tracking a standard eCommerce purchase funnel, and we want to make sure our lower-funnel events are extremely accurate (by tracking on both the client and the server). Depicted in the diagram below, we have the full purchase funnel tracked on the client (mapped to the Segment eCommerce Spec), whereas our more important lower-funnel events are also tracked server-side.
(Note: This is just one example and not necessarily a recommendation. You may want to track the entire funnel server-side, or you may be sending in completely different events server-side, etc.)
For each event tracked, you’ll need to make a choice to share your event data with Facebook via one of three options - using the pixel, the CAPI, or both. This decision is up to you, but using a redundant set-up with both the pixel and Conversions API will be the most reliable and is the recommendation from Facebook.
To accomplish this, here’s a diagram of what we’re going to configure with Segment:
Step 1: Enable the Facebook Pixel destination on your website
Follow instructions to enable the standard Facebook Pixel Destination from your client-side Segment source.
Log in to the Segment App.
Click Add Destination and find the Facebook Pixel Destination.
Choose your Segment source that is collecting client-side website events.
Enter your Pixel ID.
Complete any relevant category or event mappings (see docs for details).
Enable the Use UserId or Anonymous Id as External Id setting, which will make sure events sent to facebook include an External ID that matches the Segment
anonymousIdif there is no
userId). This will be important for Facebook deduplication (more details at bottom)
Enable the Destination.
Once enabled, the following will happen automatically:
Segment will bundle the Facebook pixel SDK onto the browser (aka device-mode).
Facebook pixel SDK will set two first-party cookies - the
Segment will automatically translate tracked events and send them to Facebook from the browser (user’s device).
Step 2: Share identifiers from client to server, add to server-side events
This step will require engineering effort, and really depends on the technologies that you use. For retargeting anonymous users, the key fields you’ll want to pass from the browser to your application servers are the following (see Facebook documentation on retargeting):
The two first-party cookies set by Facebook Pixel -
You’ll then add these identifiers to each server-side event you want to share with Facebook. You’ll also want to choose the appropriate
action_source, depending on where this event occurred. For example, if the event occurred on your website, you’ll want to specify an
website and also include the website url in the
context.page.url field. More instructions in our Facebook Conversions API documentation.
As an example, below is a Product Added event sent server-side to Segment. Notice the ip, userAgent, and url are in the context object, whereas the
fbp are in the properties object:
Note: The example above is for an anonymous shopper, however, you should include the known identifiers Facebook supports when possible. For example, if this were Order Completed, this event would likely also include an email and userId property.
Step 3: Enable the Facebook Conversions API for server-side events
Now we just need to turn on the Facebook Conversions API destination for this server-side source configured in Step 2.
Login to Segment.
Click Add Destination and find the Facebook Conversions API destination
Choose the Server-Side source of data configured in Step 2.
Enter your Pixel ID
Complete any relevant category or event mappings in the settings.
Enable the destination.
Log into Facebook Event Manager and confirm that duplicate events between the Pixel and CAPI are being merged.
A quick note on deduplication logic...
For situations where you’re firing events using both the pixel and Conversions API, Facebook is able to deduplicate events using two properties that Segment sends to Facebook — the Event Name and External ID. For this reason, you’ll want to make sure your event mappings match between these two destinations, and that they are both configured to send the same External ID. This recipe configures Segment to set the External ID to the
anonymousId when user is not authenticated).
Also, for Facebook to successfully deduplicate events, you’ll want to make sure you’re triggering client-side events before triggering the same events server-side. Facebook only dedupes when events are received in this order.
Here’s what we’ve done in this recipe:
Configured the standard Facebook pixel to load onto your website and collect events
Shared device-info from the browser to your app servers, and sent enriched events into Segment server-side.
Configured server-side events to stream to the new Facebook Conversions API, to provide a more accurate and complete view of your conversion funnels for your customer base.
How to manage consent enforcement with Twilio Segment
Announcing the availability of Consent Enforcement in Connections for all Business Tier customers at Twilio Segment, empowering businesses to integrate with any Consent Management Platform and enforce end-users' consent preferences seamlessly.
Unlocking the Power of Facebook's Conversions API with Segment: A Guide to First-Party Data Retargeting
Explore the shifting terrain of online privacy regulations, including Facebook's Conversions API, and learn how Segment streamlines the integration and transmission of first-party data, enabling efficient retargeting strategies.
Empowering teams, inspiring solutions: Inside Twilio Segment's build-a-thon
We share the innovations from Twilio's internal build-a-thon, which showcases the transformative potential of integrating Segment, that deliver solutions that address real-world challenges and redefine customer engagement.