> Documentation index: https://docs.zernio.com/llms.txt. Every page is also Markdown: add .md to its URL.

# OpenAI pixel

Create an OpenAI pixel with its Conversions API key, read it, manage its conversion events and install it on a site.

An OpenAI pixel measures what people do on your site after a ChatGPT ad, through the platform-neutral [tracking tags API](/guides/pixels) on your `openaiads` account.

## Read the tag

Every OpenAI pixel has two ids, and per-pixel calls accept either as `tagId`:

- `tag.id` is the API resource id (`cds_...`), which conversion event settings name as their source.
- `tag.siteTagId` (also returned as `pixelId`) is the `pixel_id` the on-site code and the Conversions API send.

OpenAI documents no single-pixel read. `GET .../tracking-tags/{tagId}` resolves the pixel from the list, and adds the official `oaiq` base `code` plus the pixel's conversion event settings as `events`.

<Tabs items={['Node.js', 'Python', 'curl']}>
<Tab value="Node.js">
```typescript
const { data } = await zernio.trackingtags.getTrackingTag({
  path: { accountId: '66b2e19d8c3f5a7e9d0b1c2d', tagId: 'cds_68e4f0a1b2c3d4e5f6a7b8c9' }
});
```
</Tab>
<Tab value="Python">
```python
data = client.tracking_tags.get_tracking_tag(
    account_id="66b2e19d8c3f5a7e9d0b1c2d",
    tag_id="cds_68e4f0a1b2c3d4e5f6a7b8c9",
)
```
</Tab>
<Tab value="curl">
```bash
curl "https://zernio.com/api/v1/accounts/66b2e19d8c3f5a7e9d0b1c2d/tracking-tags/cds_68e4f0a1b2c3d4e5f6a7b8c9" \
  -H "Authorization: Bearer $ZERNIO_API_KEY"
```
</Tab>
</Tabs>

Response (`200`):

```json
{
  "platform": "openaiads",
  "tag": {
    "id": "cds_68e4f0a1b2c3d4e5f6a7b8c9",
    "pixelId": "4Kx9TqLm2VbN7wRz1PsYcD",
    "siteTagId": "4Kx9TqLm2VbN7wRz1PsYcD",
    "name": "Acme website",
    "platform": "openaiads",
    "kind": "pixel",
    "status": "active",
    "code": "<script>...oaiq('init', '4Kx9TqLm2VbN7wRz1PsYcD')...</script>",
    "events": [
      { "id": "ces_68e4f0c9d8e7", "name": "Purchases", "type": "order_created", "siteEvent": "purchase", "siteEventId": "order_created", "status": "active", "clickWindowDays": 30 }
    ]
  }
}
```

## Create the pixel

`POST /v1/accounts/{accountId}/tracking-tags` creates an OpenAI pixel and provisions a Conversions API key for it, in one call.

`adAccountId` is required by the endpoint and ignored here, because the API key already selects the ad account.

