Fix guide · Shopify · easy · about 20 min

Duplicate OpenAI Pixel events on Shopify

For the finding “Duplicate OpenAI events”. Also for: Any website, WordPress, Webflow, Framer.

What this means

The same event (for example page_viewed or order_created) was sent twice for the same OpenAI Pixel ID within about a second. On Shopify, this nearly always means the OpenAI Pixel (the ChatGPT Ads Measurement Pixel) is installed in two places. Shopify’s own help warns about this before you add a custom pixel: remove or modify existing pixels so that customer events are not counted twice.

OpenAI throws away exact repeats: it keeps the first event with the same Pixel ID, event name and event ID. But when a copy passes no event_id, the pixel gives each call its own random ID (OpenAI does not document this, but you can see it in the request payload), so two copies of one action look like two conversions.

Why it costs you money:

  • ChatGPT Ads counts some conversions twice, so reports look better than reality and your cost per conversion looks lower than it is.
  • Conversion-optimized campaigns learn from inflated data and may optimize toward the wrong results.

This is about two identical browser events. A browser event plus a server (Conversions API) event for the same order is expected; OpenAI counts that pair once when both carry the same event ID (see “OpenAI events have no event ID”).

How to confirm it yourself

Our check runs from a browser in the EU and accepts the cookie banner before looking for duplicates.

  1. Open your store in a private (incognito) window, open developer tools (F12), go to Network and filter by bzr.openai.com.
  2. Accept cookies.
  3. Click the requests and look at the payload: each request carries a list of events, and the pixel batches events that happen close together, so one request can contain both copies. The Pixel ID is the pid value in the request address. Two events with the same type for the same pid at almost the same moment are a duplicate. Different pid values mean two different pixels, which is a separate question.
  4. Two requests for the same pid can also come from two copies of the SDK. In the Console tab, typeof oaiq returns "function" when a copy runs on the page itself (theme code, an app embed or GTM loaded by the theme). Copies in custom pixels and app pixels run in Shopify’s sandboxes and do not show up there, so a "function" result plus a Customer events pixel for the same Pixel ID means two installations.
  5. Repeat on a product page and after adding a product to the cart, with the events your setup sends (for example contents_viewed and items_added). To check purchases, place a test order with Shopify’s test payment gateway or Shopify Payments’ test mode and look for order_created: it should appear once per Pixel ID.

How to fix

Keep exactly one installation per Pixel ID and remove the rest.

  1. List every place a Shopify store can load the pixel:
    • Settings > Customer events: app pixels from ChatGPT Ads apps, and every custom pixel (look for oaiq or your Pixel ID in its code).
    • Apps: every ChatGPT Ads app you installed, including one you tried earlier and replaced. OpenAI does not make a Shopify app; several third-party apps add the pixel, and some add the Conversions API too.
    • Theme code: go to Online Store, open the menu of your current theme, click Edit code, open theme.liquid and search for oaiq.min.js and oaiq(. Check the snippets it includes too.
    • App embeds: Online Store > Edit theme > App embeds icon.
    • Google Tag Manager: OpenAI’s own GTM template, Stape’s OpenAI Ads Pixel tag, and Custom HTML tags with oaiq. GTM itself can also be installed twice (in theme.liquid and as a custom pixel); then every tag fires twice.
  2. Keep one installation. If an app sends both browser and Conversions API events, so that it can share event IDs between them, keep that app and remove the manual copies. If you manage everything yourself, keep one custom pixel (or GTM in one place). Then:
    • delete the OpenAI snippet from theme.liquid and click Save;
    • disconnect custom pixels that send events for the same Pixel ID (Disconnect keeps the code, so you can delete it later);
    • uninstall apps you no longer use, or turn off their pixel in the app’s settings;
    • remove OpenAI tags from GTM, and turn off app embeds that add another copy.
  3. Do not count on the snippet’s own check. OpenAI’s snippet skips loading when oaiq already exists. Shopify documents that a custom pixel runs in its own sandboxed frame and cannot reach the page, and that app pixels run in a web worker. So the check only sees its own frame: a copy in the theme and a copy in a custom pixel (or two custom pixels) each load the SDK and each send their own events.
  4. Check purchase tracking separately. Theme code does not run on checkout pages, and Shopify has retired Additional scripts and script tags on the Thank you and Order status pages. Purchases are therefore tracked by app pixels or custom pixels, which Shopify loads on the storefront, checkout, Thank you and Order status pages. A custom pixel that sends order_created next to an app that also sends it doubles every order.
  5. Merge custom pixels that use the same Pixel ID (for example one named for checkout and one for the storefront). Each one loads on every storefront and checkout page, so each sends its events everywhere unless its code says otherwise.
  6. Check page views. Send page_viewed from one place only. A custom pixel that subscribes to Shopify’s page_viewed event and a theme copy that also calls oaiq("measure", "page_viewed", ...) send every page view twice.
  7. Add event IDs as a safety net. In a custom pixel, pass Shopify’s event ID, or the order ID for purchases, as event_id. An accidental second call with the same ID is then dropped by OpenAI. This does not replace removing the extra copy.
  8. Save every change, and publish GTM if you changed it.

Common causes

  • The snippet is still in theme.liquid after a ChatGPT Ads app or a custom pixel was set up.
  • Two ChatGPT Ads apps are installed, or an old one still runs its pixel.
  • A custom pixel sends events for the same Pixel ID as an app.
  • GTM runs twice, or two GTM tags send the same event.
  • Two custom pixels with the same Pixel ID, each loading on every page.

How to verify the fix

  1. In a private window, accept cookies and check that each event appears once per Pixel ID: on page load, on a product page and after adding to cart.
  2. Place a test order and check that order_created leaves once.
  3. Re-run the check on IsPixelWorking. The issue should be gone.

Questions people ask

Can I use two ChatGPT Ads apps at the same time?

Not for the same Pixel ID. Each app sends its own events, so every action is counted twice unless both use the same event IDs, which separate apps have no way to agree on. Pick one, and uninstall the other or switch off its pixel.

Sources

More OpenAI guides