Getting Started with Facebook Pixel

You can connect your Shopify store to your Facebook Pixel account in the admin. Connecting your store and your Facebook Pixel account will automatically track data for six Standard Events: ViewContent (product views), AddToCart, InitiateCheckout, AddPaymentInfo, Purchase, and Search. Each standard event tracks an action your customers will do while visiting your store.

There are a few things to consider before you start using the Facebook Pixel for your online store. If you want to add your Facebook Pixel account ID, then you will need to remove any existing Facebook Pixel code from your store.

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, sign up for a Facebook account, and then set up your Pixel.

Tip

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.

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.

Remove Facebook Pixel code from your store

There are two places where you might have old pixel code: the theme.liquid file, and Additional content & scripts in your admin. You should check both to make sure you remove all the pixel code before you integrate your store and your Facebook Pixel account.

Remove old pixel code from store pages

  1. From your Shopify admin, click Online Store, and then click Themes (or press G W T).

  2. Find the theme you want to edit, click the ... button, then click Edit HTML/CSS:

    Click Edit HTML CSS button

  3. 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

  4. Delete the Facebook Pixel code.

  5. Save your theme.liquid file.

Remove old pixel code in your admin

  1. From your Shopify admin, click Settings, and then click Checkout.

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

    Additional content 1

  3. 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

  4. Delete the pixel code.

  5. 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.

Tip

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

Using the old Facebook Pixel

The old Facebook Pixel had a custom audience pixel for retargeting customers, and conversion pixels for tracking site conversions. The new Facebook Pixel combines the two pixel types into one pixel for retargeting, optimizing, and tracking. If you are using the old Facebook pixel, then your custom audience pixel was upgraded to the new pixel, but your conversion pixels will be phased out by the end of 2016.

Integrating 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.

Tip

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

    Tip

    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