Facebook pixel

To add a Facebook pixel to your online store, you need to have the current version of the Facebook channel installed.

To create a Facebook ad account, go to Facebook. You can set up your Facebook pixel using Facebook Ads Manager, or create one using the Facebook channel.

If you've added a Facebook pixel to your online store theme code before, then remove the Facebook pixel code from your online store after you set up your pixel using the Facebook channel.

Facebook pixels can help improve your stores marketing capabilities and the performance of Facebook ads. To create Facebook ads you need to connect a Facebook ad account.

To use a Facebook pixel, you need to set a customer data-sharing level. Levels can be set at Standard, Enhanced, or Maximum. If you choose Maximum level data-sharing, then your store uses Facebook's Conversions API as well as a Facebook pixel.

Creating a Facebook pixel

You can create a new Facebook pixel directly in the Facebook channel by clicking Create new in the pixel set-up box, or you can create a Facebook pixel in Facebook Ads Manager. To create a pixel in Facebook Ads Manager, refer to the Facebook Help Center.

Before you add a Facebook pixel

Before you can add a Facebook pixel to your store, you need to set up a Facebook account and a Facebook Business Manager. If you have those already, then complete the steps in Add a Facebook pixel. If you don't have those set up, then complete the following.


  1. In the Get started with Facebook section, click Get Started.
  2. In the Market your products on Facebook section, click Start setup.
  3. Connect your Facebook account, Business manager, and a Facebook page.

Add a Facebook pixel

When you add a Facebook pixel to your Facebook channel, the pixel integrates with your online store. A Facebook pixel can be added when you're setting up Instagram, Shops, or Facebook Marketing, but it's required only for the Facebook Marketing feature. Before you can add a Facebook pixel, you need to enable data sharing in the Customer data-sharing section.

You can manage your Facebook pixel in the Data sharing settings within the Settings section of the Facebook channel.

In the Customer data-sharing section of your Data sharing settings in the Facebook channel, there's a list of pixels that you have created. Click Connect to connect a preexisting Facebook pixel or click Create new to create a new Facebook pixel.

After you add a Facebook pixel to your online store, make sure that it's working by using Facebook Ads Manager. Learn about how to tell if your Facebook pixel is working from the Facebook Help Center.


  1. In your Shopify admin, click Facebook in the Sales channels section.
  2. Click Settings, and then click Data sharing settings.
  3. In the Customer data-sharing section, click the Enable data-sharing toggle.
  4. In the Choose data-sharing level section select Standard, Enhanced, or Maximum.
  5. Select your pixel from the list.
  6. Click Confirm.

Change or remove a Facebook pixel code from your online store

If you have a preexisting Facebook pixel ID added to the Facebook channel, then you can replace it in the Data sharing settings of the Facebook channel by clicking Disconnect.

If you've edited your theme file code to add a Facebook pixel, then you need to remove the pixel code before you can add a Facebook pixel ID using the Facebook channel. If you don't remove the pixel code, then your store will have more than one pixel on it, which can result in duplicate or incorrect data in your reports.

Remove pixel code from your theme file

  1. In the Current theme section, click Actions, and select Edit code.
  2. Click the theme.liquid file to open the code editor.
  3. Delete the Facebook pixel code. You can find it between the <head> and </head> tags.
  4. Click Save.

Remove your Facebook pixel in your Online Store preferences

  1. In your Shopify admin, click Online Store > Preferences.
  2. In the Facebook pixel section, click Change.
  3. Delete the Facebook pixel, and then click Save.

Customer data-sharing events

After you add a Facebook pixel in Shopify, the pixel tracks certain events on your online store, such as when a customer views a certain page. You can use the data from these events to learn more about how customers interact with your store. Learn more about using Facebook pixel events to create campaigns and track conversions at the Facebook Help Center.

Events that track an order value use an order's subtotal, which doesn't include taxes or shipping costs.

After you integrate a Facebook pixel with your online store, the pixel automatically tracks the following events.

Facebook pixel standard event descriptions
Event name Event description
ViewContent When a visitor views a page, such as a product page
Search When a visitor makes a search
AddToCart When a visitor adds a product to the shopping cart
InitiateCheckout When a visitor clicks the checkout button
AddPaymentInfo When a visitor enters payment information in the checkout
Purchase When a customer completes a purchase and views the thank you page in the checkout

Ready to start selling with Shopify?

Try it free