ChatGPT setup
ads.conversions.track() call fans the event out to ChatGPT server-side — no per-platform code.Setup guide
Overview
adscapi sends server-side events to the OpenAI Ads Conversions API
(POST https://bzr.openai.com/v1/events?pid=<pixel>). Email and external_id are
SHA-256 hashed before they leave your server. There is no phone field. Docs:
OpenAI Ads Conversions API.
Prerequisites
- An OpenAI Ads account.
- A ChatGPT Ads pixel created in the OpenAI Ads dashboard.
1. Create an account
- Go to the OpenAI Ads dashboard and create an advertising account.
- Create a pixel for the site or app you want to measure.
2. Get your credentials
| Secret | Where to get it |
|---|---|
CHATGPT_PIXEL_ID |
OpenAI Ads dashboard → your pixel. This is the pid query parameter on the events endpoint. |
CHATGPT_CAPI_TOKEN |
OpenAI Ads dashboard → Conversions API / pixel settings. Generate an access token and copy it once. Sent as Authorization: Bearer <token>. |
3. Configure adscapi
export CHATGPT_PIXEL_ID="…"
export CHATGPT_CAPI_TOKEN="…"
4. Verify
adscapi verify --platform chatgpt
Send a test purchase and confirm it lands on the pixel. A 401 means the token is
wrong — see Troubleshooting.
5. Event mapping
| Canonical | ChatGPT |
|---|---|
| page_view | page_viewed |
| lead | lead_created |
| signup | registration_completed |
| checkout_created | checkout_started |
| purchase | order_created |
signup_start, reply_generated, and upgrade_clicked have no standard-type fit
and are passed through as-is (or omitted from the name map).
Troubleshooting
HTTP 401— token invalid or expired. RegenerateCHATGPT_CAPI_TOKENin the OpenAI Ads dashboard.- No phone matching — this API has no phone field. Pass raw
user.email(anduser.externalIdif you have one); adscapi hashes them. - Low match / no attribution — send raw email, never pre-hashed, and include
user.ipunder ad-user-data consent.
1. Install adscapi
npm install adscapi # or run without installing: npx adscapi platforms
2. Get ChatGPT's tokens
ChatGPT activates once all of these are set. Run npx adscapi platforms to see them, then get each value from ChatGPT’s ads or events dashboard.
CHATGPT_PIXEL_IDCHATGPT_CAPI_TOKEN3. Set them for adscapi
Export the tokens in the environment that runs your server or the adscapi CLI.
export CHATGPT_PIXEL_ID="…" export CHATGPT_CAPI_TOKEN="…"
4. Verify
check confirms the secrets are present; verify calls ChatGPT’s API to confirm they are valid.
npx adscapi check npx adscapi verify --platform chatgpt
5. Track a conversion
One call, sent to ChatGPT and every other configured platform. Pass raw email — adscapi hashes per platform. Consent is required.
import { createAdscapi } from 'adscapi';
const ads = createAdscapi();
const results = await ads.conversions.track({
name: 'purchase',
value: 49,
currency: 'USD',
user: { email: 'buyer@example.com' },
consent: { adUserData: true, adPersonalization: true },
});See the exact request on the ChatGPT payload preview.