Fix guide · WordPress · medium · about 45 min
ChatGPT Ads click ID (oppref) lost on WordPress
For the finding “Click ID from OpenAI ads is not stored”. Also for: Any website, Shopify, 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 (the ChatGPT Ads Measurement Pixel) should pick it up on the landing page, store it in the first-party cookie __oppref and send it with later events, so a lead or a WooCommerce order on another page can still be tied to the ad click. On your site, the click ID did not make it.
Why it costs you money:
- Conversions lose their link to the ChatGPT ad click, so ChatGPT Ads reports fewer conversions than your ads brought.
- Conversion-optimized campaigns learn from fewer attributed conversions.
- If you send server events through the OpenAI Conversions API, OpenAI notes that the API does not capture
opprefby itself. Your plugin or server has to pass it on, and if it is missing in the browser, it is usually missing there 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 looks for the click ID. If our report shows a redirect chain, start there.
- Log out of WordPress or use a private (incognito) window. Some plugins that remove URL parameters skip logged-in users, so you would not see the problem while logged in.
- Open developer tools (F12) on the Network tab and tick Preserve log, so redirects stay visible.
- Open the exact URL your ads use, with a made-up click ID added:
https://yourdomain.com/landing-page/?oppref=test123. (This sends a normal page view to your own pixel. It does not create an ad click.) - If the first request is a redirect (
301,302,307,308), check its Location header. Does the new address still containoppref=test123? - Accept the cookie banner, wait a few seconds, then open Application > Cookies (Chrome) or Storage > Cookies (Firefox).
__opprefshould holdtest123, and__obref(the pixel’s browser reference) should be there too. - Filter the Network tab by
bzr.openai.comand open a request: the payload should carryopprefwith your test value.
How to fix
The link must arrive with oppref, the pixel must run on that page with consent, and nothing may delete the cookie afterwards.
-
Link your ads to the final address. WordPress redirects other versions of an address to its canonical one: the
httporhttpsandwwwor non-wwwversion set in Settings > General (WordPress Address and Site Address), and the trailing slash your permalink structure in Settings > Permalinks uses. Use that exact address in every ad, so visitors land without a redirect. -
Check the Redirection plugin, if you use it (Tools > Redirection). Each redirect has a query parameter setting:
- Exact (the default) only matches the query you entered, so an ad URL with
opprefmay not be redirected at all; - Ignore matches but drops the parameters;
- Pass matches and passes the parameters on to the target.
For any redirect your ads go through, choose Pass. The default for new redirects is Default query matching under Tools > Redirection > Options.
- Exact (the default) only matches the query you entered, so an ad URL with
-
Check URL cleanup in your SEO plugin. Yoast SEO’s URL cleanup option (in its Crawl optimization settings) redirects away all unregistered URL parameters. Of those, it only ever keeps
gclidandutm_parameters, soopprefis stripped. It does not remove anything for logged-in users, which is why you may not have noticed. If it is on, addopprefto the parameters you want to keep, or turn the cleanup off. Check any other SEO, security or caching plugin with a “remove query strings” or “clean URLs” option the same way. -
Check language redirects. WPML’s Browser language redirect (WPML > Settings > URLs and SEO) sends visitors to the version in their browser’s language, and Polylang’s Detect browser language option redirects first-time visitors of the home page. WPML redirects with JavaScript in the browser, so you see the address change rather than a
301or302. Test your ad URL with a browser set to another language. If the redirect dropsoppref, link your ads straight to the language version your audience should land on. -
Check redirects outside WordPress: rules in your hosting panel or
.htaccessfile, your CDN, a domain forwarding service, link shorteners or campaign link tools in front of the site. -
Make sure the pixel runs on the landing page after consent. The pixel reads
oppreffrom the address of the page it runs on, and OpenAI says it uses its cookies only when measurement consent is granted. If your consent plugin does not release the OpenAI code right after Accept, or an optimization plugin delays it until the visitor interacts, the pixel may only start on the next page, where the address no longer hasoppref. See the WordPress guide to “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 snippet 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 stored choice first, for example from the WP Consent API cookiewp_consent_marketing, and passtruestraight away for visitors who accepted. The WordPress guide to “OpenAI Pixel fires before cookie consent” has a snippet that does this. -
Check that your consent plugin keeps the cookie. After you click Accept,
__opprefshould still be there on the next page. -
Pass the click ID to your server events. OpenAI asks you to send the original
opprefstring unchanged on Conversions API events, and the__obrefvalue asuser.obrefin hybrid setups.- Pixel Manager for WooCommerce (Pro) documents that it captures
opprefon the landing page, keeps it through checkout and attaches it to every Conversions API event, and sends__obrefasuser.obrefwhile marketing consent is granted. - PixelBridge says it preserves
opprefandobref. For PixelYourSite and other plugins, check their documentation or ask their support. - Your own code: read the value after consent, save it with the order (for example as order meta), and send it with the server event.
- Pixel Manager for WooCommerce (Pro) documents that it captures
-
Clear every cache (plugin, host and CDN) after changing redirects or settings, then test again while logged out.
Common causes
- Yoast SEO’s URL cleanup (or a similar option in another plugin) redirects
opprefaway. - A redirect in the Redirection plugin is set to Ignore or Exact instead of Pass.
- Ads link to an old page, the non-canonical domain or a short link whose redirect drops the query string.
- A language redirect sends visitors to another URL without
oppref. - The pixel only starts on the next page after consent, often because the consent plugin or an optimization plugin holds it back.
oaiq("consent", false)runs on every page, so the cookie is removed again and again.- The plugin or code that sends Conversions API events does not pass
oppref.
How to verify the fix
- Repeat the test above with the exact ad URL, logged out: no redirect drops
?oppref=test123, and after accepting cookies__opprefholdstest123. - Open another page of the 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.
Questions people ask
What is oppref in my URL?
It is the attribution identifier that ChatGPT ads add to the link. OpenAI’s pixel stores it in the __oppref cookie for 30 days so later conversions can be tied to the click. Do not strip it from ad landing pages.
Sources
- OpenAI Developers, Measurement Pixel (captures
oppreffrom the landing page URL,__opprefcookie for 30 days,__obref, cookies used when consent is granted,oaiq("consent", false)removes both cookies): https://developers.openai.com/ads/measurement-pixel - OpenAI Developers, Conversions API (
opprefnot captured by the API, pass the original string;user.obref): https://developers.openai.com/ads/conversions-api - WordPress Developer Resources,
redirect_canonical(): https://developer.wordpress.org/reference/functions/redirect_canonical/ - Redirection, Matching a URL (query parameters: exact, ignore, pass): https://redirection.me/support/matching-a-url/
- Redirection, Options (default query matching): https://redirection.me/support/options/
- Yoast, Advanced crawl optimization settings: URL cleanup (parameters never removed, logged-in users): https://yoast.com/help/advanced-crawl-settings-permalink-cleanup/
- WPML, Automatic redirect based on browser language (WPML > Settings > URLs and SEO, redirect done with JavaScript): https://wpml.org/documentation/getting-started-guide/language-setup/automatic-redirect-based-on-browser-language/
- Polylang, Detect the browser preferred language: https://polylang.pro/documentation/support/guides/detect-the-browser-preferred-language/
- WP Consent API source,
wp-consent-api.js(cookie name): https://plugins.svn.wordpress.org/wp-consent-api/trunk/assets/js/wp-consent-api.js - SweetCode, Pixel Manager: OpenAI (ChatGPT click reference, browser reference): https://sweetcode.com/docs/pmw/plugin-configuration/openai
- WordPress.org, PixelBridge: ChatGPT Ads Pixel Tracking (preserves
opprefandobref): https://wordpress.org/plugins/pixelbridge-ads-tracking-for-openai/ - WP Rocket Knowledge Base, Delay JavaScript execution (scripts wait for user interaction): https://docs.wp-rocket.me/article/1349-delay-javascript-execution
More OpenAI guides
- OpenAI Pixel fires before cookie consent on WordPress
- OpenAI Pixel not firing after cookie consent on WordPress
- Repeated OpenAI event IDs drop ChatGPT Ads conversions
- Duplicate OpenAI Pixel events on WordPress and WooCommerce
- OpenAI Pixel event_id missing on WordPress and WooCommerce
- 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