Fix guide · Framer · medium · about 30 min

OpenAI Pixel fires before consent on Framer: how to fix

For the finding “OpenAI Pixel fires before cookie consent”. Also for: Any website, Shopify, WordPress, Webflow.

What this means

Your Framer site shows a cookie banner, but the OpenAI Pixel (the ChatGPT Ads Measurement Pixel, which loads oaiq.min.js from bzrcdn.openai.com) sent events to OpenAI while the banner was still waiting for an answer.

On Framer this has two usual causes, and they often come together:

  • The pixel sits in Framer’s custom code. Framer’s Cookie Banner component passes the visitor’s choice to Google Tag Manager (GTM) through Google Consent Mode. Framer’s documentation does not say that it blocks scripts pasted into custom code, so a snippet there loads on its own.
  • The snippet was pasted unchanged. OpenAI’s documentation says the pixel starts with consent set to true unless your site sets it to false, or the pixel finds a stored denial. So it measures from the first page load.

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.
  • The banner and the pixel are not connected. When this gets fixed in a hurry, the usual result is the opposite problem: the pixel stops sending anything and ChatGPT Ads lose their conversion data.

How to confirm it yourself

Our check runs from a browser in the EU. Framer’s Cookie Banner has separate settings for EU visitors and for the rest of the world. In the banner component’s code, it picks one from the visitor’s browser time zone and language, not from the IP address, so a VPN does not change what you see. To see the EU version, set your computer’s time zone to a European city before you test.

  1. Open your published site in a private (incognito) window. Custom code does not run in the Framer canvas preview.
  2. Open developer tools (F12), go to the Network tab and type bzr.openai.com into the filter box.
  3. Reload the page. Do not click the cookie banner.
  4. Click each request and look at its payload: a list of events, each with a type. page_viewed or a conversion event (for example lead_created) while the banner is still open means the pixel measures before consent. Types starting with openai:: or oai:: are the SDK’s own service messages, not measurement events (at the time of writing the SDK sends these on its own; OpenAI does not document them).
  5. Under Application > Cookies (Chrome) or Storage > Cookies (Firefox), look for __obref. OpenAI documents that the pixel uses this cookie when measurement consent is granted, so seeing it before you answer the banner means the pixel runs with consent switched on.

How to fix

On Framer, the dependable setup is Framer’s Cookie Banner component + Google Tag Manager, with the OpenAI Pixel only inside GTM. The banner tells GTM what the visitor chose, and GTM holds the OpenAI tag back until marketing consent is granted.

  1. Find every copy of the pixel. Search the published page source for oaiq.min.js and oaiq(. Then check:

    • Site Settings > Code (Framer’s “How to add custom code” article calls the same place Project Settings > Custom Code). Each custom code entry has its own Placement (for example Start of <head>), Pages and Run settings, so open every entry, including ones limited to some pages.
    • Page-level custom code: open the settings of each page, especially the landing pages your ChatGPT ads point to.
    • Embeds, code components and marketplace components on the canvas.
    • Your GTM container: Custom HTML tags containing oaiq, OpenAI’s own GTM template, or Stape’s OpenAI Ads Pixel tag.
  2. Remove the OpenAI snippet from custom code and from embeds.

  3. Let the Cookie Banner load GTM. Add Framer’s Cookie Banner component inside a shared element that appears on every page (navigation or footer), and enter your container ID (GTM-XXXXXXX) in its GTM ID property. The banner then loads GTM itself, after it has set the default consent. If a GTM snippet is also in your custom code, remove it: that copy starts GTM before the banner has set any consent, and loads the container a second time.

  4. Check the banner’s Regions. There are separate settings for EU and World visitors; check both:

    • Choices: None only shows a notice and grants all consent types automatically. Accept/Reject or Customizable ask the visitor first. In the banner component’s code, the defaults are Accept/Reject for the EU and None for the rest of the world.
    • Defaults: Marketing should be Denied wherever you need consent. In the banner component’s code, accepting Marketing grants ad_storage, ad_user_data and ad_personalization together.
  5. Add the OpenAI Pixel as a GTM tag. Pick one:

    • OpenAI’s own template, OpenAI Ads Measurement Pixel, published on GitHub (openai/ads-measurement-pixel-gtm-template). Import its template.tpl under Templates > Tag Templates > New, then Import in the editor’s menu. Enter your Pixel ID and set Event name to page_viewed. The template does not call the pixel’s consent command, and its Per-event opt-out flag does not stop sending, so the tag’s consent settings are what hold it back.
    • Stape’s OpenAI Ads Pixel template (third-party). It has a Consent Granted field and Enable GTM consent mode support, which makes the tag check ad_storage before it loads the SDK.
    • A Custom HTML tag with OpenAI’s installation snippet and a page_viewed call.

    Whichever you choose, open the tag’s Advanced Settings > Consent Settings, choose Require additional consent for tag to fire and add ad_storage.

  6. Make the tag fire right after Accept, on the same page. In our tests, on a first visit the banner sets consent to denied, loads GTM, and after Accept pushes the data layer event cookie_consent_update. On later visits, the stored choice applies before GTM loads and no such event is sent. So give the tag two triggers: a Custom Event trigger for cookie_consent_update and Initialization - All Pages, and set it to fire Once per page. A page view held back before Accept is not sent later by itself; OpenAI does not replay blocked events either.

  7. Do not add oaiq("consent", false) to custom code on top of this. In this setup the pixel does not load before consent, so the command is not needed, and OpenAI says it removes the pixel’s cookies, including __oppref, which holds the ChatGPT ad click.

  8. Publish the GTM container, then publish the Framer site. Custom code changes only take effect on the published site.

Keeping the pixel in custom code works only if something calls oaiq("consent", false) before init and oaiq("consent", true) once the visitor accepts. Framer’s documentation describes no JavaScript event from its banner for that. If you use a different consent tool on Framer, see the general guide for how to hold back a marketing script with it.

Common causes

  • The OpenAI snippet was pasted into Site Settings > Code, and the Cookie Banner was added later. The banner does not control it.
  • The snippet has no oaiq("consent", false), so the pixel treats every visitor as consenting.
  • The OpenAI tag is in GTM but has no consent requirement. Consent Mode adjusts Google’s own tags automatically; other tags need their own consent setting.
  • Choices is set to None for the visitor’s region, or Marketing is Granted under Defaults.
  • A page-level custom code entry on a landing page still holds its own copy of the pixel.
  • A GTM snippet in custom code loads the container before the banner has set the default consent.

How to verify the fix

  1. On the published site, in a private window (with a European time zone if you are outside the EU): no page_viewed or conversion events to bzr.openai.com, and no __obref cookie, before you answer the banner.
  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. In GTM’s Preview mode, connected to your published Framer address, the OpenAI tag is blocked by consent before Accept and fires after it.
  5. 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

Not by itself. Framer describes the banner as a consent system that runs through Google Tag Manager and Google Consent Mode. A pixel pasted into custom code is outside that system.

Sources

Guides for your consent tool