How to add a pixel to Shopify

Facebook pixel

When you set up the Facebook channel, you can add a pixel to track customer data and behaviour on your Online Store. To use a Facebook pixel, you need to set a customer data-sharing level. It's up to you to decide how much data you want to track using the pixel. The Standard data sharing setting sends only customer behaviour. The Enhanced and Maximum settings send additional customer information including name, location, and email address.

You can create a Facebook pixel using Facebook Ads Manager, or in 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.


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.


Add a Facebook pixel to your online store

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 Shopping, Facebook Shop, 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 from your online store


  1. In your Shopify admin, click Facebook.
  2. Click Settings.
  3. In the Data sharing settings section, click Disconnect to remove your current pixel.
  4. Connect another pixel, or create a new one.

If you 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. For more information on customer data-sharing events, refer to Facebook data sharing.