Shopify Facebook Pixel Integration

By December 20, 2018February 19th, 2019Blogs, Shopify Tutorial
facebook-pixel

Adding a Facebook pixel to your online store

You can integrate a Facebook pixel with your online store to help you understand customer behavior and traffic. A Facebook pixel collects data about how customers are using your online store pages, so that you can more effectively plan your ad campaigns to find new customers.

Before you add a Facebook pixel to your store, you can learn more about the Facebook pixel at the Facebook Help Center.

Note

If you want to speed up your online store growth, try using Kit to run your Facebook ad campaigns.

Before you begin

Before you can add a Facebook pixel to your online store, you need to have a Facebook ads account and you need to set up the pixel in Facebook Ads Manager. If you’ve used a Facebook pixel with your online store in the past and you want to create a new pixel, then you might need to remove Facebook pixel code from your online store first.

Note

If you work with an advertising agency or use an app to manage your Facebook ads or traffic, then make sure that adding a Facebook pixel to your online store won’t cause duplicate or incorrect data in your reports.

Creating a Facebook ads account

Before you can create a Facebook pixel, you need a Facebook Ads Manager account. To create an account, go to Facebook.

Tip

To see more videos, visit our YouTube channel.

Step-by-step instructions from the Facebook Help Center

You can find step-by-step instructions for using the Facebook pixel with Shopify at the Facebook Help Center.

Tip

To see more videos, visit our YouTube channel.

Remove Facebook pixel code from your online store

If you’ve used a Facebook pixel with your online store in the past, you might need to remove its code in Shopify before adding a new pixel. Adding a second Facebook pixel to your online store could cause duplicate or incorrect data in your reports.

You might have added the code for a Facebook pixel in your store files, such as the theme.liquid file. Remove any existing Facebook pixel code from all of your store files before you create a new Facebook pixel.

Note

If you added a pixel ID in your online store preferences, then you can change it to a new pixel ID after you create the new pixel in Facebook.

Remove pixel code from your theme file

If you’ve added the Facebook pixel to your online store by editing your store’s theme in Shopify, then you can remove the existing pixel code from your theme.liquid file.

Steps:

  1. From your Shopify admin, go to Online Store > Themes.
  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.

Creating a Facebook pixel

You can create a Facebook pixel in Facebook Ads Manager. For the steps on creating a Facebook pixel, go to the Facebook Help Center.

Add a Facebook pixel ID to your online store preferences

You can add a Facebook pixel ID to your online store preferences in Shopify to integrate the pixel with your online store. Using this integration doesn’t require you to edit your online store code. Instead, you’ll enter the Facebook pixel ID in your online store preferences. Find detailed instructions for connecting your Shopify account to Facebook from Facebook Advertiser Help.

Steps:

  1. From your Shopify admin, go to Online Store > Preferences.
  2. In the Facebook Pixel section, add your Facebook pixel ID:
    • If you’re adding a pixel for the first time, then enter the Facebook pixel ID:  
    • If you’re changing to a new Facebook pixel from an existing one, then click Change before entering the new Facebook pixel ID.
  3. Click Save.

After you add the pixel to your online store, then you can 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.

Note

If you’ve recently added a Facebook pixel to your online store, then you need to wait for customer activity before you’ll see any data in Facebook Ads Manager.

Facebook pixel standard events

When an action happens on your online store after you’ve added a Facebook pixel in Shopify, the pixel counts the action as an event. You can use event data to learn more about how customers interact with your store. Learn more about using Facebook pixel standard events to create campaigns and track conversions at the Facebook Help Center.

After you integrate a Facebook pixel with your online store, it automatically tracks 9 standard events:

Event nameEvent description
ViewContentWhen a visitor views a page, for example a product page
SearchWhen a visitor makes a search
AddToCartWhen a visitor adds a product to the shopping cart
AddToWishlistWhen a visitor adds a product to a wishlist
InitiateCheckoutWhen a visitor clicks on the checkout button
AddPaymentInfoWhen a visitor enters payment information in the checkout
PurchaseWhen a customer completes a purchase and views the thank you page in the checkout
LeadWhen a visitor clicks a sign up, for example a click to signup for a trial
CompleteRegistrationWhen a visitor completes a registration form, for example a signup for a service