Weld logo
How to implement Facebook Conversion API: Step-By-Step Guide
April 01, 2024Tools & Tips

Boost Facebook conversion tracking to 95%+ with server-side tracking: A step-by-step guide [2024 update]

Author image
by Jakob Kristensen

We've been offering support for the Facebook Conversion API in Weld for some time now. However, we believe it's high time to provide a comprehensive, step-by-step guide to help you utilize it to its full potential. Let's dive in..🤿

Introduction

Traditionally, the client-side Facebook Pixel (now known as the Meta Pixel) has been viewed as the premier integration mechanism for sending conversion signals to Facebook. By incorporating the pixel into their websites, advertisers have successfully monitored and relayed customer activity to Facebook. Once this data is sent to Facebook, it can be harnessed to e.g. (1) create retargeting audiences or (2) guide Facebook's machine learning systems that control attribution and targeting.

Unfortunately for advertisers, the effectiveness of pixel-based tracking methods has been compromised due to several factors. These include the recent proliferation of ad-blockers, the phasing out of third-party cookies, updated browser policies, and a general shift towards a more privacy-conscious internet.

The Conversions API from Facebook, often referred to as "CAPI", offers a resolution to these issues by allowing the dispatching of events directly from your servers (server-side) to Facebook, bypassing the user's device (client-side). This server-side interaction enables you to securely pass on your conversion signals and first-party customer information to Facebook, to fill the “lost” events that were not sent client-side. 

We have observed that companies who only send events client-side see only 60-70% of conversions inside Facebook. This means a loss of 30-40% of events. Our experience is that after implementing CAPI, customers see only ~5% of events lost, resulting in better campaign targeting, attribution and ultimately lower cost per conversion.

__wf_reserved_inherit

Picture 1: In addition to the traditional client-side Facebook Pixel, it is now recommended to also send your event server-side with CAPI, in order to avoid event loss / low data accuracy.

Implementing Facebook CAPI can be challenging

While the CAPI has been a stellar addition to Facebook's product lineup, it can pose significant implementation challenges due to the technical proficiency required to extract from your source and write to the API. 

On the B2C side, if you are a single-channel brand, e.g. a Shopify store, you have tools like Data Sharing from Shopify that makes it easy to send data to Facebook CAPI. Woocommerce has a similar solution, that’s easy to install.

However, what if you are an omni-channel B2C or B2B brand, with data across online, retail, Amazon etc.? Then there is not a “one-click” solution to implementing Facebook CAPI. 

Luckily, with Weld (ELT and Reverse-ETL tool), the synchronization of conversion events can be automated with our direct integration with Facebook CAPI - eliminating the hurdles of technical know-how, implementation, and maintenance of your own Facebook CAPI API integration.

Sending events both client-sideand server-side

Facebook advises the combined use of CAPI and Pixel, i.e. sending your events both client-side and server-side in order to get full coverage of all your conversion events.

This means you should keep your current Pixel implementation and see CAPI as an addition to this, in order to boost data accuracy.

However, this will lead you to send some events twice, which will require deduplication. The way to get around this is to make sure your event_id and event_name are the same on both client-side and server-side events. I will show you how to implement it later in this guide.

Example Use-Case of Facebook CAPI with Weld ⚒️

In this case, we assume you're a retailer who uses Facebook Ads as a strategy to direct traffic to your online store and multiple physical stores. Another example could be if you’re a B2B SaaS platform with multiple forms of lead capture. You have incorporated the Facebook pixel on your website to monitor PageView, AddToCart and Purchase events.

However, recent iOS tracking modifications coupled with the widespread use of ad blockers, as explained previously, have led to a scenario where you only see 60% of conversions in Facebook. 

Plus, Facebook fails to account for purchases made in your physical stores, which comprise nearly half of all your transactions. This has negatively impacted your paid media strategies, but you are confident that these obstacles can be solved with the Facebook CAPI to securely send all conversion data to Facebook.

Below, we will go through a step-by-step guide on solving this in Weld.

Create Weld account

Weld is your gateway to simplified data engineering, offering automated data pipelines from 100+ data sources (SaaS, databases, files etc.) and an AI-driven SQL Editor to build trustworthy data models. 

