Meta has provided a list of library SDKs in both client-side (JavaScript) and server-side (PHP, Java, Python, NodeJS, Ruby). These SDK libraries are intended to help developers improve the quality of Conversions API events’ parameters (for example, fbc and fbp), and enable advertisers to adhere to Meta’s best practices around generating these parameters.
This document includes an overview of both libraries, guidance on which library to use, and example use cases.
Client-side: The library and events live in the front end on the browser side. The libraries are implemented in JavaScript. Developers may integrate it in their web page directly.
Server-side: The libraries and events live in the back end on the server side. Depending on the language the backend uses, Meta provides libraries in different languages (PHP, Java, Python, NodeJS and Ruby).
All libraries can work independently. To maximize the potential for you or your customers, review the recommendations here.
Broken down by functionality, there are two types of libraries Meta supports:
Parambuilder adheres to the best practices referenced in Meta’s developer documentation. It is implemented on the client-side (JavaScript) and server-side (PHP, Java, Python, NodeJS, Ruby).
Paramshelper, also known as clientParamsHelper, only works on the front-end client side. It is a JavaScript library to retrieve backup clickID from the in-app browser. It may help further increase fbc retrieval and its quality, that is, the number of events that contain fbc as a percentage of the total number of events.
Paramshelper can work independently, but we recommend supplementing it with server side parameter builder SDK to maximize its potential.
The following use cases may be worth considering as you are building the solution.
Pairing the server-side parameter builder and client-side paramshelper may help maximize your potential to achieve high fbc coverage.
To do so, you’ll need to integrate two libraries together: server-side ParamBuilder and ClientHelper.
Example workflow:
decorateUrl(existing_url)
on the client-side when loading the page.// Example Controller which processes all requests to example.com // Start process ParamBuilder paramBuilder = new ParamBuilder(Arrays.asList('example.com', 'yourDomain.com')); // Input the request's full URL, such as: example.com?fbclid=xxxxx // Process and get recommended updated cookie List<CookieSetting> updatedCookieList = paramBuilder.processRequest( request.getHeader("host"), // example.com request.getParameterMap(), // {'fbclid':['xxxxx']} cookieMap, request.getHeader("referer")); // optional: referer full url // Save cookie from server side for (CookieSetting updatedCookie : updatedCookieList) { Cookie cookie = new Cookie(updatedCookie.getName(), updatedCookie.getValue()); cookie.setMaxAge(updatedCookie.getMaxAge()); cookie.setDomain(updatedCookie.getDomain()); response.addCookie(cookie); } // Get fbc, fbp String fbc = paramBuilder.getFbc(); String fbp = paramBuilder.getFbp(); // Call CAPI endpoint ..... .setFbc(fbc) .setFbp(fbp) ....
If you would like to integrate with client-side libraries, you can use parambuilder to cover all features.
Example: Integrate with client-side ParamBuilder(clientParamBuilder) only
We currently support the API processAndCollectAllParams(url) when loading the page. It will adopt both features from clientParamBuilder and clientParamsHelper to retrieve and store fbc and fbp cookies.
Please review the Server-Side Parameter Builder Onboarding Guide or the README files linked within for some detailed examples.
Please review the Client-Side Parameter Builder Onboarding Guide or the README files linked within for some detailed examples.
_fbp
and _fbc
cookies as early as possible in the customer journey in your webpage. Ideally retrieve _fbp
and _fbc
cookies when loading your landing page. It’s not recommended to retrieve them only down-funnel events or when certain events are triggered._fbc
or _fbp
cookie. _fbc
is case sensitive; do not normalize or format the _fbc
to lowercase.