In short: The OpenAI pixel is the tracking code that makes ChatGPT Ads measurable: A small JavaScript snippet in the HTML head that captures the click ID from the ad link, stores it in first-party cookies and connects later conversions back to the ad. Without it you see clicks but never what they became, and you cannot use conversion objectives in your campaigns. This guide walks through the full setup exactly the way we just did it on our own website: Installation, events, conversion events in Ads Manager, consent under the GDPR and verification. Set it up before you spend budget, not after.

What the pixel does, in plain terms

When someone clicks your ad in ChatGPT, a click ID is attached to the link as a query parameter called oppref. The pixel on your website captures that ID on landing and stores it in a first-party cookie that lives for 30 days. When the same visitor later converts, the pixel sends an event to OpenAI together with the click ID, and Ads Manager can then show which campaign, ad group and ad created the conversion. That is the whole mechanism, and it also explains the two most important practical rules: The pixel must be on every page, since the ad can land anywhere, and nothing in your user journey may strip query parameters from the URL.

Step 1: Get the setup code in Ads Manager

Under Conversions in Ads Manager you set up your data source. There you find two things: The pixel ID, a short string identifying your account, and the setup code itself. OpenAI's instruction is precise: Place the script in the HTML head of the website, preferably near the top, and only one setup script per page. The code loads the SDK asynchronously and initializes it with your pixel ID.

A couple of practical tips from our own round: Put the pixel ID in your configuration instead of hardcoding it in templates, so you can change it in one place if needed. And if the code you copy contains debug:true, that is a test setting: Keep it while you verify, it logs what the pixel does in the browser console, but remove it before production.

Step 2: Install it properly, which means with consent in order

The pixel sets cookies, and in Europe that is a consent matter. The two cookies you need to know:

CookieWhat it doesDuration
__opprefStores the click ID from the ad link30 days
__obrefRandom browser reference for conversion measurement1 year

That means three concrete obligations. The pixel belongs in the marketing category of your cookie banner, together with the Google Ads cookies, and should only load after consent where you run consent-based tracking. The cookies must be documented in your privacy policy's cookie table, with name, purpose and duration. And if the user withdraws consent, the cookies must be deleted. When we installed the pixel on synlig.ai, we did all three parts in the same job as the installation itself, and we recommend that package: Tracking and documentation are one deliverable, not two.

Step 3: Fire events when something actually happens

The setup code alone measures nothing. The conversions come from event calls you place where something valuable happens, with a standardized event name. OpenAI has defined standard events including lead_created, appointment_scheduled, checkout_started, items_added and contents_viewed, plus custom for everything else. A call looks like this:

oaiq("measure", "appointment_scheduled", { type: "customer_action" });

The most important rule is in the heading: Fire the event when the conversion is actually completed, never before. Not on the button click, not when the form opens, not on the booking page view, but when the booking is confirmed. Our own setup is a concrete example: Our booking calendar is embedded on dedicated booking pages, and only when the calendar confirms a completed booking do we fire appointment_scheduled. Clicks on the Book button are measured separately in GA4 as a micro conversion, but that signal is never sent to the ad platform as a conversion.

Two technical details: Make sure the same conversion cannot fire twice, for example with a simple flag in the code, and wrap the call in a check that the pixel is actually loaded, since with a consent-based setup it does not exist until the user has said yes.

Step 4: Create conversion events in Ads Manager

Back in Ads Manager you create conversion events built on the base events from the pixel: You name the conversion, choose which base event it listens to, and connect it to campaigns. These conversions are what the reports and the bidding use.

One choice is worth thinking through here: If you have several distinct conversions, give them distinct base events. If you use appointment_scheduled for two different booking types, for example, both conversion events can count the same bookings, and the report stops separating them. Use the standard events where they fit, and custom events with their own names where you need finer distinctions.

Step 5: Verify that everything works

Do not wait for the reports to find out whether the setup works. Three checks take five minutes:

  1. The network tab in your browser. Open the developer tools, load a page, and look for three calls: The SDK oaiq.min.js, a pixel-config lookup confirming that your pixel ID is valid, and event calls to v1/sdk/events.
  2. A test conversion. Visit your site with a test parameter in the URL, complete the conversion, and confirm that the event call goes out the moment it completes, not before.
  3. The event stream in Ads Manager. Under Conversions you find the event stream view, showing events as they arrive. That is the final proof that data actually reaches OpenAI.

Attribution: Do not sabotage yourself

Attribution rests on the oppref parameter surviving the landing. Two traps recur: Redirects that strip query parameters, for example a hard redirect from http to https or from a campaign URL to a "clean" URL, and consent setups that load the pixel so late that the landing page has already been left. So always run a test from ad click to conversion after changing redirects or your cookie banner. And keep using UTM parameters on the ad links as well: The pixel gives OpenAI their numbers, UTM gives you your own in GA4, and you want both when comparing channels.

The Conversions API, briefly

Next to the pixel tab in Ads Manager you find the Conversions API: The server-to-server variant where your systems send events directly to OpenAI instead of via the browser. It is more robust against ad blockers and necessary for conversions that happen outside the website, for example when a lead becomes a customer in your CRM weeks later. Our recommendation is pragmatic: Start with the pixel, it covers most needs, and add the API when you have conversions the browser cannot see.

Where to go next

With the pixel in place you can switch campaign objectives to conversions and let the system optimize toward what actually creates value, a choice we walk through in the guide on buying models and budget. Who the ads reach is steered with context hints, and the other half of the data strategy, customer lists, lives in the guide on custom audiences. The full setup from account to first campaign is in the step by step guide, and the big picture in the pillar guide on AI advertising.