Fix guide · Any website · medium · about 30 min

ChatGPT Ads click ID (oppref) lost after an ad click

For the finding “Click ID from OpenAI ads is not stored”. Also for: Shopify, WordPress, Webflow, Framer.

What this means

When someone clicks an ad in ChatGPT, the link to your site carries an attribution identifier in the oppref URL parameter. The OpenAI Pixel is supposed to pick it up on the landing page, store it in a first-party cookie called __oppref, and send it with later events, so that a lead or purchase on another page can still be tied to the ad click.

On your site, the click ID did not make it: it was not stored, or not sent with the pixel’s events.

Why it costs you money:

  • Conversions lose their link to the ChatGPT ad click, so ChatGPT Ads reports fewer conversions than your ads really brought.
  • Conversion-optimized campaigns learn from fewer attributed conversions and may optimize toward the wrong results.
  • If you send server events through the OpenAI Conversions API, OpenAI notes that the API does not capture oppref by itself; your server has to pass it on. If it is missing in the browser, it is usually missing on the server too.

How to confirm it yourself

Our check opens your page in a browser in the EU as if arriving from a ChatGPT ad, with a test click ID in the URL, accepts the cookie banner, and then looks for the click ID. If our report shows a redirect chain, look at it first: it often shows exactly where the parameter was dropped.

To repeat this yourself:

  1. Open a private (incognito) window and open developer tools (F12) on the Network tab. Tick Preserve log so redirects stay visible.
  2. Open your page with a made-up click ID added, for example https://example.com/?oppref=test123. (This sends a normal page view to your own pixel. It does not create an ad click.)
  3. Look at the first requests in the Network list. If you see a 301, 302, 307 or 308 redirect, click it and check the Location header: does the new address still contain oppref=test123? If not, the redirect drops the click ID before any script on your site runs.
  4. Accept the cookie banner and wait a few seconds.
  5. Open the Application tab (Chrome) or Storage tab (Firefox), then Cookies for your domain, and find __oppref. It should hold test123. You should also see __obref, the pixel’s browser reference.
  6. Filter the Network tab by bzr.openai.com and open a request: the payload should carry oppref with your test value.

If __oppref is missing, or holds something else, the click ID is being lost.

How to fix

Work through the chain: the link must arrive with oppref, the pixel must run on that page with consent, and nothing may delete the cookie afterwards.

  1. Fix redirects that drop the query string. This is the most common cause, and it happens before any tracking code can run.
    • Make your ads link straight to the final address: the exact protocol (https), host (with or without www) and path (with or without the trailing slash) your site ends up on.
    • Check redirect rules at your host, CDN or server (http to https, non-www to www or back, old paths to new ones, language or country redirects). Each rule should keep the query string; many tools call this “preserve query string” or “forward parameters”.
    • Avoid link shorteners and tracking redirectors in ad URLs unless you have tested that they pass oppref through.
  2. Make sure the pixel runs on the landing page after consent. The pixel reads oppref from the address of the page where it runs, and OpenAI says it uses its cookies only when measurement consent is granted. If the pixel waits for consent and does not start after the visitor accepts, or only starts on the next page (where the URL no longer has oppref), the click ID is never stored. See “OpenAI Pixel does not fire after consent”.
  3. Do not withdraw consent for visitors who already agreed. OpenAI documents that oaiq("consent", false) removes both pixel cookies, __oppref included. If your code calls it at the top of every page and switches consent back on a moment later, the stored click ID is deleted on every page after the landing page. Read the visitor’s stored choice from your consent tool and pass true straight away for those who accepted.
  4. Check that nothing rewrites the URL first. Some sites, single-page apps and “clean URL” scripts strip unknown parameters from the address bar on load. If the pixel loads after that, it never sees oppref. Load the pixel early in the <head>, as OpenAI recommends, or let the cleanup keep oppref.
  5. Check that your consent tool is not deleting the cookie. Some consent tools remove marketing cookies they do not recognize. After Accept, __oppref should stay.
  6. Pass the click ID to your server events. For the Conversions API, read the value (from the landing page URL or the __oppref cookie, after consent), keep it with the visit or the order, and send the original string unchanged as oppref on the server event. For hybrid setups OpenAI also asks you to send the __obref cookie value as user.obref.

Common causes

  • A redirect without the query string: http to https, adding www, adding a trailing slash, or a language redirect.
  • A link shortener or tracking redirect in the ad URL.
  • The pixel waits for consent and does not fire after Accept, or only fires on the next page.
  • oaiq("consent", false) runs on every page, so the cookie is removed again and again.
  • A script strips query parameters before the pixel reads them.
  • The server sends Conversions API events without oppref.

How to verify the fix

  1. Repeat the test above: no redirect drops ?oppref=test123, and after accepting cookies __oppref holds test123.
  2. Open another page on your site: __oppref is still there, and the pixel’s requests still carry oppref.
  3. Re-run the check on IsPixelWorking. The issue should be gone, and the redirect chain in the report (if any) should keep the click ID.

Sources

More OpenAI guides