Pixel for OpenAI Ads
WordPress / WooCommerce plugin: corrected OpenAI Ads pixel + server-side Conversions API delivery.
by Reach · github.com/joinreach-ai/reach-pixel-woocommerce · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/joinreach-ai/reach-pixel-woocommerce/archive/refs/heads/main.zipPixel for OpenAI Ads — WooCommerce
WordPress / WooCommerce plugin that installs a corrected OpenAI Ads pixel and forwards conversion events server-side via OpenAI's Conversions API.
Sibling to reach-pixel — the Shopify version of the same product.
What it does
- Injects the corrected OpenAI Ads pixel in your storefront
<head>(noregistration_completed-on-every-page-load bug) - Listens for WooCommerce events and forwards them server-side via OpenAI's Conversions API
- Dual-fire (browser + server) with shared
event_idfor OpenAI dedup - Uses Action Scheduler (WC-bundled) for retry-on-failure event delivery
- PHP 8.0+, WordPress 6.0+, WooCommerce 7.0+
Install (end users)
From the WordPress.org Plugin Directory: pixel-for-openai-ads (pending review at first ship).
Architecture
Designed in ../PLAN-woocommerce-v1.md via /plan-eng-review. Key decisions:
- V1 routing: direct-to-OpenAI from merchant's PHP (no Reach backend)
- Async delivery: Action Scheduler queue with retry
- CAPI key storage:
wp_options+PIXEL_OPENAI_CAPI_KEYconstant override - Event firing: dual (browser JS + PHP hooks) with shared event_id
- Test coverage: PHPUnit + Playwright + regression test for the registration_completed bug
V2 (later) adds an opt-in "send through Reach backend" mode for the data flywheel.
Develop
composer install
composer run phpcs # WordPress Coding Standards — current status: CLEAN ✓
composer run phpcbf # Auto-fix fixable PHPCS violations
composer run phpunit # Requires WP test scaffolding (one-time setup below)
composer run dist # Build wp.org-ready zip → dist/pixel-for-openai-ads.zip
One-time PHPUnit setup
# Requires MySQL/MariaDB running locally
bash bin/install-wp-tests.sh wordpress_test root '' 127.0.0.1 latest
composer run phpunit
Release
Tagging a release on main triggers a GitHub Action that deploys to wordpress.org SVN.
git tag 1.0.0
git push origin 1.0.0
Required secrets:
WPORG_SVN_USERNAMEWPORG_SVN_PASSWORD
File map
pixel-for-openai-ads.php # Main plugin file + headers + bootstrap
uninstall.php # Cleanup on plugin delete
readme.txt # wp.org-format readme
includes/
class-plugin.php # Bootstrap singleton + activation/deactivation + migrations
class-settings.php # Admin page + getters (with PIXEL_OPENAI_CAPI_KEY override)
class-pixel-injector.php # wp_head client-side snippet (no registration_completed bug)
class-event-forwarder.php # WC hooks → Action Scheduler → CAPI POST
tests/
bootstrap.php # WP test environment loader
unit/ # PHPUnit tests
e2e/ # Playwright E2E (TBD)
License
GPL-2.0-or-later. See LICENSE.