Fix guide · Any website · medium · about 30 min
OpenAI Pixel fires before cookie consent: how to fix it
For the finding “OpenAI Pixel fires before cookie consent”. Also for: Shopify, WordPress, Webflow, Framer.
What this means
Your site shows a cookie banner, but the OpenAI Pixel (OpenAI calls it the ChatGPT Ads Measurement Pixel; it loads oaiq.min.js from bzrcdn.openai.com) sent events to OpenAI while the banner was still waiting for an answer. The banner is on screen, but it does not control the pixel.
This happens easily with this pixel. OpenAI’s documentation says the pixel starts with consent set to true unless your site sets it to false, or the pixel finds a denial stored from an earlier visit. If the installation snippet was pasted as it is, the pixel measures from the first page load, whatever the visitor later answers.
Why it costs you money:
- If you advertise to people in the EU, sending marketing data before consent is a legal risk you probably did not intend to take. We report the technical behaviour only; we cannot tell you whether your setup is compliant.
- It usually means the banner and your tags are not connected at all. When this gets fixed in a hurry, the common result is the opposite problem: the pixel stops sending anything and ChatGPT Ads lose their conversion data.
- Your ChatGPT Ads numbers mix consented and unconsented visitors, so they will shift unexpectedly once the setup is corrected.
How to confirm it yourself
Our check runs from a browser in the EU, so the site behaves as it would for an EU visitor. If your banner only appears in some countries, use a VPN or ask a colleague there.
- Open a private (incognito) window, so no earlier consent choice is remembered.
- Open the browser’s developer tools (F12, or right-click and choose Inspect), go to the Network tab and type
bzr.openai.cominto the filter box. - Load your page. Do not click anything on the cookie banner.
- Click each request to
bzr.openai.comand look at its payload. It contains a list ofevents; each one has atype, which is the event name. If you seepage_viewedor one of your conversion events (for examplelead_created) while the banner is still open, the pixel is measuring before consent. - Ignore anything that is not one of your event names. OpenAI says that while consent is
falsethe pixel sends no measurement-event pings, sopage_viewedand your conversion events are what count. The SDK also downloads a small configuration file frombzrcdn.openai.com, and at the time of writing it sends its own service messages (types starting withopenai::oroai::, such asoai::diagnostic) even before consent. OpenAI does not document these, so treat them as current SDK behaviour that may change; they are not events about your visitor. - Open the Application tab (Chrome) or Storage tab (Firefox), then Cookies for your domain. OpenAI documents that the pixel uses its first-party cookies
__obref(a browser reference) and__oppref(the ad click ID) when measurement consent is granted. If__obrefappears before you have answered the banner, the pixel is running with consent switched on.
There is no official OpenAI browser extension for checking the pixel at the time of writing. The developer tools above, and the pixel’s debug: true option on a test copy of your site, show everything you need.
How to fix
The goal: the pixel must not measure anything until the visitor has accepted marketing cookies, and it must start right after they accept, on the same page. How you get there depends on how the pixel is installed. Find out first.
- Find every place the pixel is installed. Search the page source (right-click, View page source) for
oaiq.min.jsandoaiq(. Check your site’s header code or theme settings, your Google Tag Manager (GTM) container (Custom HTML tags, OpenAI’s own GTM template, and community templates such as Stape’s OpenAI Ads Pixel tag), and any plugins or apps. The fix only works if every copy goes through your consent setup. - Pick one way to gate the pixel and remove the others.
-
The pixel’s own consent command. This is what OpenAI documents. Set consent before
init, then switch it on when the visitor accepts:oaiq("consent", false); oaiq("init", { pixelId: "<YOUR-PIXEL-ID>" }); // Later, when the visitor accepts marketing cookies: oaiq("consent", true);Connect the last line to your consent tool’s “consent given” event. For visitors who accepted on an earlier visit, read the stored choice from your consent tool and pass
truefrom the start instead offalse. OpenAI saysoaiq("consent", false)removes the pixel’s cookies, including__oppref, which holds the ChatGPT ad click; calling it on every page for visitors who already agreed would throw that click away each time. -
Your consent tool (CMP) blocks the script. Most consent tools can hold back a script until the visitor accepts a category: you change the script’s type and add a category attribute, or let the tool block known trackers automatically. Put the OpenAI snippet in the marketing (advertising) category, following your tool’s documentation; attribute names differ from tool to tool. New trackers are often missing from automatic blocking lists, so prefer manual marking. If other code on your pages calls
oaiq("measure", ...), make sure it runs only after the pixel has been released, or checks first thatwindow.oaiqexists. -
Google Tag Manager. Install the pixel only as a GTM tag. In the tag’s Advanced Settings > Consent Settings, choose Require additional consent for tag to fire and add
ad_storage(plusad_user_dataif your setup uses it). This works only if your consent tool sends Google Consent Mode updates to GTM. OpenAI’s own GTM template (published on GitHub) does not call the pixel’s consent command, and its per-event opt-out flag does not stop sending, so the Consent Settings above are what holds it back. Stape’s OpenAI Ads Pixel template has its own consent options: a Consent Granted field and Enable GTM consent mode support, which makes the tag wait forad_storage.
-
- Make the “accept” path work on the same page. OpenAI says events blocked while consent is
falseare not replayed. If your code sentpage_viewedbefore the visitor accepted, send it again right afteroaiq("consent", true), or send it only once consent is known. Otherwise you lose the landing page view, often the page your ChatGPT ad points to. - Publish your changes and clear any site or CDN cache.
Common causes
- The installation snippet was pasted unchanged. Without
oaiq("consent", false), the pixel treats every visitor as consenting. - The cookie banner was added later as a separate widget that knows nothing about the pixel.
- The pixel is a GTM tag with no consent requirement. GTM’s Consent Mode adjusts Google tags automatically; other tags need their own consent setting.
oaiq("consent", false)is called too late: afterinitand the firstmeasurecall. Commands run in the order they are queued, so the page view leaves before consent is withdrawn.- The consent tool’s automatic blocking does not recognize
bzrcdn.openai.comyet, or runs in “notice only” mode, or blocks scripts only outside the EU. - A plugin, app or tag template adds a second copy of the pixel that ignores the consent tool.
How to verify the fix
- Repeat the private-window test: no
page_viewedor conversion events before you answer the banner, and no__obrefcookie yet. - Click “Accept”: a
page_viewedevent leaves within a few seconds, on the same page. - In a fresh private window, click “Reject”: no measurement events at all.
- Re-run the check on IsPixelWorking. The issue should be gone, and “OpenAI Pixel does not fire after consent” should not appear in its place.
Questions people ask
Does the OpenAI pixel have a consent mode?
Yes: oaiq("consent", false) and oaiq("consent", true). The pixel does not read Google Consent Mode or your banner by itself, so something on the page has to call these commands, or keep the pixel from loading until consent is given.
Is there an OpenAI Pixel Helper extension?
Not from OpenAI at the time of writing. The Network tab of your browser, plus debug: true in the init call while testing, shows the same events.
Sources
- OpenAI Developers, Measurement Pixel: installation, consent (
oaiq("consent", false | true), defaulttrueunless set or a stored denial exists, blocked events not replayed), cookies__opprefand__obref, debug option: https://developers.openai.com/ads/measurement-pixel - OpenAI Developers, Conversion Tracking (configure the Pixel’s consent controls before initialization): https://developers.openai.com/ads/conversion-tracking
- OpenAI on GitHub, Ads Measurement Pixel GTM template (no consent call; opt-out flag does not block transport): https://github.com/openai/ads-measurement-pixel-gtm-template
- Stape, OpenAI Ads Pixel tag for web GTM (Consent Granted, GTM consent mode support): https://stape.io/helpdesk/documentation/openai-ads-pixel-tag
- Google Tag Manager Help, Tag Manager consent mode support (Consent Settings, “Require additional consent for tag to fire”): https://support.google.com/tagmanager/answer/10718549