Ads and Commerce

Parameter Builder Workflow and Examples

Updated: Jul 21, 2026
Copy for LLM
The parameter builder library is an open-source lightweight SDK designed to fit in the majority of the systems.

Workflow

You can find example demos for each language under their respective language subdirectories in the capi-param-builder repository: A localhost-based demo application is under the folder titled /example. The README file shows how to run the demo application in localhost step by step.

Client-side SDK

Directory:
High-level integration guidance:
  • Load the SDK: clientParamBuilder is loaded during page initialization.
  • Call the SDK APIs: The advertiser’s website calls the APIs provided by clientParamBuilder. For example:
    • processAndCollectAllParams saves and updates fbp, fpc, and fbi (if getIpFn is available)
      • If getIpFn is not empty, fbi will be saved in the cookie, based on the pass-in function getIpFn result.
      • Saves fbc if applicable.
      • Saves fbp if applicable.
    • .getNormalizedAndHashedPII: Return normalized and hashed PII data based on input value and type.
    • .getFbc(), getFbp(), getClientIpAddress(): Call .processAndCollectAllParams first to set in cookies, and retrieve the results from the cookie. Note: this API will save/update cookies. Make sure the website has the user’s cookie consent before calling.
  • Send the Conversions API payload: The advertiser’s website sends the Conversions API payload with retrieved parameters.
Refer to full instructions in README file.

Server-side SDK

Directories:
High-level integration guidance:
  • Import param builder library into advertiser’s website server application.
  • Process the request: Call updatedCookieList = builder.processRequestFromContext with input data.
  • Get the cookies to set: Either use updatedCookieList or builder.getCookiesToSet to get a list of recommended cookies to save.
  • Save the cookies: The advertiser’s website server saves cookies based on the above list.
  • Fetch the parameters. Retrieve values using:
    • getFbc()
      • Returns the fbc (Meta click ID) used for Conversions API payload
    • getFbp()
      • Returns the fbp (Meta browser ID) used for Conversions API payload
    • getReferrerUrl()
      • Returns the referrer_url (Referrer URL) used for Conversions API payload
    • getEventSourceUrl()
      • Returns the event_source_url (Event source URL) used for Conversions API payload
    • getClientIpAddress()
      • Returns the client_ip_address (Client IP address) used for Conversions API payload
    • getNormalizedAndHashedPII()
      • Returns normalized-and-hashed PII based on the input value and its data type used for Conversions API payload. Supported dataType values: email, phone, first_name, last_name, date_of_birth, gender, city, state, zip_code, country, external_id.
  • Send the Conversions API payload: The advertiser’s website sends payload with the above parameters.
You can also integrate both client-side and server-side SDK in the same web application. Both SDKs are compatible with each other, and use cookies for major interactions. Integrating both SDKs can help maximize the effectiveness of the parameter builder library.
click image to enlarge
Flow diagram of combined client-side and server-side parameter builder integration sending fbc, fbp, referrer_url, event_source_url, client_ip_address, and PII to the Meta Conversions API


High-level workflow:
  1. Advertiser client application loads client-side parameter builder and invokes provided API processAndCollectAllParams with a function pointer getIpFn.
  2. The provided getIpFn will be invoked and fetch IPv6 from an advertiser-configured endpoint, depending on the actual getIpFn implementation.
  3. The IPv6 will be returned from the advertiser-configured endpoint and passed back to client-side parameter builder from the return value of getIpFn. The retrieved IPv6 will be stored in the cookie with key _fbi for later retrieval.
  4. On the client-side, start your business-as-usual communications to the back-end server using the fetch API (or other front-back end communication) with the first-party cookies.
  5. On the server-side, integrate the server-side library based on your choice of language in the receiver endpoint (for example, ExampleController), and invoke the provided API processRequestFromContext to handle the request.
  6. The processRequestFromContext API will return a list of recommended cookies to update on the client-side.
  7. Set the recommended cookies in response headers to instruct the client browser to store them.
  8. Invoke various provided APIs like getFbc(), getFbp(), getReferrerUrl(), getEventSourceUrl(), getClientIpAddress() and getNormalizedAndHashedPII().
  9. The SDK will return various values such as fbc, fbp, referrer_url, event_source_url, client_ip_address, email and phone number.
  10. Send these retrieved values back to Meta through the Conversions API.