How to Install the OpenAI Ads Measurement Pixel (Step-by-Step)
A step-by-step walkthrough for installing the OpenAI Ads measurement pixel directly or via Google Tag Manager, including the CSP settings and verification steps most installs get wrong.
Getting the OpenAI Ads pixel running usually takes five minutes, but small deployment mistakes can leave your campaigns flying blind. If your server returns strict Content Security Policy headers or your tag manager fires late, Ads Manager won't record a single conversion even while you're burning through ad budget.
You have two reliable ways to install it: pasting the loader snippet right into your site's <head> template, or wrapping it in a Google Tag Manager tag.
Here is what the setup looks like, how to whitelist the CDN endpoints in your CSP, and how to verify that incoming hits actually show up in your account.
Prerequisites
Before opening your codebase, grab a few essentials:
First, confirm you have admin rights in OpenAI Ads Manager. Without them, you won't be able to access the conversions dashboard or grab your Pixel ID.
Second, make sure you have direct write access to your site's <head> template or an active Google Tag Manager workspace.
Third, check whether your site uses a Content Security Policy. If it does, you'll need to whitelist OpenAI's endpoints before the script can load.
Finally, have a staging site or a browser with DevTools ready so you can test events before sending live paid traffic.
1. Grab your Pixel ID
Head into OpenAI Ads Manager and click over to the conversions tab. Your Pixel ID is the alphanumeric string associated with your ad account:
- Sign in to your Ads Manager account.
- Navigate to the conversions section.
- Select your pixel and copy the ID string.
This ID is public and sits in your client-side page source. You can reference the official specs in the OpenAI Ads developer docs and the measurement pixel reference.
2. Direct code installation
If you can edit your site layout or head templates directly, insert the loader script and initialization snippet near the top of <head> across all pages:
<head>
<script async src="https://bzrcdn.openai.com/sdk/oaiq.min.js"></script>
<script>
window.oaiq = window.oaiq || function () {
(window.oaiq.q = window.oaiq.q || []).push(arguments);
};
oaiq("init", { pixelId: "YOUR-PIXEL-ID" });
</script>
</head>
Swap out YOUR-PIXEL-ID with your actual identifier.
Notice the async attribute. That allows the script to fetch in the background without holding up your page render. Don't defer the script or push it down into the footer, because early bounces will slip away before the pixel ever fires or captures the oppref click token from the landing URL.
The window.oaiq queue stores any measurement calls triggered while the remote file is still downloading, then executes them sequentially once the SDK finishes loading.
While testing locally, you can pass debug: true inside the init payload to print verbose SDK telemetry straight into your browser console:
oaiq("init", { pixelId: "YOUR-PIXEL-ID", debug: true });
Make sure to strip out debug: true before you push this to production.
3. Installing via Google Tag Manager
If your team runs analytics through Google Tag Manager, deploy the snippet as a Custom HTML tag configured across all pages:
- Open your GTM workspace, click New Tag, and select Custom HTML.
- Paste the loader script and init snippet directly into the code box.
- Set your firing trigger to Initialization - All Pages. Don't limit it to checkout or landing paths.
- Save the tag as "OpenAI Ads Base Pixel" and submit your changes.
Firing on every single page is critical. When visitors arrive from an ad, the pixel grabs the oppref URL parameter and sets a first-party __oppref cookie. If the script only lives on checkout pages, you lose attribution for shoppers who explore product pages or read blog posts before buying.
Funnel actions like adding items to a cart or completing checkout will fire through separate datalayer triggers, as covered in our event tracking guide.
Content Security Policy (CSP) rules
If your web server sends Content Security Policy headers, modern browsers will block external tracking origins unless you explicitly permit them:
script-src bzrcdn.openai.com;
connect-src bzr.openai.com;
img-src bzr.openai.com;
The base script downloads from bzrcdn.openai.com, while outbound telemetry dispatches to bzr.openai.com through fetch calls or image beacons. If your CSP forbids inline scripts, pass a nonce or hash attribute with your <script> tag rather than opening security holes with 'unsafe-inline'.
If the pixel refuses to load, inspect your browser console for CSP violation warnings that pinpoint which directive tripped.
How to verify that events are firing
Run through these three checks before spending a dollar on campaigns:
First, check the Network tab. Open browser DevTools, switch to the Network tab, and reload your site. Filter by oaiq to ensure oaiq.min.js returns a clean HTTP 200 from bzrcdn.openai.com. Next, filter for bzr.openai.com to confirm outgoing event requests return an HTTP 202 accepted response.
Second, check with the Pixel Helper. Install the OpenAI Ads Pixel Helper Chrome extension. It lets you inspect loaded pixel IDs and watch events trigger on any page without parsing raw network headers.
Third, watch Ads Manager. Check the conversions tab inside OpenAI Ads Manager. Fresh page-view events should land in your real-time activity stream within a couple of minutes. Make sure your active ad campaigns are properly linked to this pixel.
Common setup slip-ups to avoid
Most pixel failures come down to a few recurring snags:
Placing the script late in the HTML or inside the footer. When users navigate quickly, the browser exits before the tracking file finishes fetching, losing both the page view and the ad click token. Keep it high in <head>.
Restricting the pixel to checkout or landing pages. This breaks multi-page user journeys because the first-party __oppref cookie never gets written during initial browsing.
Strict CSP headers blocking requests. If the browser console shows red CSP warnings, add bzrcdn.openai.com and bzr.openai.com to your allowed origins.
Pasting the snippet twice. If you insert code into your theme and also configure a tag in GTM, every page load records double the traffic and inflates your numbers. Choose one home for the base script.
Typos in the Pixel ID. If you miss a character, requests fire into the void and Ads Manager never sees your data. Always copy the string directly from your dashboard.
Leaving debug mode on in production. It won't break tracking, but it dumps internal telemetry and event objects into every user's public console.
Where to go from here
After your base pixel records page views cleanly, wire up specific business milestones like add-to-cart, checkout start, and purchases with oaiq("measure", ...). Check our walkthrough on tracking cart, checkout, and purchase events for required parameter formatting, ISO currency rules, and code examples.
Need ChatGPT tracking installed?
Configured, tested, documented.