Jon Dramond Jon Dramond
Reading Time: 2 minutes

A Facebook pixel is tool that allows you to track the people interacting with your Facebook ad. This then helps you to determine how effective it is! With this tool, you can check and analyse actions and interaction with your Facebook ads. That is just the start of the usefulness of Facebook pixels as it also allows people to retarget their audiences more effectively with their ads!

You can generate lots more sales on your ecommerce platform with the inclusion of a Facebook Pixel. To find out more about how you can add a Facebook pixel in Magento 2, carry on reading.

Step 1: Download and Install the Facebook Pixel

The first thing that you will be required to do is head on over to the Magento Marketplace and download the Apptrian’s Facebook Pixel extension. Once you have downloaded this, you can visit the app directory from the root directory of your store. Then make directories: code/Apptrian/FacebookPixel. You can then unzip the extension file your downloaded. Upload this to app/code/Apptrian/FacebookPixel.

Step 2: Run the CLI Commands

The next step to adding a Facebook pixel to Magento 2 is to run the CLI commands. To do this, launch an SSH terminal. Then, connect this to your store. Visit the root directory and run a few commands. To enable the module run this command: php bin/magento module:enable Apptrian_FacebookPixel. Next, to upgrade the setup, enter the following command: php bin/magentosetup:upgrade. To then install the static content, you need the following command: php bin/magentosetup:static-content:deploy. Finally, the last thing you need to do is clean and flush the cache. These commands will do this php bin/magento cache:clean and php bin/magentocache:flush.

Step 3: Configure the Facebook Pixel Code in Your Store

This is the final step to configure the Facebook pixel code in your Magneto 2 store. Head on over to Magento 2 and open the admin panel. You will then need to find ‘STORES’ and underneath this you should find ‘Configuration.’ You can then click on the ‘Facebook Pixel.’ You can find this underneath APPTRIAN EXTENSIONS. You can then hit YES from Enabled. This is then when you will place your Facebook Pixel ID on the Magento 2 store. You can save the configuration by hitting the Save Config button which you can find on the top of the page. Once you have done all of this, you can then double check that your Facebook Pixel has been effectively combined to the website.

Step 4: Verify Your Facebook Pixel Has Been Successfully Integrated

The last thing that you will need to do is verify that the Facebook Pixel has been effectively combined to the Magento 2 store. To do this, install the Pixel Helper extension to Google Chrome. Then, launch the store and you’ll find the Facebook Helper extension icon. Hit this button and if the pop up appears then the Facebook pixel has been effectively combined.

If you would like to find out more or need help with implementation, speak to our Magento development team.