Pass `defaultEventType` to provision the conversion event setting that `goal: "conversions"` needs. It takes one of the OpenAI standard events listed under [Conversion events](#conversion-events).

<Tabs items={['Node.js', 'Python', 'curl']}>
<Tab value="Node.js">
```typescript
const { data: createdTag } = await zernio.trackingtags.createTrackingTag({
  path: { accountId: '66b2e19d8c3f5a7e9d0b1c2d' },
  body: { adAccountId: 'acct_abc123', name: 'Acme website', defaultEventType: 'order_created' }
});

console.log(createdTag.tag.id);
```
</Tab>
<Tab value="Python">
```python
created_tag = client.tracking_tags.create_tracking_tag(
    account_id="66b2e19d8c3f5a7e9d0b1c2d",
    ad_account_id="acct_abc123",
    name="Acme website",
    default_event_type="order_created",
)

print(created_tag["tag"]["id"])
```
</Tab>
<Tab value="curl">
```bash
curl -X POST "https://zernio.com/api/v1/accounts/66b2e19d8c3f5a7e9d0b1c2d/tracking-tags" \
  -H "Authorization: Bearer $ZERNIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "adAccountId": "acct_abc123", "name": "Acme website", "defaultEventType": "order_created" }'
```
</Tab>
</Tabs>

Response (`201`):

```json
{
  "platform": "openaiads",
  "tag": {
    "id": "cds_68e4f0a1b2c3d4e5f6a7b8c9",
    "pixelId": "4Kx9TqLm2VbN7wRz1PsYcD",
    "siteTagId": "4Kx9TqLm2VbN7wRz1PsYcD",
    "name": "Acme website",
    "platform": "openaiads",
    "kind": "pixel",
    "status": "active"
  }
}
```

<Callout type="warn">
Creating a tag is not idempotent and OpenAI pixels cannot be deleted, so never retry this call automatically. Each call creates another pixel plus another Conversions API key.
</Callout>

If the pixel is created but the key provisioning fails, the pixel stays live on OpenAI and the error names it.

An account holds one Zernio-created pixel, and a second create answers `409`. A timed-out create may still have made it, so list first after a `502`. More pixels are managed in OpenAI Ads Manager.

## Check the pixel fires

`GET .../tracking-tags/{tagId}/stats` returns the latest events OpenAI received, at most 50 from the last 15 minutes. It is a live "is the pixel firing" check, not a history.

- Pixel and Conversions API events both appear there.
- `startTime`/`endTime` answer `400`. Use the ads insights conversion metrics for totals.

## Conversion events

A pixel's conversion event settings are its events. `GET .../tracking-tags/{tagId}/events` lists the ones sourced on the pixel, and `POST` creates one.

The body takes only `name`, `type` and `siteEvent`. The attribution window is OpenAI's fixed 30 days.

`type` is one of:

- an OpenAI standard event: `order_created`, `lead_created`, `items_added`, `contents_viewed`, `checkout_started`, `registration_completed`, `subscription_created`, `trial_started`, `appointment_scheduled`, `page_viewed`, `app_installed`, `app_opened`
- for anything else, the custom event name itself (1 to 64 letters, digits, underscores or dashes, stored lowercase)

`siteEvent` picks the name the [Shopify pixel](/platforms/shopify/tracking-pixels#event-mapping) sends. So `search` and `add_payment_info` become the custom events `search` and `addpaymentinfo`.

<Tabs items={['Node.js', 'Python', 'curl']}>
<Tab value="Node.js">
```typescript
const { data: created } = await zernio.trackingtags.createTrackingTagEvent({
  path: { accountId: '66b2e19d8c3f5a7e9d0b1c2d', tagId: 'cds_68e4f0a1b2c3d4e5f6a7b8c9' },
  body: { name: 'Searches', siteEvent: 'search' }
});
```
</Tab>
<Tab value="Python">
```python
created = client.tracking_tags.create_tracking_tag_event(
    account_id="66b2e19d8c3f5a7e9d0b1c2d",
    tag_id="cds_68e4f0a1b2c3d4e5f6a7b8c9",
    name="Searches",
    site_event="search",
)
```
</Tab>
<Tab value="curl">
```bash
curl -X POST "https://zernio.com/api/v1/accounts/66b2e19d8c3f5a7e9d0b1c2d/tracking-tags/cds_68e4f0a1b2c3d4e5f6a7b8c9/events" \
  -H "Authorization: Bearer $ZERNIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Searches", "siteEvent": "search" }'
```
</Tab>
</Tabs>

Response (`201`):

```json
{
  "platform": "openaiads",
  "event": { "id": "ces_68e4f0d1e2f3", "name": "Searches", "type": "custom", "siteEvent": "search", "siteEventId": "search", "status": "active", "clickWindowDays": 30 }
}
```

Creating an event setting is not idempotent.

## What you cannot change

OpenAI's conversion-setup API documents only list and create. Event updates and deletes answer `501`, and `DELETE` on a pixel answers `405`. The OpenAI endpoints answer `404`/`405` when probed:

| Operation | Why it is not available |
|-----------|-------------------------|
| Update the pixel | `POST`, `PATCH`, `PUT` and `DELETE /v1/conversions/pixels/{id}` answer `405`. Rename it in OpenAI Ads Manager. |
| Share the pixel | A pixel belongs to one ad account. |
| Update an event | `POST`, `PATCH` and `PUT /v1/conversions/event_settings/{id}` answer `404` "Invalid URL". Create a new event instead. |
| Delete an event | No delete or archive endpoint: `DELETE` and `.../archive` answer `404` "Invalid URL". Archive it in OpenAI Ads Manager. |
| Delete the pixel | No delete endpoint, so `DELETE` on the tag answers `405`. |

## Install on a site

`POST .../tracking-tags/{tagId}/install` puts the pixel on a connected [Shopify](/platforms/shopify/tracking-pixels) store or [WordPress](/platforms/wordpress/tracking-pixels) site.

**WordPress** gets the official `oaiq` base code with a `page_viewed` call.

**Shopify** sends each storefront event through OpenAI's documented image tag (`GET https://bzr.openai.com/v1/sdk/events`). Each carries the event id for deduplication, and amounts in the currency's minor unit.

The landing page's `oppref` click id is kept in the `__oppref` cookie for 30 days and sent with every event.

The image tag cannot carry the `__obref` browser id (OpenAI rejects the parameter). Search text is never sent.

## If it fails

| Error | Cause | Fix |
|-------|-------|-----|
| `422` with code `feature_not_available` on a create | The ad account is not enabled for pixel management | Ask your OpenAI partner representative to enable it. |
| `422` with code `feature_not_available` on stats | The ad account is not enabled for the event stream | Ask your OpenAI partner representative, or check conversions in Ads Manager. |
| `409` on a create | The account already has a Zernio-created pixel | Use that pixel, or manage more in OpenAI Ads Manager. |
| `404` on a per-pixel call | Neither id matches a pixel of the ad account | Use `tag.id` or `tag.siteTagId` from the list. |
| `403` with code `insufficient_permissions` | OpenAI rejected the API key as invalid or revoked | Reconnect the OpenAI Ads account with a new key. |
| `501` with code `platform_not_supported` | An update, share, or event delete | Make the change in OpenAI Ads Manager. |
| `405` on `DELETE` of the tag | OpenAI has no pixel delete | Remove the pixel in OpenAI Ads Manager. |

## Related

- [Send a conversion event](/platforms/openai-ads/conversions): server-side events to this pixel.
- [Pixels and tracking tags](/guides/pixels): the pixel API across platforms.
- [Create tracking tag](/tracking-tags/create-tracking-tag): pixels and Conversions API keys.
- [Shopify tracking pixels](/platforms/shopify/tracking-pixels): what the Shopify pixel sends.
- [Create a campaign](/platforms/openai-ads/create-ads#choose-the-conversion-event): optimize for an event.