Simple Facebook Pixel is stable
Almost three years ago my colleague Andor and I released an initial version of Simple Facebook Pixel. It was just a sandbox project, but it worked for us. We needed only the PageView event, so for a long time that's all that module did -- it added the PageView event to all site pages.
But that is not the case anymore -- we now support 7 events in total.
Today, we released the first stable version, and in this blog post, I will show you how to install and set up the module. We will also see what makes this module different from other similar modules.
At the moment we have support for the following events:
- PageView (all pages)
- ViewContent (node, taxonomy term, and commerce product pages)
- AddToWishlist (Commerce Wishlist/Flag implementation)
Drupal Commerce, Commerce Wishlist and Flag are soft dependencies. You don't have to install any of those modules if you don't need them. You just won't be able to use some events.
The only proper way to install a module these days is to use Composer. So, to install Simple Facebook Pixel execute the following command:
composer require drupal/simple_facebook_pixel
The module doesn't have any external dependencies, so this command will install only Simple Facebook Pixel. Nothing else.
Once installed, you can enable it manually in the CMS or by using Drush:
drush en simple_facebook_pixel
The very first thing you should do is to create a Pixel. Check the following page to find out how to do that: https://www.facebook.com/business/m/pixel-set-up-step-1
Once you have the Pixel code, go to the Simple Facebook Pixel settings form (/admin/config/system/simple-facebook-pixel, Configuration -> System -> Simple Facebook Pixel) and then enable pixel and enter your code.
On this page, you can also disable Pixel for some roles. For example, you probably want to exclude users with the administrator role.
Now you can enable/disable events. You can do this for each content type, vocabulary and product type.
As you can see we have two types of AddToWishlist event. If you have some kind of Flag implementation for Add to Wishlist feature then you just have to choose the flag name and that's it. If you are using Commerce Wishlist module we also got you covered.
Why use it?
You might ask why to use this module when there is an official module created by Facebook. The answer is simple. That module has only PageView event. If that's all you need then you can use it. But, if you need more events then use Simple Facebook Pixel.
You can find out more about Official Facebook Pixel module here.
Another great module is Facebook Pixel. This module is good, but it has fewer events and it's not yet stable. Also, it doesn't have any tests. We decided that adding tests is essential to making our module stable in a production environment.
You can find out more about Facebook Pixel module here.
More events, more config options, stability, and tests are what make Simple Facebook Pixel stand out from the crowd.