A Google Tag Manager Web custom template that loads the OpenAI Ads Measurement Pixel and reports conversions from ChatGPT Ads campaigns.
Maintained by TensorOps.
For the launch context and implementation rationale, read the TensorOps Labs research note: OpenAI Ads GTM Tag — Open-Source Pixel Template. It covers why the OpenAI Ads pixel benefits from a GTM community template, the two-tag setup, and how browser-side pixel events deduplicate against the OpenAI Conversions API.
Status: unreviewed. Before public Gallery submission you still need to (a) drop a real PNG/base64 logo into
template.tplbrand.thumbnail, (b) confirm naming with OpenAI, and (c) importtemplate.tplinto GTM and run the Tests tab once.
The template provides a single tag with two modes:
| Mode | Purpose | Recommended trigger |
|---|---|---|
| Initialization | Injects oaiq.min.js and calls oaiq("init", {pixelId}) |
All Pages — Page View |
| Event | Calls oaiq("measure", eventName, props, options) and infers the required payload type |
Your conversion trigger |
Supported standard events: page_viewed, contents_viewed, items_added,
checkout_started, order_created, lead_created, registration_completed,
appointment_scheduled, subscription_created, trial_started, plus custom.
Supported event payload fields: inferred type, amount, currency, plan_id,
contents[] (id, name, content_type, quantity, amount, currency), and
event_id for deduplication with the Conversions API.
The template validates common event-shape mistakes: amounts and quantities must be integers, currency is required whenever an amount is set, and custom event names must follow OpenAI's documented naming rules.
- In GTM, Templates → New → Search Gallery.
- Search for "OpenAI Pixel by TensorOps".
- Add it, then create a tag from the new template.
- Download
template.tpl. - In GTM, Templates → New → ⋮ → Import, select the file.
-
Create the Init tag.
- New Tag → "OpenAI Pixel by TensorOps".
- Tag Type: Initialization.
- Pixel ID: paste your ID from OpenAI Ads Manager → Conversions.
- Trigger: All Pages — Page View.
-
Create one Event tag per conversion.
- Tag Type: Event.
- Event Name: e.g.
order_created. - The template infers the required payload type from the selected event.
- Amount / Currency / Contents / Event ID: from your dataLayer variables.
- Trigger: your purchase / lead / signup trigger.
-
Set tag sequencing. On the Event tag, open Advanced Settings → Tag Sequencing and set "Fire a tag before…" to your Init tag, so the SDK is guaranteed to be queued before the event.
-
Verify. Use GTM Preview and watch the network panel for requests to
bzrcdn.openai.com. Enable debug mode on the Init tag for console logging.
Pass the same event_id to both the pixel (this template) and your server-side
Conversions API call. OpenAI dedupes on (pixelId, eventName, event_id).
inject_script→https://bzrcdn.openai.com/sdk/oaiq.min.jsaccess_globals→oaiq,oaiq.qlogging→ debug environments only
The template is a single template.tpl file using GTM's sandboxed JavaScript
runtime. Tests live in the ___TESTS___ section and run inside GTM's template
editor (Tests tab → Run all).
Apache 2.0 — see LICENSE.
This template is published by TensorOps and is not affiliated with or endorsed by OpenAI. "OpenAI" and "ChatGPT" are trademarks of OpenAI.