How to Set Up OpenAI Ads Conversion Tracking: Pixel, Conversions API, and Event Structure

| Zafer Kavaklı

How to Set Up OpenAI Ads Conversion Tracking: Pixel, Conversions API, and Event Structure

To evaluate performance accurately in OpenAI Ads campaigns, it is not enough to review only impression, click, and spend data. You also need to measure whether users viewed a product, added an item to their cart, started checkout, or completed a purchase after clicking an ad.

For this reason, OpenAI Ads conversion tracking is a technical but critical component of campaign setup.

OpenAI provides two primary methods for conversion measurement:

  • Measurement Pixel
  • Conversions API

The Measurement Pixel is a JavaScript-based tracking structure that runs in the browser. The Conversions API is used to send conversion events to OpenAI from the server.

The difference between the Measurement Pixel and Conversions API

Measurement method Where does it run? Use case When should it be used?
Measurement Pixel Browser / website Browser events such as page views, product views, add-to-cart actions, and checkout activity For standard website event tracking
Conversions API Server side Purchases, leads, server-side checkout, offline events, or more reliable event delivery For critical conversions and server-side measurement
Pixel + Conversions API Browser + server Stronger and more reliable measurement Recommended for e-commerce and performance campaigns

For e-commerce brands, the most effective approach is generally to use the Pixel and Conversions API together. While the Pixel measures web interactions throughout the user journey, the Conversions API helps transmit critical events such as purchases more reliably.

Strategic recommendation: Rather than tracking the purchase event only in the browser, it is generally more reliable to send it server-side as well. However, when the same conversion is sent through both the Pixel and Conversions API, the same event_id should be used for deduplication.

Which events should be tracked for OpenAI Ads?

OpenAI Ads uses a standard event taxonomy. The most important events for e-commerce brands generally include:

Event name Data type Use case
page_viewed contents When a user views an important page
contents_viewed contents When a user views a product, category, content item, or listing
items_added contents When a user adds a product to the cart
checkout_started contents When a user begins the checkout process
order_created contents When a purchase is completed
lead_created customer_action When a user submits a form or becomes a lead
registration_completed customer_action When a user completes an account or registration process
custom custom For actions that are not covered by standard events

The following event flow can be recommended as the minimum setup for e-commerce:

  1. page_viewed
  2. contents_viewed
  3. items_added
  4. checkout_started
  5. order_created

Brands focused on lead generation can use lead_created. The appointment_scheduled event can be used for demo or appointment flows, while subscription businesses can use subscription_created or trial_started.

How to install the OpenAI Measurement Pixel

To install the Measurement Pixel, create a Pixel ID from the Conversions section in OpenAI Ads Manager. Then add a pixel code similar to the following to every page of your website.

Basic installation example:

<script>
  (function (w, d, s, u) {
    if (w.oaiq) return;
    var q = function () {
      q.q.push(arguments);
    };
    q.q = [];
    w.oaiq = q;
    var js = d.createElement(s);
    js.async = true;
    js.src = u;
    var f = d.getElementsByTagName(s)[0];
    f.parentNode.insertBefore(js, f);
  })(window, document, "script", "https://bzrcdn.openai.com/sdk/oaiq.min.js");

  oaiq("init", {
    pixelId: "YOUR_PIXEL_ID"
  });
</script>

It is recommended to place this code in the <head> section so that it runs as early as possible. It can also be installed through Google Tag Manager, but the tag manager configuration should not prevent the Pixel from loading or event calls from firing.

How should user data be sent?

The user object is optional in the OpenAI Pixel setup. When user information is available, it can be used to improve conversion matching. However, raw email addresses or raw customer IDs should not be submitted. Fields such as email and external ID should be sent as SHA-256 hashes.

Example:

oaiq("init", {
  pixelId: "YOUR_PIXEL_ID",
  user: {
    email_sha256: "HASHED_EMAIL_VALUE",
    external_id_sha256: "HASHED_EXTERNAL_ID",
    country: "TR",
    city: "istanbul",
    zip_code: "34000"
  }
});

