How to install the ChatGPT Ads pixel with Google Tag Manager
Contents
The OpenAI pixel for ChatGPT Ads can be installed in Google Tag Manager in two ways: with the official template that OpenAI publishes in the community template gallery, without writing code, or with custom HTML tags. The template is the simplest path for most sites. Custom tags make sense when you need to control the pixel's own consent, for example to revoke permission during the visit.
This article explains what to prepare beforehand, how to set up each option, how to handle consent and how to validate the installation. What is stated about the pixel comes from the official OpenAI documentation and from the template's published code, consulted on November 18, 2026. For an overview of the platform, see the ChatGPT Ads guide.
In summary
- OpenAI publishes the "OpenAI Ads Measurement Pixel" template in the Tag Manager gallery. Each tag sends one event and loads the pixel by itself; the base tag is optional.
- The template's code does not send the pixel's consent command. If the site needs prior consent, you must prevent the tag from firing, using Tag Manager's consent settings or conditions on the triggers.
- The pixel treats consent as granted unless it is denied before it is initialized. If you need to revoke it during the visit and delete its cookies, you need custom HTML tags that call
oaiq("consent", false). - Each event must fire when the action is completed, with an exact-match event trigger, and only once. It is not advisable to replace it with a click or with the URL of a thank-you page.
- Validation combines Tag Manager's preview mode, the browser console and the pixel's test session in Ads Manager.
What to prepare before installing
Before opening Tag Manager, it helps to have four things settled:
- The pixel ID. It is created in Ads Manager, in the Conversions tab. It is the same for all the tags in the container.
- The events to be measured. OpenAI defines standard events such as
page_viewed,lead_created,order_createdorappointment_scheduled. Campaigns optimized for conversions support only standard events. - The signal for each event in the data layer. Each conversion needs its own event in the dataLayer, sent when the action is confirmed. If the site measures ecommerce for Google Analytics, CookingMetrics' GA4 ecommerce guide describes those events; the mapping to OpenAI's events is covered in the article on the GA4 ecommerce dataLayer and ChatGPT Ads events.
- The consent rule. You need to know whether the applicable law requires prior consent for advertising measurement and how the CMP exposes the visitor's decision.
Conceptual preparation sequence; the specific values are filled in for each implementation.
Option 1: the official OpenAI template
The OpenAI Ads Measurement Pixel template appears in the gallery with the author openai and points to an official OpenAI repository. Its description states that it loads the pixel and sends page views or conversions without custom HTML.
Add the template to the container
- In Tag Manager, open Templates and, under Tag Templates, select Search Gallery.
- Search for "OpenAI Ads Measurement Pixel" and verify that the author is
openai. The gallery also shows third-party templates with similar names. - Review the permissions it requests: inject scripts, read container data, write to the console and access global variables. They are consistent with what a pixel does, but the site's security officer should be aware of them.
- Add the template to the workspace.
Create one tag per event
According to the repository README, you create one tag for each event you want to measure:
- Enter the pixel ID. We recommend storing it in a Constant variable and using that variable in all the tags, so you do not copy it by hand.
- Leave the option to send an event when the tag fires turned on.
- Choose the event and fill in the relevant fields: amount and currency, contents, plan identifier or custom event name.
- If the same conversion is also sent from the server, fill in the Event ID field with a data layer variable that carries a unique identifier for that conversion.
- Assign the event trigger and save.
Amounts are sent as whole numbers in minor units: USD 25.99 is sent as 2599. According to its code, the template validates that the value has digits only. The template also supports an optional base tag, with no event, on the Initialization trigger; it is not required because each event tag initializes the pixel.
Consent with the template
The template's published code does not call the pixel's consent command. Since the pixel treats consent as granted as long as it is not denied, the protection has to live in Tag Manager: if the tag does not fire, the pixel is not loaded.
Tag Manager offers two ways to do this:
- The tag's consent settings. Under Advanced Settings > Consent Settings, the option to require additional consent makes the tag run only if the indicated types are granted, according to the Tag Manager help. It works if the CMP updates consent mode, for example the
ad_storagetype. - Conditions on the triggers. If the CMP publishes its decision in the data layer under its own names, you can require that condition on each trigger.
Neither revokes the permission of a pixel that is already loaded. If the visitor withdraws consent in the middle of the visit, subsequent tags stop firing, but the pixel does not receive oaiq("consent", false), which according to OpenAI is the command that deletes its __oppref and __obref cookies. When that behavior is a requirement, option 2 is the right one. The article on consent and the OpenAI pixel covers these cases in depth.
The two routes are implementation alternatives; the choice depends on the consent control and maintenance required.
Option 2: custom HTML tags
The second option replaces the template with custom HTML tags that call the pixel directly. It requires more maintenance, but it lets you control the pixel's own consent and deduplication within the page. The architecture we use has four pieces:
- A base tag on the Initialization trigger. It defines the measurement functions, sets
consenttofalsebeforeinitand loads the SDK only when permission is granted. - One tag per event, with an exact-match custom event trigger. Each one checks the permission again before measuring.
- A permission update tag, fired by the CMP event, with no additional consent checks. That way it can also run when the visitor revokes.
- A duplicate control that prevents sending the same event twice on the same page and requires an opaque identifier for conversions, never an email or a phone number.
If the page initializes more than one pixel, for example for two brands, it is advisable to send with measureSingle, which according to the multiple pixels documentation directs the event to a single pixel. measure sends it to all the initialized ones.
Exclusive content
For signed-in readers
The custom HTML tags, ready to adapt
The code for the base tag, the page view, conversion and permission update tags, the variables they need and a checklist before publishing. Tested with a simulated browser; it does not replace validation on your site.
Log in to access this section →We work to offer the best possible content, which is why some of these explanations are not public.
Your account does not have access to this section. Request a demo
Triggers: when each tag fires
The trigger determines what is measured, and a poorly chosen trigger produces data that looks correct. These are the rules we apply:
- Base or initialization tag: Initialization trigger, once per page. OpenAI recommends that the pixel load early so as not to lose conversions.
- Page view: once per document. In a single-page application, each meaningful navigation needs its own event in the data layer; the automatic view does not guarantee it.
- Conversions: custom event with the exact name the site sends when the action is confirmed. A click on the submit button, the DOM Ready event or the URL of a thank-you page do not confirm that the action took place.
- A single installation: if the pixel is already in the site's code or in another tag, do not add the template. Two installations duplicate events.
Conceptual firing example: measure the confirmed action and avoid ambiguous substitutes.
How to validate the installation
Validation has three layers, and it is best to go through them in order:
- Tag Manager preview. Check that each tag fires with its trigger and only with it. According to the official template's code, the pixel's debug mode is activated automatically in preview and leaves logs in the console. A paused tag does not fire: to test it you must resume it in the workspace, without publishing.
- Browser console and Network tab. With permission denied,
oaiq.min.jsmust not load; with permission granted, it must load only once and the events must go out tobzr.openai.com. - Test session in Ads Manager. In Conversions > Data Source, the web pixel menu offers Test. OpenAI states that the session tags events for a maximum of 30 minutes, only on the same origin, that it may show a sample if the volume is high and that those events count in the normal statistics.
If the site applies a content security policy (CSP), it must allow https://bzrcdn.openai.com in script-src and connect-src, and https://bzr.openai.com in connect-src and img-src, according to the pixel documentation.
Proposed validation path; the diagram does not claim that a test has been run or received.
Troubleshooting
- No events reach Ads Manager: check that permission is granted, that the CSP allows the OpenAI domains and that there is no ad blocker in the test browser.
- Events arrive duplicated: look for a second installation of the pixel, in the site's code, in another tag, or in the template and a custom tag at the same time.
- The event is rejected or shows no amounts: amounts and quantities must be whole numbers in minor units, and contents must use only the documented fields.
- The custom event does not appear: its name must be between 1 and 64 characters, use letters, numbers, hyphens or underscores, start and end with a letter or number, and not match a standard event.
- Conversions are not attributed to the ads: check that the site's redirects preserve the
opprefparameter that the click adds. The differences with Google Analytics are covered in how to measure AI assistant traffic and in the article on ChatGPT Ads in GA4.
What we learned preparing it on our site
In October 2026 we prepared the measurement of cookingmetrics.com with custom HTML tags: seven tags for loading the pixel, consent, page views, confirmed bookings and booking attempts. We chose that route because our CMP publishes its decision with its own event and we needed a revocation to reach the pixel. The import into the container worked, and the tags remain paused for two reasons unrelated to Tag Manager: the CMP did not yet declare OpenAI as an advertising provider, and we could not confirm the completed-booking signal in the data layer.
The practical lesson is that installation is the easy part. What determines whether the measurement is useful is consent and the success signal for each conversion, and neither is resolved inside Tag Manager.
Limits
- The official template has only one published version. Its fields and behavior may change; review the repository before each implementation.
- The code in this guide was not tested against the real OpenAI SDK or on a production site.
- Third-party templates in the gallery were not evaluated for this article.
- Validation confirms that events go out and arrive, not that conversions are attributed to a campaign.
What to do next
Before resuming or publishing any tag, resolve consent and the success signal for each conversion. To measure leads and bookings, see the article on measuring leads and bookings for ChatGPT Ads. If the same conversion is also sent from the server, the article on the Conversions API explains how to share the event identifier.
At CookingMetrics we review Tag Manager containers and their measurement before adding a new channel. The GA4 audit includes that review.
Frequently asked questions
Is OpenAI's template in Tag Manager official?
The gallery shows it with the author openai and links to a repository of the OpenAI organization on GitHub and to the pixel documentation. Google clarifies in the gallery that third-party templates are not provided by Google.
Do I need a base tag in addition to the event tags?
Not with the official template: each event tag initializes the pixel. The base tag is useful if you want to load the pixel early on all pages, as long as the consent rule is respected.
Can I use the template and custom HTML tags at the same time?
Not for the same pixel and the same events: sends and SDK loads would be duplicated. It is best to choose one route per container.
How do I know if the pixel respects consent?
With permission denied, the Network tab must not show the loading of oaiq.min.js or any sends to bzr.openai.com. Repeat the test after granting and after revoking the permission.



