LW Pixel
Lightweight tracking pixel manager for WordPress, with ChatGPT Ads conversion tracking from the browser and the server.
Overview
| Requires WordPress | 6.6+ |
| Requires PHP | 8.0+ |
| Tested up to | 7.1 |
| License | GPL-2.0-or-later |
| GitHub | lwplugins/lw-pixel |
LW Pixel loads the tracking pixels of the major ad networks and dispatches the standard ecommerce and conversion events for them, in the browser and from your server. No upsell, no tracking, no bloat.
Quick Start
- Install and activate the plugin
- Go to LW Plugins > Pixel
- Add your pixel IDs; each provider has its own settings, including its server-side options
- For WooCommerce shops the ecommerce events fire automatically
To find a setting, use the Quick search field at the top of the sidebar (or press Cmd/Ctrl+K) and type its name: the match opens on its tab, scrolled into view and highlighted.
Installation
Via Composer
composer require lwplugins/lw-pixelManual Installation
- Download the plugin from GitHub Releases
- Upload the
lw-pixelfolder to/wp-content/plugins/ - Activate via the Plugins menu in WordPress admin
Supported pixels
- ChatGPT Ads:
oaiqmeasurement pixel and Conversions API server-side - Meta (Facebook) Pixel:
fbqbrowser pixel and Conversion API server-side (Advanced Matching, External ID, Order Enrich) - Google Analytics 4:
gtag.jsand Measurement Protocol server-side - Google Ads: conversion tracking. The purchase uses the Conversion label. Other conversions sends a conversion for any other event, one
EventName=labelper line:Lead=AbC123(form submissions and thank-you pages),Contact=XyZ789(phone and email clicks), or the name of a custom event. A custom event with a value sends its value too (wp lw-pixel config set gads_conversion_events "Lead=AbC123") - Google Tag Manager: container and
dataLayer. With the GA4 ecommerce dataLayer option (wp lw-pixel config set gtm_ga4_ecommerce true) the WooCommerce events go out in the GA4 ecommerce format:ecommerce: null, thenview_item,add_to_cart,begin_checkoutandpurchasewith anecommerceobject (purchase once per order,transaction_id= order number, net value and items like the GA4 purchase), ready for GA4 and Google Ads tags in GTM. Purchase item prices with tax (gtm_ga4_gross_prices) puts the tax-inclusive unit price on the purchase items, to match a Merchant Center feed with gross prices; the value stays net - TikTok Pixel:
ttq - Pinterest Tag:
pintrkand Conversions API server-side - Microsoft Bing UET:
uetq - Reddit Pixel:
rdt - Snapchat Pixel:
snaptr - X (Twitter) Pixel:
twq - Barion Pixel:
bp(WooCommerce events in Barion’s format)
ChatGPT Ads conversion tracking
- Browser pixel (
oaiq) and Conversions API (server-side), deduplicated with a shared event ID - WooCommerce:
contents_viewed,items_added,checkout_started,order_created(once per order; amounts in ISO 4217 minor units) - Leads and signups: form submissions as
lead_created, new accounts asregistration_completed; page views aspage_viewed - Custom events: your own events as
customwith a validcustom_event_name - Consent: marketing category via LW Cookie, for the pixel and the server-side events
- Optional SHA-256 hashed advanced matching, debug mode and a
validate_onlyconnection test - The API key can live in
wp-config.php:
define( 'LW_PIXEL_CHATGPT_API_KEY', '...' );Events
PageView(automatic, every page)ViewContent: single posts and pages, and WooCommerce productsSearch: search results pagesLead/Contact: form submissionsAddToCart,InitiateCheckout,AddPaymentInfo,Purchase,ViewCart,ViewCategory: WooCommerceLogin,Signup(CompleteRegistration),Comment: server-side, replayed on the next page loadScroll,TimeOnPage,Download: auto-tracked frontend events with configurable thresholdsContact(tel: and mailto: link clicks) andLead(thank-you page match): auto-tracked, off by default- Custom events: define your own in the editor (page_load, click, scroll and time triggers, URL patterns)
Server-side events
- Meta Conversion API: every standard event (PageView, ViewContent, Search, Lead, Contact, AddToCart, InitiateCheckout, AddPaymentInfo, Purchase, CompleteRegistration)
- ChatGPT Ads Conversions API: the same events as the ChatGPT Ads pixel
- Pinterest Conversions API: purchase (
checkout, once per order), add to cart, page visits and product views (page_visit), category views, leads and contacts (lead), searches and sign-ups. Checkout start is not sent server-side, because Pinterest’scheckoutmeans a completed purchase - GA4 Measurement Protocol: the purchase; all events when GA4 is loaded by something else (for example Tag Manager), since GA4 does not deduplicate against
gtag.js - Deduplication: the browser and server copies share one event ID; a purchase uses an order-based ID and is sent once per order and provider
- Consent: each provider’s server copy follows the visitor’s consent for that pixel
- Non-blocking: sent after the response is flushed, or in the background via Action Scheduler; nothing sent is logged
- Cache-safe: page-level events go server-side only on pages that a page cache cannot share between visitors. In the browser,
page_locationis always the URL the visitor actually loaded, so a cached page never reports another visitor’s click ID or campaign parameters
Consent
With LW Cookie (or any plugin that exposes the lw_cookie_is_category_allowed filter) pixels load only after the visitor accepts the matching category. The Consent page lets you choose the consent category of every pixel.
The Barion base pixel is used for payment fraud prevention, so by default it loads for every visitor. Its shop events wait for marketing consent, and the visitor’s answer in the LW Cookie banner is passed to Barion (grantConsent / rejectConsent). Turn off Base pixel without consent to make the whole pixel wait for consent. While it is on, do not block pixel.barion.com in your cookie banner.
Load the Google tag before consent (Google tab, Consent Mode v2, google_tag_before_consent) is for sites that use Google Consent Mode v2 in LW Cookie. When it is on, the GA4 and Google Ads tag (gtag.js) loads for every visitor, so Google Ads campaign diagnostics and Google’s tag checks find it. Until the visitor consents, Consent Mode keeps the tag cookieless, and LW Pixel sends no events: page views and conversions go out once the visitor accepts. LW Cookie lets googletagmanager.com through its script blocker for this, while it still blocks Google’s cookies until consent. The option is off by default and has no effect while Google Consent Mode is off in LW Cookie. Another consent banner that prints Consent Mode defaults can enable it with the lw_pixel_consent_mode_active filter.
Integrations
Form plugins
Lead events fire automatically when any of these forms are submitted:
- Contact Form 7
- WPForms
- Elementor Pro Forms
- Gravity Forms
- Forminator
- Formidable Forms
- Ninja Forms
- Fluent Forms
- WS Form
Other
- WooCommerce: the full ecommerce funnel, with an idempotent thank-you-page Purchase
- LW Cookie: consent-based pixel loading
- LW Site Manager: managed via the Abilities API (
get-options,set-options,list-pixels)
Compliance
- Medical traffic mode: strips PII from event payloads and from server-side user data (Meta CAPI, ChatGPT Ads, GA4 MP). Pinterest needs the IP address and user agent or a hashed email, so in this mode Pinterest sends nothing server-side
- Limited Data Use (LDU): adds Meta
data_processing_optionsfor California / CCPA (auto-resolve or force California); the same condition sends Pinterestopt_out_type: LDP
Migration
The built-in settings importer under LW Plugins > Pixel > Tools detects a supported previous pixel plugin, shows a preview diff and imports in one click. It is also available from the terminal as wp lw-pixel migrate.
WP-CLI
wp lw-pixel status
wp lw-pixel list [--configured] [--format=<format>]
wp lw-pixel config list|get|set|reset
wp lw-pixel migrate list|preview|runstatus: version, configured-pixel count, consent mode, compliance flags, Meta CAPI and GA4 MP statelist: every registered pixel with its enabled and configured flagsconfig: read and change options; booleans accepttrue/false/1/0/yes/no/on/off, array options accept comma-separated valuesmigrate: run the settings importer
FAQ
How do I set up ChatGPT Ads?
- Copy your pixel ID from the ChatGPT Ads Manager.
- In LW Plugins > Pixel, open the ChatGPT Ads settings, enable the pixel, paste the pixel ID and save.
- For server-side tracking, create a Conversions API key in the Ads Manager, paste it (or define
LW_PIXEL_CHATGPT_API_KEYinwp-config.php), turn on Send events server-side via Conversion API and use the connection test. - While testing, turn on debug mode to see every pixel call in the browser console. Turn it off on a live site.
If your site sends a Content Security Policy, allow https://bzrcdn.openai.com (script-src, connect-src) and https://bzr.openai.com (connect-src, img-src).
How do I set up the Pinterest Conversions API?
- In the Pinterest Ads Manager, open the Conversions API setup and create a conversion access token. Note your ad account ID.
- In LW Plugins > Pixel > Other networks, set up the Pinterest Tag, then turn on Pinterest Conversions API (server-side) under it.
- Enter the ad account ID and the token (or define
LW_PIXEL_PINTEREST_TOKENinwp-config.php):
define( 'LW_PIXEL_PINTEREST_TOKEN', '...' );- Turn on Test mode and use the connection test: test events are checked by Pinterest but not recorded. Turn test mode off on a live site.
- Advanced matching (off by default) adds SHA-256 hashed customer data (email, name, address) to the events. Without it, only the IP address, the user agent and the Pinterest click ID (
_epik) are sent.
The browser Tag and the server send the same event ID, so Pinterest counts each event once.
Does it slow down the visitor?
Server-side events are sent after the page was delivered, or in the background through Action Scheduler, and never slow down the visitor.