LOG IN OR SIGN UP
Log in to your account
Sign up

How To Setup OpenAI ChatGPT Ads Measurement Pixel

16 August 2026 | 0 comments | Posted by Che Kohler in nichemarket Advice

ChatGPT Ads Pixel Set Up

As conversational AI and generative search continue to capture user attention, time on site and erode site clicks, securing citations in popular LLMs has become part of the SEO mandate. 
 
While organic mentions in LLMs are important, the paid side is starting to roll out, with ChatGPT and Perplexity launching native ad platforms, and Bing and Google adding AI overview placements and testing AI-mode (Gemini and Copilot) ad spots. 

Now that an ad network operating within platforms like ChatGPT has become a new acquisition channel, it's natural to allocate budget to it becomes part of the conversation for marketers.
 
However, driving traffic from ads is only half the battle—to measure ROI, optimise bidding strategies, and build conversion-optimised campaigns, you need precise event tracking on your website.

Suggesting ChatGPT ads to your line manager or client requires you to put in place some form of measurement to track performance. Thankfully, OpenAI has thought of this, copying popular ad platforms like Google and Meta and releasing an ad pixel. 
 
The OpenAI Ads Measurement Pixel is a lightweight browser SDK that tracks web conversions and attributes them back to ad impressions and clicks in ChatGPT. In this comprehensive guide, we will walk through three effective ways to implement the OpenAI Measurement Pixel:
  1. Manual Direct Script Code Installation
  2. Custom HTML Tag Implementation via Google Tag Manager (GTM)
  3. Template-Based Deployment using the Community GTM Tag Template
We will also cover best practices for event mapping, Content Security Policy (CSP) headers, user data matching, and deduplication.

Technical Overview & How the OpenAI Pixel Works

The OpenAI Measurement Pixel operates through a central asynchronous queue function oaiq(). It captures a first-party tracking cookie called __oppref containing an operational privacy-preserving click identifier (oppref), records page origins, and automatically handles event batching.
 +-----------------------------------+ | ChatGPT Ad Click | +-----------------------------------+ | v +-----------------------------------+ | Landing Page (URL containing | | ?oppref=...) | +-----------------------------------+ | v +-----------------------------------+ | OpenAI Measurement Pixel SDK | | Stores __oppref Cookie | +-----------------------------------+ | +-----------------+-----------------+ | | v v +---------------------------+ +---------------------------+ | Standard Event Hits | | Custom Event Hits | | (order_created, lead, etc)| | (quote_requested, etc) | +---------------------------+ +---------------------------+ 

Supported Standard Events & Data Shapes

When sending conversion pings via the Pixel, payload properties must match one of four key data shapes:
Data Shape TypeTarget EventsPrimary Fields
contentspage_viewed, contents_viewed, items_added, checkout_started, order_createdamount, currency, contents: [{id, name, quantity, amount}]
customer_actionlead_created, registration_completed, appointment_scheduledamount (optional), currency (optional)
plan_enrollmentsubscription_created, trial_startedplan_id, amount, currency
customCustom user-defined actionstype: "custom", requires custom_event_name in options

Method 1: Manual Code Snippet Installation

Manual installation is ideal for standalone web applications, single-page sites, or custom frameworks where you want full, direct control over script execution and lifecycle management without relying on third-party tag managers.

Step 1: Add the Base SDK Script

