How to Manually Add Facebook Pixel to Magento 2?

How to Manually Add Facebook Pixel to Magento 2?

Facebook marketing is an effective way to promote your brand and increase sales. With its detailed targeting capabilities, you can accurately reach your target audience. There is hardly any noteworthy business that does not run Facebook ads these days.

But marketing campaigns are of no use if you can’t measure their performance and optimize them accordingly. If you don’t know who is visiting your store as a result of the campaign and what actions they are taking, what is your cost per sale and how to further refine your audience, it is but a waste of time and money.

So if you are running any type of Facebook ad campaign for your Magento 2 store, it’s essential to use Facebook pixel to measure the performance of your campaign.

What is Facebook Pixel?

The Facebook pixel is an analytics tool that allows you to measure the effectiveness of your advertising campaign. A code called Facebook pixel code is generated when you create a campaign inside Facebook.

By inserting the code into the

<header> section of your Magento 2 store, Facebook will start collecting data. The code will fire when someone takes an action on your store i.e. clicking add to cart or making a purchase. You can analyze how well your ad is performing, further optimize it or use the data to create remarketing campaigns (show ads to those who visited your store).

How to Get Facebook Pixel Code?

Once you have created your campaign, go to your Facebook Ads Manager account. Open the Navigation Bar and select Events Manager. Hover your mouse over the + sign on the left sidebar and click Connect Data Sources. add-facebook-pixel-magento-2 Select Web and follow all the steps to create your Pixel code. Now click on Install Code Manually to get your Pixel code. install-facebook-pixel-code-manually Now you can get the pixel code for your ads account by clicking on Copy Code.

How to Add Facebook Pixel Manually to Magento 2 Store?

To install the Facebook pixel code manually to Magento 2, all you have to do is paste the tracking code inside the <header> section of your store.
  • Login to Magento 2 admin panel.
  • On the left sidebar, click Content -> Design -> Configuration.
  • Select the store and storeview you want to add pixel code and click on edit.
  • Go to HTML Head -> Script and Style Sheets and paste your pixel code.
  • Click Save Configuration and flush cache to apply the changes.

You can install the free Facebook Pixel Helper chrome extension to check if the pixel code was installed correctly.

After you have installed the extension, go to your website and click on the small icon to open Pixel helper. If you installed pixel code properly, information will be displayed like this.

Feel free to get in touch in case you have any issue in your Magento 2 store.

Related Articles: