Categories: Magento 2 Tutorials

How to Add Facebook Pixel in Magento 2

Facebook Pixel is a tracking tool will allow you to determine the effectiveness of your Facebook ads. You can easily check and analyze the actions and the way people interact with your ads and behave on your store as a result of the ad. The tool goes beyond that, though, and allows you to create retargeting audiences for your ads as well. Every ecommerce can benefit greatly from Facebook Pixel by generating more sales. So today in this guide I’m going to teach you how to add Facebook Pixel in Magento 2. For this, I will use Facebook Pixel extension by Apptrian.

Steps to Follow

  • Download and Install Facebook Pixel Extension
  • Run CLI Commands
  • Configure Pixel Code in your Store

Download and Install Facebook Pixel Extension

Download the Apptrian’s Facebook Pixel extension from the Magento Marketplace. After downloading, go to the app directory from the root directory of your store and create directories: code/Apptrian/FacebookPixel. Unzip your downloaded extension file and upload it to app/code/Apptrian/FacebookPixel. The final directory will look like this:

Run CLI Commands

Launch an SSH terminal and connect it to your store. Then go the root directory and run the following commands: Enable the module: php bin/magento module:enable Apptrian_FacebookPixel Upgrade the setup: php bin/magento setup:upgrade Deploy static content: php bin/magento setup:static-content:deploy Clean and Flush the cache: php bin/magento cache:clean php bin/magento cache:flush

Configure Pixel Code in your Store

Open the admin panel of your store and then navigate to STORES → Configuration: Click on Facebook Pixel under APPTRIAN EXTENSIONS: Then select Yes from Enabled and enter your Facebook Pixel ID: Now save the configuration by clicking on Save Config from top of the page: It’s time to verify if Facebook Pixel successfully integrated to your Magento 2 store. Install Facebook Pixel Helper extension to your Google Chrome browser. Launch your store and at the top of the browser you can see the icon of Facebook Helper extension. Click on the icon: You’ll see this popup screen: If the image above pops up, that means Facebook Pixel has been successfully integrated with your Magento 2 store!

Wrapping Up

Facebook Pixel is one of the best tools that can help you in getting large number of sales. After following this tutorial, I hope you can easily add Facebook Pixel to your Magento 2 store. If you still face any issue related to this tutorial, then just leave your query in the comment box below and I’ll get back to you!
Syed Muneeb Ul Hasan

Syed Muneeb Ul Hasan is an expert in PHP and Magento, he prefers to educate users in implementing and learning Magento. When not working, he loves to watch cricket.

View Comments

  • after configuring the magento 2 extension and add chrome extension, i always got this error "The Facebook pixel code on this page didn't load, so no information was sent to Facebook." from the facebook pixelhelper chrome extension

    • It seems that you have not configured it properly. Did you have run all the CLI Commands and also added the correct Facebook Pixel ID?

Share
Published by
Syed Muneeb Ul Hasan

Recent Posts

Building Employee Trust and Dedication – A Complete Guide

In the highly competitive modern workplace, trust, and employee loyalty are crucial factors for long-term… Read More

3 months ago

12 Winning Strategies for Small Businesses Marketing

In the ever-evolving world of small business developing and implementing effective marketing strategies is critical to… Read More

3 months ago

Top 10 App Development Companies in Dubai 2024

With one of the highest internet penetration rates, the UAE has set out to revolutionize… Read More

3 months ago

Transforming Industries: How Amazons GPT44X is Revolutionizing AI Technology

Artificial Intelligence (AI) has been continually evolving, leading to remarkable advancements in various industries. Among… Read More

8 months ago

Top Magento 2 Extensions for 2023

Extensions, extensions and lots of extensions. We all love extensions, don’t we? After all, extensions… Read More

11 months ago

Unleashing the Power of Software Testing: Cooperating with a Testing Firm

Software quality is crucial to a firm's success across industries in the quickly changing digital… Read More

11 months ago