Docs menu
OpenAI Ads (ChatGPT)
Consent control for the OpenAI pixel (ChatGPT Ads): enabling it, the oaiq queue, loading the SDK only after consent and verification.
OpenAI Measurement Pixel (ChatGPT Ads)
CookieHug can drive the consent of the OpenAI Measurement Pixel (oaiq) — the conversion pixel for ads shown in ChatGPT. Two properties of this pixel make a plain copy of the official snippet non-compliant in the EEA:
- the pixel starts with consent enabled — without
oaiq("consent", false)beforeinitit sends data right away, - events sent while consent is off are dropped, not queued — OpenAI does not replay them after a later consent.
The feature is off by default and enabled per domain. CookieHug does not need the pixel ID — it creates the oaiq command queue, owns the consent command and decides *when* the pixel SDK (oaiq.min.js) gets loaded.
Enabling
- Open the domain in the dashboard → Advanced → the Consent policy section.
- Find the OpenAI Measurement Pixel (ChatGPT Ads) card and flip the switch — it saves automatically.
- The change lands in the banner script on its next fetch (script cache: up to 5 minutes).
- The CookieHug snippet must sit in the page before the OpenAI pixel snippet.
How the signal works
On start the CookieHug SDK creates a window.oaiq queue stub and puts a consent entry matching the visitor's decision at the front of it. The official pixel snippet begins with if (w.oaiq) return;, so when it sees our queue it only appends its init and measure calls — and CookieHug loads the OpenAI SDK only once there is consent for the Marketing category:
// start without a stored decision — nothing from OpenAI loads:
window.oaiq.q // → [['consent', false]]
// the site snippet (after CookieHug) appends:
oaiq('init', { pixelId: '…' });
oaiq('measure', 'page_viewed');
// "Accept all" → CookieHugOnConsentReady:
window.oaiq.q // → [['consent', true], ['init', …], ['measure', 'page_viewed']]
// and only now https://bzrcdn.openai.com/sdk/oaiq.min.js enters the pageAs a result, events queued before the decision (usually page_viewed) go out after consent instead of being lost. On rejection nothing from OpenAI loads at all. On a return visit with a stored consent the SDK loads right at page start.
Once the SDK is running, every further decision reaches it as oaiq('consent', true | false) — a rejection in the editor stops measurement, a withdrawal reloads the page. The signal source is the Marketing category, the same one that drives ad_storage in Google Consent Mode.
When you manage consent yourself
With the switch on, do not call oaiq("consent", …) from site code — that command belongs to CookieHug. If you already handle it (e.g. the pattern: consent false → init → in a CookieHugOnConsentReady listener consent true and re-sending the current page's events), leave the switch off — your code works fine, because CookieHugOnConsentReady fires after every decision and on return visits with a stored consent.
If the pixel snippet comes before CookieHug, the site snippet loads the OpenAI SDK. CookieHug still puts the consent entry at the front of the not-yet-processed queue, but can no longer delay the SDK download. When firing the pixel through Google Tag Manager, use a trigger tied to marketing consent — the switch stays safe, but GTM decides the load moment.
Verification
In DevTools on a page with the feature enabled:
// right after landing (before a decision):
window.oaiq.q
// → [['consent', false], ['init', {…}], ['measure', 'page_viewed']]
// Network tab: no requests to bzrcdn.openai.com / bzr.openai.com
// after "Accept all":
// → ['consent', true] at the front of the queue, <script src="…/oaiq.min.js"> appears in the DOM
window.oaiq.loaded // → true once the SDK replaced the stubIf window.oaiq does not exist, the switch is not active in the script yet (wait for the cache to refresh) or the page loads an older script.