Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenAI Pixel by TensorOps — GTM Community Template

A Google Tag Manager Web custom template that loads the OpenAI Ads Measurement Pixel and reports conversions from ChatGPT Ads campaigns.

Maintained by TensorOps.

Research note

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.tpl brand.thumbnail, (b) confirm naming with OpenAI, and (c) import template.tpl into GTM and run the Tests tab once.

What it does

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.

Installation

Option A — Community Template Gallery (after publication)

  1. In GTM, Templates → NewSearch Gallery.
  2. Search for "OpenAI Pixel by TensorOps".
  3. Add it, then create a tag from the new template.

Option B — Import locally

  1. Download template.tpl.
  2. In GTM, Templates → New → ⋮ → Import, select the file.

Quick start

  1. 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.
  2. 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.
  3. 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.

  4. 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.

Conversions API deduplication

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).

Permissions used

  • inject_scripthttps://bzrcdn.openai.com/sdk/oaiq.min.js
  • access_globalsoaiq, oaiq.q
  • logging → debug environments only

Development

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).

License

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.

About

OpenAI Ads Measurement Pixel — Google Tag Manager Community Template by TensorOps

Resources

Stars

5 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages