empiricompany / openmage-facebook-pixel
OpenMage module for Meta Pixel (Facebook Pixel) integration with automatic e-commerce event tracking and advanced matching.
Package info
github.com/empiricompany/openmage-facebook-pixel
Type:magento-module
pkg:composer/empiricompany/openmage-facebook-pixel
Requires
- php: >=7.4
- magento-hackathon/magento-composer-installer: *
README
OpenMage module for Meta Pixel (Facebook Pixel) integration with automatic e-commerce event tracking and Advanced Matching.
Platform compatibility: this module is compatible with both OpenMage and MahoCommerce.
What It Does
This module automatically tracks e-commerce events on your OpenMage store and sends them to Meta Pixel:
- PageView: Tracks every page view
- ViewContent: Tracks when customers view product pages
- AddToCart: Tracks when customers add products to cart
- InitiateCheckout: Tracks when customers start the checkout process
- Purchase: Tracks completed orders
Optional Advanced Matching sends hashed customer email data for improved tracking accuracy.
Events Tracked
| Event | Trigger | Parameters |
|---|---|---|
| PageView | Every page | — |
| ViewContent | Product page | content_ids, content_type, contents, value, currency |
| AddToCart | Add to cart action | content_ids, content_type, contents, value, currency |
| InitiateCheckout | Checkout page | content_ids, contents, num_items, value, currency |
| Purchase | Order success page | content_ids, content_type, contents, value, currency |
For complete parameter details: Meta Pixel Standard Events
Advanced Matching
The module sends the customer's email (em) for Advanced Matching.
In Auto mode (default), the Pixel SDK hashes the email automatically using SHA-256 before transmission. In Hashed mode, the email is pre-hashed server-side and never appears in plain text in the HTML source.
Data Source Priority
Customer email is retrieved from three sources:
- Logged-in customer — from customer session
- Guest in checkout — from the checkout quote
- Guest after purchase — from the completed order
Modes
| Mode | Description |
|---|---|
| Auto (default) | Passes normalized lowercase email. The Pixel SDK hashes it automatically. |
| Hashed | Pre-hashes email server-side with SHA-256. Email never appears in plain text in the HTML source. |
References
Installation
Via Composer
composer require empiricompany/openmage-facebook-pixel
Via Modman
modman clone https://github.com/empiricompany/openmage-facebook-pixel.git
Manual Installation
Copy the contents of app/ folder to your OpenMage installation's app/ folder:
cp -r app/* /path/to/openmage/app/
Then clear cache:
rm -rf /path/to/openmage/var/cache/*
Configuration
- Go to Admin Panel → System → Configuration → Facebook → Facebook Pixel
- Enable the module
- Enter your Meta Pixel ID (you can find it in Meta Events Manager)
- Optionally enable Advanced Matching for better tracking accuracy
- Choose Advanced Matching Mode: Auto (recommended) or Hashed
- Optionally enable Debug Mode to log tracking data
Testing
- Install the Meta Pixel Helper Chrome extension to verify tracking
- Enable Debug Mode in module settings to log data to
var/log/facebook_pixel.log - See the Meta Pixel support guide for troubleshooting