How to set up a Facebook pixel

A Facebook pixel is an analytics tool that measures effectiveness of your ads and tracks visitors’ activity on your site. Learn how to create a pixel and add it to your site.

A pixel helps you:

— to serve advertising for those who performed certain actions on your site or visited a particular page (remarketing);

— to create a custom audience from the visitors who will probably perform a desired action (submit a form, take part in a contest, etc.);

— to measure effectiveness of your advertising campaigns and understand which ads influence the visitors’ behavior on the site.

Your Facebook pixel triggers when a visitor views your site or takes some actions: clicks a button, adds an item to the cart. It tracks these actions and sends the data to the Event Manager on your Facebook page. This data allows you to see which actions your customers perform and serve them your ads on Facebook.

How to create a Facebook pixel

A Facebook pixel is a snippet of JavaScript code for your site.

1. Open the Events Manager tab on Facebook. If you don’t have an account, then first sign up with Facebook.

2. Click on Connect data sources.

3. Select Web.

4. Select Facebook pixel.

5. Fill out Name your pixel and click Continue.

6. Select Manually add pixel code to website.

7. Copy the code.

How to add the Facebook pixel to your site

After you have copied the pixel code, go to SettingsCode injection, paste the code to the upper field and click Save.

Creating a custom conversion

Use custom conversions if you want to track unique actions of your visitors and to optimize advertising for the events which are important for you business. Custom conversions can include submitting a form, adding an item to the cart, subscribing for emails and others. To do this, add a Facebook goal code into the settings of the required element.

Go to the Form settings and select the Goals tab.

Enter your goal code into Custom HTML code of the goal, for example, <script>fbq('track', 'Lead');</script>. It is a standard Facebook goal code, “Lead” is a variable. You can type any word instead of “Lead”.


Follow the instructions above to set up goals: to add an item to the cart, purchase, book, see the catalog and any other events on the site that are important for you.

Learn more about a pixel in these  Facebook instructions,  you can also find standard event codes here.




© 2012–2022 Flexbe Inc.