meta_pixel
Meta Pixel provides comprehensive Meta (Facebook) Pixel tracking for Drupal 10+ with both browser-side and server-side (Conversions API) event tracking capabilities.
This module was created to address integration challenges when combining the existing facebook_pixel and meta_conversions_api modules. It borrows from what were the best parts of these two modules and brings them together in a cohesive implementation supporting both tracking methods simultaneously with proper event deduplication. It also borrows on google_tag's approach to adding events using plugins, so developers can easily create their own plugins for custom events.
Supported Events
Core Events:
- PageView
- CompleteRegistration (user account creation)
- ViewContent (node tracking)
Commerce Events (meta_pixel_commerce submodule):
- ViewContent (product/variation viewing with AJAX variation changes)
- AddToCart
- InitiateCheckout
- AddPaymentInfo
- Purchase
Key Features
- Dual Tracking Methods: Browser-side JavaScript (fbq) and server-side Conversions API with event deduplication support
- Plugin-Based Event System: Extensible event architecture allowing custom event types via plugins
- Commerce Integration: E-commerce event tracking via meta_pixel_commerce submodule (AddToCart, Purchase, InitiateCheckout, AddPaymentInfo, ViewContent)
- Multiple User Identifiers: Collects emails, phones, and address data from account, billing, and shipping sources
- Server-Side Alternative: CAPI provides tracking option when browser-based methods are unavailable
- Privacy Controls: EU Cookie Compliance integration, Do Not Track respect, advanced matching toggles
See the README file for configuration instructions and how to add custom events.
Requirements
- Drupal 10 or 11
- For Commerce features: Commerce module
- For server-side tracking: Facebook PHP Business SDK (installed via Composer)
This is still very new and and in the early stages. So things will probably change as I test it out. But I figured I would put it out there In case anyone likes this approach and wants to help. Patches and suggestions are welcome.