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.

  1. Open a private (incognito) window, so no earlier consent choice is remembered.
  2. Open the browser’s developer tools (F12, or right-click and choose Inspect), go to the Network tab and type bzr.openai.com into the filter box.
  3. Load your page. Do not click anything on the cookie banner.
  4. Click each request to bzr.openai.com and look at its payload. It contains a list of events; each one has a type, which is the event name. If you see page_viewed or one of your conversion events (for example lead_created) while the banner is still open, the pixel is measuring before consent.
  5. Ignore anything that is not one of your event names. OpenAI says that while consent is false the pixel sends no measurement-event pings, so page_viewed and your conversion events are what count. The SDK also downloads a small configuration file from bzrcdn.openai.com, and at the time of writing it sends its own service messages (types starting with openai:: or oai::, such as oai::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.
  6. 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 __obref appears 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.

  1. Find every place the pixel is installed. Search the page source (right-click, View page source) for oaiq.min.js and oaiq(. 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.
  2. 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 true from the start instead of false. OpenAI says oaiq("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 that window.oaiq exists.

    • 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 (plus ad_user_data if 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 for ad_storage.

  3. Make the “accept” path work on the same page. OpenAI says events blocked while consent is false are not replayed. If your code sent page_viewed before the visitor accepted, send it again right after oaiq("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.
  4. 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: after init and the first measure call. 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.com yet, 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

  1. Repeat the private-window test: no page_viewed or conversion events before you answer the banner, and no __obref cookie yet.
  2. Click “Accept”: a page_viewed event leaves within a few seconds, on the same page.
  3. In a fresh private window, click “Reject”: no measurement events at all.
  4. 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

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

Guides for your consent tool