degriz / openmage-openai-ads
OpenAI Ads (ChatGPT) measurement pixel and Conversions API for OpenMage / Magento 1.9
Package info
github.com/DegrizNet/m1_openai_ads
Type:magento-module
pkg:composer/degriz/openmage-openai-ads
Requires
- php: >=5.6
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
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_viewedevery storefront page contents_viewedproduct detail page items_addedadd to cart (survives the redirect) checkout_startedcheckout page, once per quote order_createdsuccess page, with items, totals and currency registration_completednew customer account lead_creatednewsletter subscription searchcatalog 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
opprefreference 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
- Copy the contents of this repository to the root folder (
public_html) of your Magento 1.9 / OpenMage store. - Log out and log back into the admin panel.
- Flush the cache under System / Cache Management.
- 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
- Create the conversion event in Ads Manager so it counts toward campaign reporting.
- Enter the Pixel ID here and enable the pixel.
- Walk the funnel — product → cart → checkout → purchase — with Debug Mode on and confirm each event in the console.
- 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
headblock, make sure it still renders its children; the pixel block isdegriz_openaiads/pixel, nameddegriz.openaiads.pixel. - If a Content Security Policy is in force, allow
bzrcdn.openai.cominscript-srcandbzr.openai.cominconnect-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
- OpenAI Ads Pixel for Magento 2
- OpenAI Measurement Pixel documentation
- OpenAI Conversions API documentation
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.