Key considerations include:

  • The user’s email address should not be submitted as plain text.
  • A raw customer ID should not be submitted.
  • Hash values should be lowercase, 64-character hexadecimal strings.
  • User data should be processed in compliance with applicable GDPR and local data protection requirements.
  • Personal data that is not required should not be submitted.

Product view event example

When a user views a product detail page, the contents_viewed event is sent.

oaiq("measure", "contents_viewed", {
  type: "contents",
  contents: [
    {
      id: "SKU12345",
      name: "Strappy Midi-Length Summer Linen Women's Dress",
      content_type: "product"
    }
  ]
});

The id field must match the product ID in the product feed. When the item_id used to identify a product in the OpenAI product feed is consistent with the product ID submitted in conversion events, product-level analysis becomes more reliable. This also makes it easier to associate users with the correct products.

Add-to-cart event example

When a user adds a product to the cart, the items_added event is sent.

oaiq("measure", "items_added", {
  type: "contents",
  amount: 249900,
  currency: "TRY",
  contents: [
    {
      id: "SKU12345",
      name: "Strappy Midi-Length Summer Linen Women's Dress",
      content_type: "product",
      quantity: 1,
      amount: 249900,
      currency: "TRY"
    }
  ]
});

In the OpenAI event structure, monetary values should be submitted as integers using the ISO 4217 minor unit format. For example, the value 249900 can be used for TRY 2,499.00.

Checkout started event example

When a user begins the checkout process, the checkout_started event is sent.

oaiq("measure", "checkout_started", {
  type: "contents",
  amount: 249900,
  currency: "TRY",
  contents: [
    {
      id: "SKU12345",
      name: "Strappy Midi-Length Summer Linen Women's Dress",
      content_type: "product",
      quantity: 1
    }
  ]
});

This event represents one of the most important steps before a purchase. If advertising traffic reaches the product page but users do not start checkout, the problem may relate to the product price, availability, variant selection, delivery information, or landing page trust signals.

Purchase / order_created event example

When a purchase is completed, the order_created event is sent.

Example code that should run when a user purchases one product:

oaiq(
  "measure",
  "order_created",
  {
    type: "contents",
    amount: 249900,
    currency: "TRY",
    contents: [
      {
        id: "SKU12345",
        name: "Strappy Midi-Length Summer Linen Women's Dress",
        content_type: "product",
        quantity: 1
      }
    ]
  },
  {
    event_id: "ORDER98765"
  }
);

How should the order_created event be sent when multiple products are purchased?

When multiple products are purchased in one order, the order_created event should be submitted as a single order event. Every purchased item should be included as a separate object within the contents array.

The total order value can be submitted in the top-level amount field, while item-level quantity and monetary values can be included within each product object. Product IDs should match the item_id values used in the product feed.

oaiq(
  "measure",
  "order_created",
  {
    type: "contents",
    amount: 519700,
    currency: "TRY",
    contents: [
      {
        id: "SKU12345",
        name: "Strappy Midi-Length Summer Linen Women's Dress",
        content_type: "product",
        quantity: 1,
        amount: 249900,
        currency: "TRY"
      },
      {
        id: "SKU67890",
        name: "Women's Straw Shoulder Bag",
        content_type: "product",
        quantity: 1,
        amount: 189900,
        currency: "TRY"
      },
      {
        id: "SKU24680",
        name: "Minimalist Gold-Tone Earrings",
        content_type: "product",
        quantity: 2,
        amount: 79900,
        currency: "TRY"
      }
    ]
  },
  {
    event_id: "ORDER98765"
  }
);

In this example, the total order value is submitted as 519700. Because OpenAI monetary values use the minor unit format, this represents TRY 5,197.00. Item-level amount values should be submitted in the same format. In this example, the 79900 value represents the total line value of TRY 799.00 for the two earrings.

The most important point is that each product should be submitted as a separate object within the contents array. If multiple units of the same product were purchased, the quantity value can be increased within a single product object.

