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
trueunless your site sets it tofalse, 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.
- Open your published site in a private (incognito) window. Custom code does not run in the Framer canvas preview.
- Open developer tools (F12), go to the Network tab and type
bzr.openai.cominto the filter box. - Reload the page. Do not click the cookie banner.
- Click each request and look at its payload: a list of
events, each with atype.page_viewedor a conversion event (for examplelead_created) while the banner is still open means the pixel measures before consent. Types starting withopenai::oroai::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). - 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.
-
Find every copy of the pixel. Search the published page source for
oaiq.min.jsandoaiq(. 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.
- 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
-
Remove the OpenAI snippet from custom code and from embeds.
-
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. -
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_dataandad_personalizationtogether.
-
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 itstemplate.tplunder Templates > Tag Templates > New, then Import in the editor’s menu. Enter your Pixel ID and set Event name topage_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_storagebefore it loads the SDK. - A Custom HTML tag with OpenAI’s installation snippet and a
page_viewedcall.
Whichever you choose, open the tag’s Advanced Settings > Consent Settings, choose Require additional consent for tag to fire and add
ad_storage. - OpenAI’s own template, OpenAI Ads Measurement Pixel, published on GitHub (
-
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 forcookie_consent_updateand 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. -
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. -
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
- On the published site, in a private window (with a European time zone if you are outside the EU): no
page_viewedor conversion events tobzr.openai.com, and no__obrefcookie, before you answer the banner. - 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.
- In GTM’s Preview mode, connected to your published Framer address, the OpenAI tag is blocked by consent before Accept and fires after it.
- 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 Framer’s Cookie Banner block the OpenAI Pixel?
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
- OpenAI Developers, Measurement Pixel (consent defaults to
trueunless set or a stored denial exists, blocked events are not replayed,__obrefand__opprefcookies,oaiq("consent", false)removes both): https://developers.openai.com/ads/measurement-pixel - OpenAI on GitHub, Ads Measurement Pixel GTM template (manual import, 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 (third-party; Consent Granted, GTM consent mode support): https://stape.io/helpdesk/documentation/openai-ads-pixel-tag
- Framer Help, Add Google Tag Manager to your site (Site Settings > Code, Placement, Pages, Run, Initialization - All Pages, Preview): https://www.framer.com/help/articles/how-to-add-google-tag-manager-to-your-site/
- Framer Help, How to add custom code (Project Settings > Custom Code, placement, page selection, run options): https://www.framer.com/help/articles/how-to-add-custom-code/
- Framer Academy, Custom Code (page-level custom code; custom code does not run in the canvas preview): https://www.framer.com/academy/lessons/custom-code
- Framer Academy, Add a Cookie Banner to your site in Framer (shared component, GTM container ID): https://www.framer.com/academy/lessons/cookie-banner-component
- Framer Updates, Cookie Banner component (consent system through Google Tag Manager and Consent Mode, EU and rest of world, default consent): https://www.framer.com/updates/cookie-banner-component
- Google Tag Manager Help, Tag Manager consent mode support (“Require additional consent for tag to fire”): https://support.google.com/tagmanager/answer/10718549
- IsPixelWorking live test, 2026-10-01: on a published Framer site with the Cookie Banner and a GTM ID,
gtm.jswas requested by Framer’s own site script; the banner pushedconsent default(all denied except necessary) and, after Accept,consent updateplus acookie_consent_updatedata layer event. Region detection, Choices and Defaults were read from the published component code.