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
opprefby 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:
- Open a private (incognito) window and open developer tools (F12) on the Network tab. Tick Preserve log so redirects stay visible.
- 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.) - Look at the first requests in the Network list. If you see a
301,302,307or308redirect, click it and check the Location header: does the new address still containoppref=test123? If not, the redirect drops the click ID before any script on your site runs. - Accept the cookie banner and wait a few seconds.
- Open the Application tab (Chrome) or Storage tab (Firefox), then Cookies for your domain, and find
__oppref. It should holdtest123. You should also see__obref, the pixel’s browser reference. - Filter the Network tab by
bzr.openai.comand open a request: the payload should carryopprefwith 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.
- 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 withoutwww) and path (with or without the trailing slash) your site ends up on. - Check redirect rules at your host, CDN or server (
httptohttps, non-wwwtowwwor 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
opprefthrough.
- Make your ads link straight to the final address: the exact protocol (
- Make sure the pixel runs on the landing page after consent. The pixel reads
oppreffrom 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 hasoppref), the click ID is never stored. See “OpenAI Pixel does not fire after consent”. - Do not withdraw consent for visitors who already agreed. OpenAI documents that
oaiq("consent", false)removes both pixel cookies,__opprefincluded. 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 passtruestraight away for those who accepted. - 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 keepoppref. - Check that your consent tool is not deleting the cookie. Some consent tools remove marketing cookies they do not recognize. After Accept,
__opprefshould stay. - Pass the click ID to your server events. For the Conversions API, read the value (from the landing page URL or the
__opprefcookie, after consent), keep it with the visit or the order, and send the original string unchanged asopprefon the server event. For hybrid setups OpenAI also asks you to send the__obrefcookie value asuser.obref.
Common causes
- A redirect without the query string:
httptohttps, addingwww, 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
- Repeat the test above: no redirect drops
?oppref=test123, and after accepting cookies__opprefholdstest123. - Open another page on your site:
__opprefis still there, and the pixel’s requests still carryoppref. - 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
- OpenAI Developers, Measurement Pixel (captures
oppreffrom the landing page URL, stores it in the first-party__opprefcookie for 30 days,__obrefbrowser reference, cookies used when consent is granted,oaiq("consent", false)removes both cookies, place the script near the top of the<head>): https://developers.openai.com/ads/measurement-pixel - OpenAI Developers, Conversions API (
opprefis not captured by the API, pass the original string;user.obreffrom the__obrefcookie): https://developers.openai.com/ads/conversions-api - OpenAI Developers, Conversion Tracking (include matching information: capture
opprefand include it on the server event): https://developers.openai.com/ads/conversion-tracking
More OpenAI guides
- OpenAI Pixel fires before cookie consent: how to fix it
- OpenAI Pixel not firing after cookie consent: how to fix it
- Repeated OpenAI event IDs drop ChatGPT Ads conversions
- Duplicate OpenAI Pixel events: how to find and remove them
- OpenAI Pixel event_id missing: fix ChatGPT Ads deduplication
- OpenAI Pixel tracks a button on desktop but not on mobile
- Two OpenAI Pixel IDs on one site: when it's fine, how to fix
- OpenAI Conversions API deduplication: match the pixel event_id
- OpenAI Ads Pixel setup: install the ChatGPT Measurement Pixel
- How to set up the OpenAI Conversions API for ChatGPT Ads