Getting started with Facebook Pixel

To get started with Facebook Pixel, you set up a Facebook account, set up the pixel in Facebook, and do some other preliminary steps before creating the pixel.

Grow your business

Want to increase traffic to your store? Try using Kit to run your ad campaigns for you.

Before you begin

If you haven't already done so:

  1. Go to Facebook and sign up for a Facebook account.

  2. Review the Facebook setup instructions and FAQ.


If you work with an agency or use an app to manage your Facebook Ads or traffic, then make sure there are no conflicts before integrating your store with Facebook Pixel by including your ID in the admin. Your agency might have requirements that are not supported.

Remove old Facebook Pixel code from your store

You need to make sure that Facebook Pixel isn't already active on your store. Adding a Facebook Pixel account ID to your Shopify store while you have the pixel code already embedded on any of your store pages could give you duplicate or partial data.

There are two places where you might have old pixel code: in the theme.liquid file, and in the Additional scripts box in your Shopify admin. Do the following steps to make sure you have removed all the pixel code before you integrate your store and your Facebook Pixel account.

Remove old pixel code from store pages

  1. Find the theme you want to edit, click Actions, and then click Edit HTML/CSS:
    Click Edit HTML CSS button
  2. Find your theme.liquid file, and search for the pixel code between the <head> tags. It should look something like the image below (where the pixel code is indicated by the number 2):  
    Facebook pixel code
  3. Delete the Facebook Pixel code.
  4. Save your theme.liquid file.

Remove old pixel code from your admin

  1. In the Order processing section, find the Additional scripts text box:

    Additional content 1

  2. Search for the pixel code. It should look something like the image below (where the Facebook Pixel Code is indicated by the number 2):  

    Facebook pixel code

  3. Delete the pixel code.

  4. Click Save.

Create your pixel

You can create only one Facebook Pixel per ad account. If you already have one, then you will see your pixel dashboard in your Ads Manager when you click the pixel tab.

To create your pixel:

  1. Log in to Facebook and go to your Ads Manager.
  2. From the navigation, select Pixels, which appears under the Assets heading.  
    Fb pixel ads manager
  3. Click Create a Pixel.
  4. Enter a name for your pixel. You can have only one pixel per ad account, so choose a name that fits your business.
  5. Make sure you've checked the box to accept the terms:  
    Fb pixel ads manager create
  6. Click Create Pixel.
  7. If you work on your store yourself, and will be using the analytics provided by Facebook Pixel, then click Install Pixel Now. If you have an agency, or another person who will be using the Facebook Pixel data, then click Email Pixel Code, enter the email of that person or group, and click Send.
  8. You can set up Custom Audiences now, or Conversion Tracking, or you can click Done to go to your pixel dashboard.


You automatically track standard events when you integrate Facebook Pixel with your store.

Create a campaign to track the Purchase conversion event

When creating a campaign you can specify that you want to track conversions in your store using the Purchase conversion event:

  1. Go to your Ads Manager.
  2. Select Increase conversions on your website:  
    Fb pixel campaign obj
  3. Enter your the URL of your store.
  4. Select the Purchase conversion event.
  5. Click Continue.
  6. Select your Account Country, Currency, and Time Zone, then click Continue.
  7. In the Audience section, specify details to narrow the target of your ads.
  8. In the Budget & Schedule sectionSelect an optimization for the delivery method for your ad. You might have to click Advanced Options . You can choose:
    • Conversions - recommended by Facebook
    • Impressions
    • Link Clicks to Your website
    • Daily Unique reaches
  9. Select media, text, and links to create one or multiple ads.
  10. Click Place Order.

Find your Facebook Pixel ID

You can find your Facebook Pixel ID in the Ads Manager of your Facebook Ads account:

  1. Log in to Facebook and go to your Ads Manager.
  2. From the navigation, select Pixels, which appears under the Assets heading.
  3. Click Actions and select View Pixel Code to find your account ID:  
    View pixel code button

Your account ID should be a minimum of 15 numbers long and might require you to scroll until you find it. It should look something like this:  

Fb pixel view code

Integrate your store with Facebook Pixel and Dynamic Product Ads

Integrating Facebook Pixel in your admin supports Dynamic Product Ads (DPA). The integration passes the product ID which is required for DPA.

You will need to sync your product catalogue to use Facebook Dynamic Product Ads with Facebook's Business Manager.

Grow your business

Flexify will help you sync your product catalogue.

Adjust Facebook Ads Manager to show results based on Purchase instead of ViewContent

Facebook defaults to the Performance view for the new Facebook Pixel. It will show results based on the event you selected when you set up your campaign. If you didn't select an event, then Facebook defaults to showing all events as conversions in the default reporting view.


The conversion value is the subtotal which does not include taxes or shipping costs.

You can customize the columns of your reporting view to show specific events, like Purchase, if they are not displayed:

  1. Click the Columns drop-down, and select Customize Columns:  
    Fb pixel customize columns
  2. Scroll down or click Websites:  
    Fb pixel customize columns websites
  3. Click Purchase:  

    Fb pixel customize websites purchase


    You can change the order of your columns by dragging and dropping them.

  4. Click Apply.

Want to discuss this page?

Visit the Shopify Community

Ready to start selling online with Shopify?

Try it free