Place the following JavaScript snippet near the top of the <head> tag on every page of your site. Replace <YOUR-PIXEL-ID> with your Pixel ID generated from the OpenAI Ads Manager.
HTML
<script> (function (w, d, s, u) { if (w.oaiq) return; var q = function () { q.q.push(arguments); }; q.q = []; w.oaiq = q; var js = d.createElement(s); js.async = true; js.src = u; var f = d.getElementsByTagName(s)[0]; f.parentNode.insertBefore(js, f); })(window, document, "script", "https://bzrcdn.openai.com/sdk/oaiq.min.js"); oaiq("init", { pixelId: "<YOUR-PIXEL-ID>", debug: false // Set to true during testing to output logs to console }); </script> 

Step 2: Configure Consent Controls

If your site operates under strict privacy regulations (such as GDPR or CCPA) that require explicit user consent before activating tracking scripts, set consent status prior to initialising the Pixel:
HTML
<script> // Default to false if consent is required and not yet given oaiq("consent", false); oaiq("init", { pixelId: "<YOUR-PIXEL-ID>" }); // Execute this callback after the user grants consent in your CMP banner function onUserAcceptsCookies() { oaiq("consent", true); } </script> 

Step 3: Pass User Data for Enhanced Advanced Matching

To improve cross-device conversion attribution, send hashed customer data with your init call. Note: Hash emails and external IDs using lowercase SHA-256 before passing them. Raw personal information is strictly prohibited.
JavaScript
oaiq("init", { pixelId: "<YOUR-PIXEL-ID>", user: { email_sha256: "b4c9a289323b21a01c3e940f150eb9b8c542587f1abfd8f0e1cc1ffc5e475514", external_id_sha256: "73d83a078369bb4f0971b317aa7797a91cf5c0df1b62161c2e47d75c33ab5b6e", country: "US", city: "san francisco", zip_code: "94107" } }); 

Step 4: Fire Conversion Events

Trigger events at crucial steps along the conversion path using the oaiq("measure", ...) function:
JavaScript
// Example 1: E-commerce Order Completion oaiq("measure", "order_created", { type: "contents", amount: 2599, // Integer or numerical value currency: "USD", contents: [ { id: "sku_123", name: "Starter Bundle", content_type: "product", quantity: 1 } ] }, { event_id: "order_12345" // Optional server-side deduplication ID }); // Example 2: Custom Event Setup oaiq("measure", "custom", { type: "custom" }, { custom_event_name: "quote_requested" } ); 

Method 2: Manual Installation via Google Tag Manager (Custom HTML)

If your site utilises Google Tag Manager (GTM) and you prefer not to install external community templates, you can set up the Pixel manually using Custom HTML Tags.

Step 1: Create the Base Pixel Tag

  1. Open your GTM Web Container.
  2. Click Tags > New, and name it OpenAI Pixel - Base Script.
  3. Choose Custom HTML as the Tag Type.
  4. Paste the initialisation snippet into the HTML field:
HTML
<script> (function (w, d, s, u) { if (w.oaiq) return; var q = function () { q.q.push(arguments); }; q.q = []; w.oaiq = q; var js = d.createElement(s); js.async = true; js.src = u; var f = d.getElementsByTagName(s)[0]; f.parentNode.insertBefore(js, f); })(window, document, "script", "https://bzrcdn.openai.com/sdk/oaiq.min.js"); oaiq("init", { pixelId: "YOUR_PIXEL_ID_HERE" }); </script> 
  1. Under Triggering, select Initialisation - All Pages (or Consent Initialisation - All Pages if integrating with a CMP).
  2. Save the tag.

Step 2: Create Standard and Custom Event Tags

To fire conversion pings, create additional Custom HTML tags configured to run after the Base Script initialises.
  1. Click Tags > New, and name it OpenAI Pixel - Event - Purchase.
  2. Select Custom HTML and paste your event tracking script referencing GTM Data Layer Variables:
HTML
<script> window.oaiq && window.oaiq("measure", "order_created", { type: "contents", amount: {{dlv - Order Total}}, currency: "{{dlv - Currency}}", contents: [ { id: "{{dlv - Product SKU}}", content_type: "product", quantity: {{dlv - Quantity}} } ] }, { event_id: "{{dlv - Transaction ID}}" }); </script> 
  1. Under Advanced Settings > Tag Sequencing, check Fire a tag before OpenAI Pixel - Event - Purchase fires and select your OpenAI Pixel - Base Script.
  2. Add your trigger (e.g., Custom Event trigger matching purchase or pageview trigger for thank-you pages).
  3. Save and Publish.

Method 3: Simplified Setup via Google Tag Manager Community Template

Using a custom tag template from the GTM Community Gallery (such as the OpenAI Ads Pixel by Stape) streamlines parameter mapping, automates Google Consent Mode integration, and parses GA4 Data Layer events automatically.
+-----------------------------------------------------------------+ ¦ Google Tag Manager Container ¦ ¦ ¦ ¦ +---------------------------------------------------------+ ¦ ¦ ¦ OpenAI Ads Pixel Tag Template ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ Pixel ID: [ YOUR-PIXEL-ID ] ¦ ¦ ¦ ¦ Event Setup: Inherit from DataLayer / Override ¦ ¦ ¦ ¦ [X] Enable Automatic GA4 Mapping ¦ ¦ ¦ ¦ [X] Enable Google Consent Mode (ad_storage) ¦ ¦ ¦ +---------------------------------------------------------+ ¦ +-----------------------------------------------------------------+ 

Step 1: Add the Template to Your Container

  1. Navigate to Templates in the GTM sidebar.
  2. In the Tag Templates box, click Search Gallery.
  3. Search for OpenAI Ads Pixel (e.g., OpenAI Ads Pixel by Stape) and click Add to Workspace.

ChatGPT GTM Tag Template

OpenAI Ads Pixel Template in Google Tag Manager

Step 2: Configure the Main Pixel Tag

  1. Go to Tags > New and set the Tag Type to OpenAI Ads Pixel.
  2. In the Pixel ID field, paste your OpenAI Pixel ID.
  3. Select your Event Name Setup Method:

    • Inherit from DataLayer: Automatically maps standard GA4 events (e.g., add_to_cart, begin_checkout, purchase) directly to their OpenAI equivalents (items_added, checkout_started, order_created).
    • Override: Manually select a specific standard OpenAI event or define a custom event name.
  4. Enable Automatic Event Parameters Mapping. This allows the tag to parse GA4 e-commerce objects, populating amount, currency, and item contents automatically.

ChatGPT Ad Pixel Setup

ChatGPT/OpenAI Tag Template Settings in Google Tag Manager

Step 3: Configure Consent & Advanced Matching

  • Google Consent Mode: Check the option to enable GTM Consent Mode support. When ad_storage consent is denied, the tag prevents script loading until the user explicitly grants permission.
  • Advanced Matching: Under the user parameters section, map variables for email_sha256 or external customer IDs to enhance conversion attribution rates.

Step 4: Attach Triggers

Assign triggers based on your desired tracking scope:
  • Use Initialisation - All Pages to fire base page view calls.
  • Use specific Custom Event Triggers (e.g., purchase, generate_lead) to fire conversion events.

Technical Considerations & Best Practices

1. Content Security Policy (CSP) Headers

If your site implements a strict Content Security Policy, ensure you whitelist OpenAI's CDN and data ingestion endpoints. Update your HTTP headers with the following directives:
DirectiveSource URLPurpose
script-src / script-src-elem[https://bzrcdn.openai.com](https://bzrcdn.openai.com)Loads the oaiq.min.js SDK library
connect-src
[https://bzr.openai.com](https://bzr.openai.com)


[https://bzrcdn.openai.com](https://bzrcdn.openai.com)
Sends conversion pings via fetch/sendBeacon and fetches configuration
img-src[https://bzr.openai.com](https://bzr.openai.com)Supports fallback image pixel requests when script transport is restricted
Example CSP Policy Header:
HTTP
Content-Security-Policy: default-src 'self'; script-src 'self' 'nonce-2726c7f26c' https://bzrcdn.openai.com; connect-src 'self' https://bzr.openai.com https://bzrcdn.openai.com; img-src 'self' https://bzr.openai.com; 

2. Deduplication Between Browser (Pixel) and Server (Conversions API)

For optimal conversion measurement, combine the client-side Measurement Pixel with OpenAI's server-side Conversions API. To prevent duplicate reporting, assign a matching event_id payload property across both channels:
JavaScript
// Browser Pixel Call oaiq("measure", "order_created", { type: "contents", amount: 2599, currency: "USD" }, { event_id: "order_unique_98765" // SHARED UNIQUE ID }); 

3. Debugging and Verification

  • Enable Console Debug Logs: Set debug: true in your oaiq("init", ...) configuration or check JS SDK Debugging Logs within the GTM template to view payload outputs directly in the Developer Tools console.
  • Check Cookie Storage: Verify that the __oppref cookie is set correctly upon visiting landing pages containing ad tracking parameters.
  • Network Tab Inspection: Look for outbound POST or GET requests targeting [https://bzr.openai.com](https://bzr.openai.com) with 200 HTTP response codes.

Need Help With Your Tracking?

If this all sounds like too much of a headache and you'd much prefer a tracking expert to set up your ad account pixel, reach out to us and we'll get you set up.

Tags: AI Assistant, LLMs, ChatGPT, Tracking, Data Analytics

Previous: {{ previousBlog.sTitle }}

Posted {{ previousBlog.dtDatePosting }}

Next: {{ nextBlog.sTitle }}

Posted {{ nextBlog.dtDatePosting }}

You might also like

President Ramaphosa faces economic challenges with South Africa's foreign policy

How Ramaphosa's Foreign Policy Impacts South Africa's Economy

06 August 2026

Posted by Debjit Mukherjee in Money Talks


South Africa's foreign policy increasingly intersects with domestic economic priorities. This analysis examines how diplomatic choices influence inve...

Read more
Evaluate ChatGPT ads platform

How Do I Know ChatGPT Ads Are Right For My Business?

15 August 2026

Posted by Che Kohler in nichemarket Advice


As OpenAI rolls out ads in a bid to monetise its user base, we are now seeing the emergence of an ad platform, and this is what you need to know befo...

Read more

Leave us a comment


{{comment.sUserName}}

{{comment.iDayLastEdit}} day ago

{{comment.iDayLastEdit}} days ago

{{comment.sComment}}

Sign up for our newsletter