ChatGPT Ads conversion tracking with Google Tag Manager: the complete setup
Google Tag Manager is the fastest way to install ChatGPT Ads conversion tracking without touching your site's code. This guide builds it from scratch: the oaiq base tag, the data layer variables, purchase and lead tags with deduplication IDs, Consent Mode, the community templates, server-side GTM for the Conversions API, and a test routine that proves each event arrives.
The short answer
To set up ChatGPT Ads conversion tracking in Google Tag Manager, create a Pixel ID in Ads Manager, add a Custom HTML base tag with the oaiq snippet on all pages, then add one event tag per conversion that calls oaiq("measure", ...) with values from your data layer and an event_id. OpenAI doesn't publish its own GTM template, so you either build these two tags yourself (about 15 minutes) or use a community template such as Stape's. Add server-side GTM later if you want the Conversions API.
Step 1: before you start
- GTM installed on every page, including the confirmation or thank-you page.
- A data layer push on success. For purchases, the GA4-style
purchaseevent withecommerce.transaction_id,valueandcurrency. For leads and sign-ups, a custom event your developer pushes when the form or sign-up actually succeeds. - A Pixel ID. Ads Manager → Conversions → Data Sources → Create → Web Pixel.
Step 2: the base tag
Create a new tag: Custom HTML, named OpenAI Pixel – Base, containing OpenAI's snippet:
<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: true });
</script>
- Trigger: Initialization – All Pages, so the pixel exists before any event tag runs.
- Advanced settings → Tag firing options: Once per page, which prevents double initialization on single-page apps that use history-change triggers.
- Remove
debug: truebefore you publish.
Step 3: data layer variables
| GTM variable | Type | Value |
|---|---|---|
DLV - transaction_id | Data Layer Variable | ecommerce.transaction_id |
DLV - value | Data Layer Variable | ecommerce.value |
DLV - currency | Data Layer Variable | ecommerce.currency |
CJS - amount minor units | Custom JavaScript | see below |
function () {
var v = Number({{DLV - value}});
return isFinite(v) ? Math.round(v * 100) : undefined;
}
OpenAI wants integer minor units, so $129.99 must arrive as 12999. Doing the conversion in one variable keeps it in one place you can audit. * 100 is right only for two-decimal currencies; zero-decimal currencies such as JPY need no multiplier.
Step 4: the conversion event tags
One Custom HTML tag per conversion. For a purchase:
<script>
oaiq("measure", "order_created", {
type: "contents",
amount: {{CJS - amount minor units}},
currency: {{DLV - currency}}
}, { event_id: {{DLV - transaction_id}} });
</script>
- Trigger: Custom Event, event name
purchase. - Tag sequencing: fire OpenAI Pixel – Base before this tag.
- Don't send an undefined ID. If
transaction_idcan be missing, add a trigger condition such asDLV - transaction_iddoes not equalundefined; without it, deduplication against the Conversions API fails.
Leads and sign-ups follow the same pattern with the customer_action shape:
<script>
oaiq("measure", "lead_created", { type: "customer_action" }, { event_id: {{DLV - lead_id}} });
</script>
Fire lead tags on the form's success event, not on a click or page load. GTM's built-in Form Submission trigger often fires on failed submissions or not at all on AJAX forms, so a data layer push from the success callback is more reliable. If you can only use a thank-you page, guard against reloads double-counting: iOS Safari in particular reloads pages when you switch tabs.
Mapping your existing GA4 events
| GA4 data layer event | OpenAI event | Data shape |
|---|---|---|
page_view | page_viewed | contents |
view_item | contents_viewed | contents |
add_to_cart | items_added | contents |
begin_checkout | checkout_started | contents |
purchase | order_created | contents |
generate_lead | lead_created | customer_action |
sign_up | registration_completed | customer_action |
Step 5: Consent Mode
Pick one of two patterns, depending on whether you need opt-in consent where you advertise.
- Block the tags until consent. In each OpenAI tag's Consent settings, choose Require additional consent for tag to fire and add
ad_storage. Nothing loads until the visitor agrees. - Load the pixel, gate measurement. In the base tag, call
oaiq("consent", false)beforeinitwhen consent is denied by default, then fire a small tag on your consent-update event that callsoaiq("consent", true). Events blocked while consent was off are not replayed.
Don't remove consent controls to raise your numbers. The Conversions API, sent from your server with the visitor's consent status respected, is the legitimate way to recover conversions the browser loses.
Community GTM templates
| Template | Container | Notes (November 2026) |
|---|---|---|
| Stape OpenAI Ads Pixel | Web | Maps GA4 data layer events to OpenAI names; one Pixel ID per page; checks Consent Mode ad_storage before loading. |
| Stape OpenAI Ads Conversions API | Server | Sends server events with a Pixel ID and API key; supports several action sources and a validate-only mode. Can set the __oppref cookie from server GTM. |
| TensorOps OpenAI Pixel | Web | Open source; injects the bzrcdn loader. |
| TAGGRS Conversions API tag | Server | Open source. |
Templates are maintained by their authors, not OpenAI, so check the changelog before you rely on one. One trap from Stape's changelog: its server tag generates event IDs automatically by default. If your web tag sends the order ID as event_id, pass the same ID to the server tag (for example with a Unique Event ID variable shared across both containers) or deduplication fails.
Adding the Conversions API through server-side GTM
A server container lets you send each conversion a second time, server to server, so it survives ad blockers and browser restrictions. You need a running server container, a stream from the web container to it (usually GA4), the Conversions API key from Ads Manager (separate from the Advertiser API key), and the same event_id on both copies. If you don't already run server-side GTM, sending the Conversions API from your backend's order or sign-up handler is often simpler, because it can retry failures; events older than seven days are rejected, and one bad event fails a whole batch. The Conversions API section and deduplication rules in our main guide cover the payload.
Step 6: test, then publish
- GTM Preview. Confirm the base tag fires on Initialization and the event tag fires after it, with real values in each variable.
- Browser. With
debug: true, check the console, then the Network tab for a request tobzr.openai.com. A tag that “fired” in Preview hasn't necessarily sent anything. - Ads Manager. Conversions → Data Sources → your Web Pixel's three-dot menu → Test → enter the URL → Start testing, complete the action, and check the labeled event in Event Stream.
- Remove
debug: true, Submit and Publish the container. Attributed conversions take 24–48 hours to appear.
Five GTM mistakes that break ChatGPT Ads tracking
- Sending dollars instead of cents.
129.99instead of12999puts revenue off by 100×. - Firing on page load or click instead of the success state, which counts failed submissions.
- Event tag before the base tag. Fix with tag sequencing or the Initialization trigger.
- Two senders, two IDs. A template and a Custom HTML tag both sending
order_createddouble-count. - A Content Security Policy that doesn't allow
bzrcdn.openai.comandbzr.openai.com. See the CSP table.
Once events arrive, attach the conversion event setting to your campaign; conversions only count from that moment. The rest of the setup is in the 7-step ChatGPT Ads conversion tracking guide.
ChatGPT Ads GTM Setup: frequently asked questions
Is there an official OpenAI Google Tag Manager template?
Not as of November 2026. OpenAI publishes the pixel snippet and documentation; GTM templates come from third parties such as Stape, TensorOps and TAGGRS. A Custom HTML tag with OpenAI's snippet works without any template.
Which GTM trigger should the ChatGPT Ads base tag use?
Initialization – All Pages, with the tag set to fire once per page. That makes sure the pixel exists before any event tag runs.
How do I send purchase value from GTM to ChatGPT Ads?
Read ecommerce.value with a Data Layer Variable, convert it to integer minor units in a Custom JavaScript variable (Math.round(value * 100) for two-decimal currencies), and pass it as amount with currency.
Can I track ChatGPT Ads leads with GTM's Form Submission trigger?
You can, but it's unreliable on AJAX forms and can fire on failed submissions. A data layer push from the form's success callback is the safer trigger.
Do I need server-side GTM for ChatGPT Ads?
No. Server-side GTM is one way to send the Conversions API. Sending it from your own backend works just as well and makes retries easier. The pixel alone works, but it loses conversions to ad blockers and browser restrictions.
How does ChatGPT Ads GTM tracking work with Consent Mode?
Either require ad_storage consent on the OpenAI tags so they don't fire until consent, or load the pixel with oaiq("consent", false) and switch it to true on your consent-update event.
Sources and further reading
- OpenAI Developers — Measurement Pixel (snippet, consent, CSP, testing in Ads Manager)
- OpenAI Developers — Conversions API (deduplication, batching, timestamps)
- Stape — ChatGPT Ads tracking configuration guide (web and server templates)
- OpenAI Help Center — Troubleshooting conversion tracking for ChatGPT Ads
See which ChatGPT answers mention you, free
GTM tells you what your paid clicks did. A free AI-visibility scan shows the prompts where ChatGPT already recommends your brand, the ones where it names competitors instead, and the sources it cites. The first scan is free and needs no card. Want the tags built and proved for you? See our conversion tracking implementation.
Run my free scan