Facebook CAPI & Server-Side API

Data tracking is an essential aspect of any business that wants to understand its customer base and improve its online presence. Facebook offers a variety of tools and methods for tracking conversions and other actions on a website, such as the Facebook Pixel and App Events. However, for some businesses, these methods may not be suitable, for example, if the business wants to track sensitive information or track offline conversions. In these cases, Facebook offers two alternative methods: Facebook CAPI (Client API) and the Server-Side API.

Facebook CAPI (Client API) is a lightweight library that allows businesses to send data to Facebook directly from the client-side, or the user’s browser. CAPI doesn’t rely on cookies or JavaScript and can be easily integrated into any website or web application. It allows businesses to track events, such as page views and custom events, directly to Facebook, even if the user has opted-out of cookies or JavaScript. This is particularly useful for businesses that want to track events that occur on their website even if the user has opted-out of cookies or JavaScript.

The Server-Side API, on the other hand, is a method where data is sent directly from the server to Facebook, rather than from the user’s browser. This method is particularly useful when tracking sensitive data that can’t be sent from the user’s browser, such as financial information, or data that’s not accessible from the browser, such as offline conversions. This method is more secure since it doesn’t rely on cookies or JavaScript, but it requires more technical knowledge and development resources to implement.

One of the main advantages of CAPI is that it is lightweight and easy to integrate into any website or web application. It does not rely on cookies or JavaScript, making it more reliable for tracking data, even when users have opted-out of these technologies. Additionally, CAPI can be used in parallel with the Facebook Pixel, providing businesses with a way to ensure that they are collecting accurate data.

The Server-Side API, on the other hand, offers increased security for businesses that need to track sensitive data. It allows for data to be sent directly from the server to Facebook, bypassing the user’s browser, which is particularly useful for businesses that need to track offline conversions or handle sensitive data. Additionally, this method is useful for businesses that want to ensure that their data is accurate and that their tracking is not affected by the user’s browser settings.

Setting up and using Facebook CAPI and the Server-Side API to track conversions and other actions on your website can be a bit more complex than using the Facebook Pixel, but with the right guidance, it can be done easily.

To get started with Facebook CAPI, you’ll first need to have a Facebook Ads account. If you don’t have one, you can create one for free. Once you have an account, you can download the CAPI library from the Facebook developer website.

Next, you’ll need to add the CAPI library to your website. This can be done by adding the CAPI library to your website’s HTML code. You can also use a plugin if your website is built on a popular platform like WordPress or Shopify.

Once the CAPI library is installed and active on your website, you can start tracking conversions. A conversion is an action that you consider valuable, like a purchase or a form submission. You can set up specific conversion events in your Facebook Ads account, and track how many times they occur on your website.

To track events using CAPI, you need to use the fbq(‘track’, ‘eventName’) function and pass the event name as a parameter. You can also pass additional parameters such as the value of the event and a currency.

Next, let’s move on to the Server-side API, to use the Server-side API, you will need to have a developer that can write code that can communicate with the Facebook API. You will also need to have a Facebook Access Token that you can use to authenticate your server-side requests.

Once you have the Access Token, you can start sending events to Facebook by making an HTTP request to Facebook’s server-side API endpoint. This request includes information about the event, such as the event name, the user ID, and the event value.

To set up the Server-Side API, you will need to create an endpoint on your server that can handle the HTTP requests from the client and forward them to Facebook. You will also need to handle the response from Facebook and process it according to your needs.

In summary, setting up and using Facebook CAPI and the Server-Side API to track conversions and other actions on your website can be a bit more complex than using the Facebook Pixel. But it’s worth it if you want to track events that occur on your website even if the user has opted-out of cookies or JavaScript or you want to track sensitive data or offline conversions. Make sure to consult with your developer and have a Facebook Ads account to set it up properly.