Search by

degriz / openmage-openai-ads

DegrizNet

OpenAI Ads (ChatGPT) measurement pixel and Conversions API for OpenMage / Magento 1.9

Package info

github.com/DegrizNet/m1_openai_ads

Homepage

Type:magento-module

pkg:composer/degriz/openmage-openai-ads

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-11-16 10:04 UTC

This package is auto-updated.

Last update: 2026-11-16 10:06:52 UTC


README

Conversion measurement for ChatGPT advertising. The module installs the OpenAI Measurement Pixel, fires the full set of standard e-commerce events, matches conversions with hashed customer data, and mirrors the same events to the Conversions API from the server so nothing is lost to ad blockers.

Free and open source. No paid edition, no license key.

Features

  • Measurement Pixel loaded from bzrcdn.openai.com, initialised with your Pixel ID.

  • All relevant standard events, each one switchable per store view:

    Event Fired on
    page_viewed every storefront page
    contents_viewed product detail page
    items_added add to cart (survives the redirect)
    checkout_started checkout page, once per quote
    order_created success page, with items, totals and currency
    registration_completed new customer account
    lead_created newsletter subscription
    search catalog search, sent as a custom event
  • Advanced matching. E-mail, phone, first and last name are normalised and SHA-256 hashed in PHP before they reach the browser or the API — raw values never leave the server. Phone numbers get the country calling code added so local numbers stay matchable. Logged-in customers are identified by customer ID, guests by a first-party cookie.

  • Conversions API. The same event, with the same event ID, is sent from the server and deduplicated by OpenAI against the browser event. Amounts are converted to ISO 4217 minor units, including the zero-decimal and three-decimal currencies.

  • Cookie consent aware. The command queue is created immediately, but the SDK is only injected once your consent cookie is set — events fired before consent are buffered and flushed afterwards, or dropped if consent never comes. Works with any banner: you configure the cookie name and value.

  • No stale data. Events are requested per page view from an uncached endpoint, so a full page cache cannot leak one visitor's hashed data into another visitor's page.

  • Attribution kept server-side. The oppref reference from the ad click is stored in a first-party cookie and attached to server-side events.

  • Dry run mode (validate_only) so you can verify the integration without writing conversions.

Requirements

  • OpenMage LTS or Magento CE 1.7 – 1.9
  • PHP 5.6 – 8.3
  • cURL

Installation

  1. Copy the contents of this repository to the root folder (public_html) of your Magento 1.9 / OpenMage store.
  2. Log out and log back into the admin panel.
  3. Flush the cache under System / Cache Management.
  4. Open System / Configuration / Degriz / OpenAI Ads (ChatGPT) Pixel.

Configuration

General — enable the pixel and paste the Pixel ID from Ads Manager → Conversions → Pixels. Turn on Debug Mode while testing: the SDK logs to the browser console and server calls go to var/log/degriz_openaiads.log.

Events — switch individual events on or off per store view.

Advanced Matching — on by default. Turn off the address fields if you do not want city, region, postal code and country sent (these are sent unhashed, as the API requires).

Conversions API — paste an API key from Ads Manager → Conversions → Manage conversion keys, then pick which events are mirrored server-side. order_created, checkout_started and items_added are a sensible set; mirroring page_viewed adds an HTTP call to every page load. Use Validate Only for the first test run.

Cookie Consent — set the cookie your banner writes. The Zero1 GDPR banner uses cookieAlertState with value 1; Cookiebot uses CookieConsent. Leave the value empty to accept any non-empty cookie.

Setting it up in Ads Manager

  1. Create the conversion event in Ads Manager so it counts toward campaign reporting.
  2. Enter the Pixel ID here and enable the pixel.
  3. Walk the funnel — product → cart → checkout → purchase — with Debug Mode on and confirm each event in the console.
  4. Enable the Conversions API and confirm the events arrive on both paths with the same event ID.

Notes

  • Always test on a development copy before going live.
  • Full page cache safe by design. The page itself only carries the pixel bootstrap and public page data. Events and hashed customer data come from /openaiads/data/index, an uncached request, so Fishpig Bolt, Lesti FPC or Varnish can never serve one visitor's data to another. No cache exclusions needed.
  • If your theme replaces the head block, make sure it still renders its children; the pixel block is degriz_openaiads/pixel, named degriz.openaiads.pixel.
  • If a Content Security Policy is in force, allow bzrcdn.openai.com in script-src and bzr.openai.com in connect-src.
  • Tracking never blocks a purchase: every server-side call is wrapped and failures are logged, not thrown.

Author

Anže Voh Magento eCommerce Development at Degriz

License

This project is licensed under the MIT License.

Disclaimer

  • This module is provided "as is", without warranty of any kind, express or implied. Use it at your own risk.
  • The author takes no responsibility for any problems or issues that arise from using this module.
  • You are free to use and modify this module, but you cannot resell it.

Additional Information

I specialize in custom Magento development and have successfully completed numerous projects on the Magento platform. My services include:

  • Custom Theme Development: Creating unique, responsive, and user-friendly themes tailored to your specific business needs.
  • Theme Customization: Modifying existing themes to enhance functionality, improve aesthetics, and ensure compatibility with various extensions.
  • Tracking & Analytics Setup: Correct measurement across OpenAI Ads, Meta, Google Ads and GA4, including server-side conversions and consent handling.
  • Performance Optimization: Ensuring that your Magento store runs smoothly and efficiently, providing a seamless shopping experience for your customers.
  • SEO Optimization: Implementing best practices to improve your store's visibility on search engines and drive more traffic to your site.
  • Ongoing Support and Maintenance: Providing continuous support to ensure your Magento store remains up-to-date and secure.

For more information or inquiries, please visit Magento eCommerce Development.

See also

Installation (Composer)

composer require degriz/openmage-openai-ads

Requires magento-hackathon/magento-composer-installer with "magento-root-dir" set in your shop's composer.json. Alternatively, copy the app/ folder into your OpenMage root.