Skip to content
adscapi

Documentation

adscapi turns one conversion event into a server-side call to every ad platform’s Conversions API. Install it, set your tokens, and call conversions.track() once.

Quickstart

ts
import { createAdscapi } from 'adscapi';

const ads = createAdscapi(); // reads platform tokens from the environment

const results = await ads.conversions.track({
  name: 'purchase',
  value: 49,
  currency: 'USD',
  user: { email: 'jane@example.com' },   // raw — adscapi hashes per platform
  clickIds: { fbclid: '…', gclid: '…' }, // captured server-side
  consent: { adUserData: true, adPersonalization: true },
});

// results: [{ platform: 'meta', ok: true }, { platform: 'tiktok', ok: false, error: '…' }, …]

A platform is active only when its secrets are present. One platform failing never blocks the rest — you get a result per destination.

Full getting-started guide →

Four faces

  • SDK import { createAdscapi } from 'adscapi'. Guides for Node.js, Next.js, and Cloudflare Workers.
  • CLI npx adscapi … for shells and CI.
  • MCP npx adscapi mcp for coding agents. See the MCP guide.
  • Relay — a Cloudflare Worker HTTP endpoint so Python/Ruby/Go backends can POST one event. See any language.

Configure platforms

Set each platform’s tokens in the environment. adscapi platforms lists the exact secret names; each platform guide below says where to get them. Then confirm:

shell
npx adscapi check     # secrets present?
npx adscapi verify    # secrets valid? (calls each platform's API)

Platform setup guides

Where to get each platform’s tokens and how to verify them.

Keep going

Browse the free CAPI tools, or read the source on GitHub.