This module allows you to integrate the Facebook Pixel into your Drupal site to track user activity and conversions. It supports common events like viewing content, completing registrations, adding to cart, initiating checkout, and purchases, with the latter three integrated with Drupal Commerce.
Integrates the Meta Pixel (formerly Facebook Pixel) with Drupal to report conversions, build audiences and understand how visitors use your site.
Starting with 3.x, events can also be sent server-side through the Meta Conversions API (CAPI).
Features
- Browser pixel and server-side CAPI tracking, with automatic event deduplication
- Client-side and server-side tracking can be switched on separately for each event: PageView, ViewContent, CompleteRegistration and Commerce events (AddToCart, InitiateCheckout, Purchase)
- Cache-safe PageView tracking, so pages stay cacheable for anonymous users
- "Event Emitter" block and ViewContent pseudo-field
- Consent management through the Klaro! submodule
- Optional Parameter Builder support for better CAPI match quality
- Plugin-based event system for adding custom events
For event types, parameters and Events Manager setup, see Meta's documentation.
Consent management (Klaro!)
3.x includes the new facebook_pixel_klaro submodule, which integrates with Klaro! Cookie & Consent Management. It blocks both the browser pixel and server-side Conversions API events until the visitor has given consent. This matters because server-side requests don't pass through the browser, so client-side script blocking alone can't stop them.
To use it, install and configure Klaro!, then enable the submodule. If you use a different consent solution, you must make sure yourself that no tracking, client- or server-side, happens without valid consent.
Versions
- 3.x (Drupal 11): A complete rewrite, based on and merged with Meta Pixel by @loze. Thank you! It adds server-side tracking (CAPI), consent integration and a new plugin-based event system. See the 3.0.0-alpha1 release notes. Please test carefully before upgrading from 2.x.
- 2.x (Drupal 10/11): Stable, client-side pixel only, receives maintenance fixes only.
Similar projects
- Meta Pixel: merged into 3.x of this module
- Simple Facebook Pixel
Disclaimer
This is free, open source software, licensed under the GPL and provided "as is", without warranty of any kind. Tracking users and sharing their data with Meta affects their privacy. You alone are responsible for using this module in compliance with all applicable laws (e.g. GDPR, ePrivacy, CCPA). That includes obtaining valid consent where required and disclosing the tracking in your privacy policy.
Ask your assistant about Facebook Pixel
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.