Strategic note: Product ID matching becomes even more important in orders containing multiple products. If some products in an order do not match the item_id values in the product feed, product-level performance analysis may remain incomplete. Product ID mapping should therefore be tested during the implementation of checkout and order events.

event_id is important for deduplication when the same conversion is sent through both the Pixel and Conversions API. The same event_id should be used for the browser-side and server-side versions of the same purchase.

How should the amount value be sent in the OpenAI Pixel?

In the OpenAI Ads Pixel event structure, the amount field is not submitted as a decimal product price. It is sent as an integer using the smallest unit of the currency.

Because the minor unit of the Turkish lira is the kuruş, the actual amount is multiplied by 100.

For example, a product or order worth TRY 2,499.00 should be submitted as follows:

amount: 249900,
currency: "TRY"

The value 249900 does not mean TRY 249,900. It represents 249,900 kuruş, which is equal to TRY 2,499.00.

Actual amount amount sent to OpenAI
TRY 24.99 2499
TRY 249.90 24990
TRY 2,499.00 249900
TRY 249,900.00 24990000

Correct usage example:

oaiq("measure", "order_created", {
  type: "contents",
  amount: 249900,
  currency: "TRY"
});

Instead of submitting a decimal value such as amount: 2499.00, the amount should be converted into kuruş and submitted as an integer.

Field Description
amount The total order value. It should be submitted in minor unit format.
currency The order currency, such as TRY, USD, or EUR.
contents The array containing the products included in the order.
contents[].id The product ID. It should match the item_id in the product feed.
contents[].quantity Indicates how many units of the product were purchased.
contents[].amount The item-level monetary value. It should be submitted in minor unit format.
event_id The unique event ID for the order. When the Pixel and Conversions API are used together, the same value should be submitted for deduplication.

How does the Conversions API work?

The Conversions API allows events to be sent directly from the server to OpenAI. This structure can provide more reliable measurement, especially for purchases, leads, and server-side checkout events. It is also possible to send all relevant OpenAI conversion events through the Conversions API.

Basic Conversions API request example:

curl -X POST "https://bzr.openai.com/v1/events?pid=YOUR_PIXEL_ID" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "validate_only": false,
    "events": [
      {
        "id": "ORDER98765",
        "type": "order_created",
        "timestamp_ms": 1773892800000,
        "source_url": "https://www.example.com/checkout/confirmation",
        "action_source": "web",
        "user": {
          "email_sha256": "HASHED_EMAIL_VALUE",
          "external_id_sha256": "HASHED_EXTERNAL_ID",
          "country": "TR",
          "city": "istanbul",
          "zip_code": "34746",
          "ip_address": "203.0.113.1",
          "user_agent": "Mozilla/5.0"
        },
        "data": {
          "type": "contents",
          "amount": 249900,
          "currency": "TRY",
          "contents": [
            {
              "id": "SKU12345",
              "name": "Strappy Midi-Length Summer Linen Women's Dress",
              "content_type": "product",
              "quantity": 1
            }
          ]
        }
      }
    ]
  }'

Key considerations when using the Conversions API include:

  • Events should be submitted only from the server.
  • The API key should not be used in client-side code.
  • timestamp_ms should represent the correct event time.
  • source_url should be included for web events.
  • action_source should use an appropriate value such as web, mobile_app, offline, physical_store, phone_call, email, or other.
  • The user object should be submitted at the event level.
  • If the same event is also sent through the Pixel, the same ID should be used for deduplication.

Why is oppref important?

The OpenAI Pixel can capture the oppref value from the landing page URL and store it in a first-party cookie. The Conversions API does not capture this value automatically. If you send server-side events, capturing the available oppref value and including it with the server event is important for attribution quality.

This field can easily be overlooked in headless commerce, custom Shopify checkout, server-side purchase, or backend order confirmation structures.

Why is catalog match rate important in this setup?

Sending events alone is not sufficient for OpenAI Ads conversion tracking. The product IDs within events should be consistent with the product IDs in the product feed.

For example, if the product ID in the product feed is:

