npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

meta-capi-param-builder-clientjs

v1.2.2

Published

Conversions API parameter builder for Client-side JavaScript

Readme

Conversions API parameter builder feature for Client-side JavaScript

npm License

Introduction

The Conversions API parameter builder SDK is a lightweight client-side JavaScript tool for improving Conversions API parameter retrieval and quality. It helps advertisers and partners improve match key quality and coverage (especially fbc and fbp) in CAPI events.

Client-Side Parameter Builder Onboarding Guide.

Quick Start

Installation

Install the package via npm or yarn:

npm install meta-capi-param-builder-clientjs

or

yarn add meta-capi-param-builder-clientjs

Alternatively, include the bundle directly via a script tag:

<script src="https://unpkg.com/meta-capi-param-builder-clientjs/dist/clientParamBuilder.bundle.js"></script>

Check the latest update from CHANGELOG.

Demo

  1. Check the updated version from CHANGELOG.
  2. Checkout the demo example from ./example. The example/public/index.html is the demo on how to use the library.

Run node server.js in the example directory, then visit http://localhost:3000. Check console log or cookies to see _fbp first.

Type the URL http://localhost:3000/?fbclid=test123 — you'll see fbc returned in the console log, and the _fbc cookie is stored.

API Usage

processAndCollectParams(url)

Processes and collects fbc and fbp parameters, saving them into cookies.

const params = clientParamBuilder.processAndCollectParams(url);
  • url is optional. Returns an object with _fbc and _fbp values.

processAndCollectAllParams(url, getIpFn)

Extended version that also retrieves client IP addresses and backup click IDs from in-app browsers.

const params = await clientParamBuilder.processAndCollectAllParams(url, getIpFn);
  • url is optional.
  • getIpFn is optional — a user-provided function to retrieve client IP addresses.

getFbc()

Returns the fbc value from cookie. Call processAndCollectParams first.

const fbc = clientParamBuilder.getFbc();

getFbp()

Returns the fbp value from cookie. Call processAndCollectParams first.

const fbp = clientParamBuilder.getFbp();

getClientIpAddress()

Returns the client_ip_address value from cookie. Call processAndCollectAllParams with a valid getIpFn first, otherwise returns an empty string.

const ip = clientParamBuilder.getClientIpAddress();

getNormalizedAndHashedPII(piiValue, dataType)

Returns normalized and hashed (SHA-256) PII from the input value.

const hashedEmail = clientParamBuilder.getNormalizedAndHashedPII('[email protected]', 'email');
const hashedPhone = clientParamBuilder.getNormalizedAndHashedPII('+1 (616) 954-7888', 'phone');

Supported dataType values: phone, email, first_name, last_name, date_of_birth, gender, city, state, zip_code, country, external_id.

Development

Prerequisites

  • Node.js >= 18
  • yarn (npm install --global yarn)

Setup

cd client_js
yarn install

Build

yarn build          # production build
yarn build:dev      # development build

Test

yarn test                                          # run all tests
yarn test -- --testPathPattern cookieUtil.test.js   # run specific test file

Lint and Format

yarn lint
yarn format

License

The Conversions API parameter builder feature for Client-side JavaScript is licensed under the LICENSE file in the root directory of this source tree.