Fix guide · Any website · medium · about 30 min

OpenAI Pixel not firing after cookie consent: how to fix it

For the finding “OpenAI Pixel does not fire after consent”. Also for: Shopify, WordPress, Webflow, Framer.

What this means

The OpenAI Pixel (the ChatGPT Ads Measurement Pixel) is installed on your page, but after cookies were accepted, no events were sent to OpenAI. As far as ChatGPT Ads can tell, this page has no visitors.

Why it costs you money:

  • ChatGPT Ads cannot see page views or conversions from this page, so reported conversions are too low and your cost per conversion looks worse than it is.
  • Conversion-optimized campaigns learn from these events. Without them, the campaign optimizes on little or nothing.
  • You keep paying for clicks while the system that should learn from them is switched off.

How sure we are: if our checker found and accepted your cookie banner, this is reported as critical. If we did not find a banner we could operate, it is reported as high: the pixel may be waiting for a consent signal from a banner we did not recognize. In that case, test it yourself as described below before changing anything.

How to confirm it yourself

Our check runs from a browser in the EU, so EU consent rules on your site apply to it. If your banner only appears for EU visitors, use a VPN or ask a colleague there.

  1. Open a private (incognito) window, open developer tools (F12), go to the Network tab and type bzr.openai.com into the filter box.
  2. Load the page and click Accept (accept all) on the cookie banner.
  3. Wait about 5 seconds. Click the requests to bzr.openai.com and look at the payload: it carries a list of events, each with a type. You should see at least one event with the type page_viewed (or another event your site sends on page load). Anything that is not one of your event names does not count: at the time of writing the SDK also sends its own, undocumented service messages (types starting with openai:: or oai::).
  4. If no measurement event appears, the pixel is not firing after consent. Click to another page: if events appear only there, the pixel starts on the next page view, so you lose the first page of every new visit, which is usually the page your ad points to.
  5. In the Console tab, type typeof oaiq. "undefined" means the pixel code never ran on this page. "function" only means the snippet ran: it creates a queue before the SDK arrives. Filter the Network tab by oaiq.min.js and check that the SDK itself loaded (status 200); if it did, the problem is in the consent or event calls.

How to fix

The pixel is installed, but something between “visitor clicks Accept” and “pixel sends an event” is broken. Work along that chain.

  1. Check that the consent tool records the choice. After clicking Accept, reload the page: the banner should not come back. If it does, fix the consent tool first (a common cause is a cookie domain mismatch).
  2. If you use the pixel’s consent command, check both halves:
    • something must call oaiq("consent", true) when the visitor accepts, on the same page, and on later pages for visitors who accepted earlier. A common mistake is calling oaiq("consent", false) on every page load and oaiq("consent", true) only inside the banner’s click handler, so returning visitors stay blocked forever;

    • after switching consent on, send the page view again. OpenAI says events blocked while consent is false are not replayed: a page_viewed sent while the banner was open is gone. Send it after oaiq("consent", true), or wait with all measure calls until consent is known:

      function onMarketingConsent() {
        oaiq("consent", true);
        oaiq("measure", "page_viewed", { type: "contents" });
      }
    • a denial can also come from the pixel itself: OpenAI says the pixel keeps consent false when it finds a stored denial. A visitor (or you, while testing) who rejected earlier stays blocked until your code calls oaiq("consent", true) after they change their mind.

  3. Check which category the pixel belongs to. If your consent tool blocks the script until consent, the OpenAI snippet must be in the category that “Accept” grants, usually marketing, and the category label must be spelled exactly as the tool expects. Check that the tool re-activates the blocked script after Accept without needing a reload.
  4. If the pixel is in Google Tag Manager (GTM):
    • open GTM’s Preview mode, load the site and click Accept. A consent update should appear, with ad_storage changing to granted;
    • look at the OpenAI tag: is it “fired” or “not fired”? If it is blocked by consent, the consent update is not arriving. If it is not fired, its trigger never ran;
    • a common problem is a tag that only has an “All Pages” trigger, which runs once, before the visitor has clicked Accept. Add a trigger that runs when consent is granted, such as the custom event your consent tool pushes to the data layer, and make sure the tag cannot fire twice on the same page. GTM Preview shows the exact event name your tool pushes when you click Accept;
    • with Stape’s OpenAI Ads Pixel template, check its Consent Granted field: if it is set to false, the tag holds events until the tag fires again with consent granted. OpenAI’s own GTM template has no consent field; it relies on the tag’s Consent Settings and triggers.
  5. Look at the browser console for errors. A JavaScript error in custom code before the measure call stops the event. A Content Security Policy that does not allow https://bzrcdn.openai.com in script-src and https://bzr.openai.com in connect-src blocks the pixel; the console shows a CSP violation. OpenAI lists the exact sources to add.
  6. Check the event call itself. The event data object needs a type that matches the event (for example { type: "contents" } for page_viewed), and amount and quantity must be whole numbers. With debug: true in the init call on a test copy of your site, the SDK logs what it does in the console.
  7. Publish your changes and clear any cache.

Common causes

  • Consent is withdrawn with oaiq("consent", false) on every page load, and only the banner click switches it back on, so returning visitors who accepted earlier send nothing.
  • The page view was sent before consent and is not replayed afterwards.
  • The pixel is mapped to a consent category that the “Accept” button does not grant.
  • The GTM tag fires only on the initial page view, before consent is given, and never again on that page.
  • The consent tool was replaced, but the old consent check is still in the pixel code or GTM.
  • A Content Security Policy or a script error stops the SDK.
  • The Pixel ID in the code is wrong (events would still be sent, but to another data source; check pid in the request address once events appear).

How to verify the fix

  1. In a fresh private window: no measurement events before Accept, and a page_viewed event within a few seconds after Accept, on the same page.
  2. Reload the page as a returning visitor who already accepted: page_viewed leaves without any click.
  3. If you have access to the Advertiser API, OpenAI’s recent-events endpoint (GET /v1/conversions/events?pid=<PIXEL-ID>) shows a sample of events from roughly the last 15 minutes; browser events show the channel pixel_sdk.
  4. Re-run the check on IsPixelWorking. The issue should be gone, and “OpenAI Pixel fires before cookie consent” should not appear in its place.

Sources

Guides for your consent tool