item_id = SKU12345

The following ID should be submitted for the same product in the conversion event:

{
  "id": "SKU12345",
  "content_type": "product"
}

If the item_id in the feed differs from the contents[].id submitted in the event, the product match rate may decrease or the product may not match at all.

This should be considered together with the general concept of catalog match rate. Maintaining consistent product IDs across the advertising platform, product feed, website, analytics system, and conversion events is critical for performance measurement. To explore this topic in more detail, read What Is Product Match Rate? How to Improve Catalog Match Rate.

Strategic recommendation: Before implementing OpenAI Ads conversion tracking, create a product ID mapping document. Confirm that the feed item_id, website product ID, SKU, GA4 item_id, and conversion event contents[].id all represent the same product.

How should product ID matching be structured within events?

The recommended ID matching structure for e-commerce brands is:

System / field Recommended value
Product feed product ID item_id = SKU12345
Website product ID SKU12345
GA4 item_id SKU12345
Pixel contents[].id SKU12345
Conversions API contents[].id SKU12345
Product ID within the order SKU12345

When this structure is implemented, ad clicks, product views, add-to-cart actions, and purchase events can be analyzed more easily using the same product identity.

When should a custom event be used?

Standard events should be prioritized whenever possible in OpenAI Ads. However, the custom event can be used when measuring an action that is not represented in the standard event structure.

Example:

oaiq(
  "measure",
  "custom",
  { type: "custom" },
  { custom_event_name: "size_guide_opened" }
);

Key considerations when using custom events include:

  • The event name should contain between 1 and 64 characters.
  • It should contain letters, numbers, underscores, or dashes.
  • It should not duplicate a standard event name.
  • Lowercase and consistent naming should be preferred.
  • The custom event name should match exactly in Ads Manager.

Common mistakes in Pixel and Conversions API setup

Mistake Impact
Entering the wrong Pixel ID Events may be sent to the wrong account
Not loading the Pixel on every relevant page The user journey is measured incompletely
Running the purchase event only browser-side on the thank-you page Browser restrictions may cause event loss
Using the API key in client-side code Creates a security risk
Using different event IDs for the Pixel and API The same conversion may be counted twice
Using different values for contents[].id and the feed item_id Product matching quality may decrease
Submitting the amount as a decimal May cause a formatting error
Omitting the currency field Monetary values may not be processed correctly
The custom event name does not match the name in Ads Manager The conversion may appear as zero in reporting
Failing to send oppref with a server-side event Attribution quality may decrease

How can Optifeed support this process?

Optifeed is an AI-powered product feed optimization platform that helps e-commerce brands prepare their product data for advertising platforms and AI shopping experiences.

Installing the Pixel or Conversions API alone is not sufficient for OpenAI Ads conversion tracking. Product IDs must remain consistent across the product feed, website, GA4, and conversion events. Optifeed can support brands with product ID mapping, product feed cleanup, price and availability freshness, product segmentation, and catalog match rate improvement.

With Optifeed, brands can:

  • Organize the item_id structure in the product feed.
  • Align product IDs with advertising and analytics events.
  • Keep price, availability, and variant information current.
  • Segment products based on performance, availability, or category signals.
  • Create cleaner product data for AI shopping and OpenAI Ads.
  • Identify and improve catalog match rate problems.

Regardless of how effectively conversion tracking is implemented, performance analysis will remain incomplete if product matching is weak. Measurement setup and product feed quality should therefore be evaluated together.

About the author
Zafer Kavaklı - Optifeed

Zafer Kavaklı

Co-Founder at Optifeed

Zafer Kavaklı is co-founder of Woom Digital and Optifeed. He is an experienced digital marketer who has been working in the field since 2012. He started his career as a digital marketing intern at Teknosa and then worked at Modanisa as a digital marketing specialist. After that he worked as digital marketing manager at ebebek. Following these roles, he ventured into entrepreneurship by establishing his own performance marketing agency named Woom Digital. Zafer has embarked on a new business venture in the SaaS sector, creating a product management tool named Optifeed.