Push data models to dashboards in your BI Tool (PowerBI, Tableau, Metabase, Looker etc.)  or use our Export feature to send data directly to CRM, Ad Platforms etc… Today, we will use the Export to Facebook CAPI.

All of this is running on your own data warehouse. Weld supports Google BigQuery and Snowflake.

You can sign up for a free account at weld.app. It only takes a few minutes, and you'll gain free access to the Facebook CAPI integration.

Connect your data

Get your server-side data into Weld with our pre-built integrations. Set up data sources in minutes in the Weld app, where you will be guided through the flow. 

Systems where you could have relevant customer data could be e.g. CRM, (e)commerce platform, database, Google Sheets, files etc.

Picture 2: You can connect to 100+ tools with one click in Weld.

If you're unsure about how to set up your first data pipeline, please refer to our Product Tour.

Build your data model for conversion events

When you have connected your data sources, with your customer data available, you can build the data model in SQL that will be used to fetch the data we want to send to Facebook CAPI.

I would recommend you to send the following parameters, in order to achieve the best matching rate:

  • event_id
  • event_name 
  • event_time
  • email
  • first_name
  • last_name
  • city
  • country
  • client_ip
  • facebook_click_ip
  • action_source

Most of these parameters can be found in your CRM, (e)commerce platform or database, which you have connected in the previous step. Since this is sensitive customer data, Facebook requires the data to be hashed, which Weld will take care of. Also, always remember to get consent from users to collect this data.

The event_id is the trickiest parameter to handle. You will need to use the same event_id client-side and server-side, in order to make sure Facebook doesn’t count conversions twice. 

You need to send all possible events client-side and all possible events server-side, and then Facebook will do the deduplication automatically if the event_id and event_name is sent.

In our case, being a B2B SaaS platform, we use the user_id combined with an event name prefix to form the event_id, like so: {event_name} + : + {user_id}.

The way Facebook handles this is described in their official CAPI docs:

If we find the same server key combination (event_id and event_name) and browser key combination (eventID and event) sent to the same Pixel ID within 48 hours, we discard the subsequent events.
The eventID from the Meta Pixel must match the event_id in the corresponding event coming from the Conversions API.

Picture 3: An example SQL data model to fetch data for Facebook CAPI

Send data to Facebook CAPI with Weld Export

Setup the export flow directly from the SQL editor with the data model. Follow the steps in the Weld product where you will map the data model to the Facebook CAPI parameters. This should only take a few minutes.

Picture 4: Export data with Weld in a few clicks

Last, you select a schedule, e.g. every 30 min, where Weld will automatically send data to Facebook CAPI.

Start the sync and see the data flow immediately. 

If you encounter any errors, they will be displayed in Weld and we will notify you via email. The errors will likely be if you have formatted the data incorrectly. For example, “city” should be lowercase and “country” should be 2-letter country codes - see all the formatting requirements in the official CAPI docs.

Conclusion

In the face of evolving digital privacy norms and the increasing prevalence of ad-blockers, the Facebook Conversion API (CAPI) emerges as a robust solution for advertisers seeking to maintain high data accuracy. This server-side approach allows for the secure transmission of conversion signals and first-party customer information, mitigating the loss of events experienced with client-side methods.

However, implementing CAPI can be a technical challenge, particularly for omni-channel B2C or B2B companies. This is where Weld comes into play, offering a streamlined solution for automating the synchronization of conversion events. With Weld's direct integration with Facebook CAPI, the technical hurdles of implementation and maintenance are effectively eliminated.

In this guide, we've walked you through the process of setting up Weld, connecting your data, building your data model for conversion events, and finally, sending data to Facebook CAPI using Weld's Export feature. We've also discussed the importance of sending events both client-side and server-side for full coverage, and the necessity of deduplication to avoid counting conversions twice.

By following these steps, you can significantly improve your campaign targeting, attribution, and ultimately lower your cost per conversion. With a data accuracy rate of over 95%, the combination of Facebook CAPI and Weld provides a powerful tool for advertisers to navigate the changing landscape of digital marketing.

Remember, the key to successful implementation lies in understanding your data, building an accurate data model, and setting up a reliable data pipeline. With these in place, you're well on your way to achieving superior results with your Facebook advertising campaigns.

© 2024 Weld. All rights reserved.