How to Add a Meta (Formerly Facebook) Pixel to Shopify

Oct 20, 2021
Aug 25, 2020
11 mins
On this page
How to Add a Facebook Pixel to Your Shopify Store

Many store owners find it challenging to add a Meta (formerly Facebook) pixel to Shopify. However, the many benefits of the Meta pixel make its addition to your store vital.

Having a Meta (formerly Facebook) pixel properly installed on your Shopify store is crucial for your success in Facebook advertising. And as Facebook is one of the most popular advertising platforms out there, you want your Facebook ads to be as profitable as they can be.

This article covers everything you should know about successfully setting up a Meta pixel on your Shopify store and how it can boost your store’s earnings. You will also discover tips to troubleshoot common Shopify pixel issues.

What is Meta (formerly Facebook) pixel?

The Meta (formerly Facebook) pixel is a tracking code generated from your Facebook ad account and implemented on the header section of your Shopify store’s website.

It captures specific actions visitors perform on your site and provides you with data to help you refine your Facebook and Instagram advertising campaigns to maximize performance.

You can use the data your Meta pixel records to show your ads to different audience segments based on their actions on your Shopify store. After creating custom audiences based on your Pixel data, you can also use them to create lookalike audiences to acquire new customers.

The Meta pixel is created and managed using the Facebook Business Manager.

I don't want to go too deep into technicalities, but if you're interested, we have an excellent article explaining in further detail how does Meta pixel work.

Why should I add a Meta pixel to my Shopify store?

The Meta pixel has great importance in three areas: Audience creation, measurement, and optimization.

the Facebook Pixel's importance in 3 areas: audience creation, measurement, and optimization

Let's break it down into the 5 main benefits of adding the Pixel to your Shopify store.

1. Create custom audiences for better ad targeting

Wouldn’t it be great to be able to show your ads to people who already showed interest in your brand?

Well, with Pixel-based custom audiences you can do exactly that.

Retargeting people who visited your store and encouraging them to purchase more products will definitely improve your conversion rate and increase your sales significantly.

Moreover, unless you sell a single product, audiences have different product interests. And even if you sell a single product, audience behavior in your store may be diverse.

Creating custom audiences based on the Meta pixel data will also allow you to tailor your ads to different audience segments based on the products they’re interested in.

Example: If you are running an apparel store and you want to promote a new line of men's shirts, you can create a custom audience of people who showed interest in men's shirts or general men's apparel in your store. You can use your Pixel data to create a custom audience of people who added various men's apparel to their cart, for example, and display them ads promoting your new men's shirts to increase your sales.

2. Retargeting using dynamic product ads

Facebook Dynamic Product Ads

Not every store visit may earn you a purchase. Nevertheless, you can capture the activities of your store visitors and use this data to retarget them with dynamic product ads.

Meta pixel can help you do that. It will capture details of visitors who have clicked products and even added them to their cart but did not complete the purchase.

If you set up your catalog, you can use this data provided by your Meta pixel to run dynamic product ads showing these people exactly the same products they left in their abandoned carts to encourage them to come back and complete the purchase.

3. Lookalike audience creation

Creating lookalike audiences using Meta pixel data is one of the most powerful solutions for acquiring new customers.

Lookalike audiences are groups of Facebook users with similar characteristics to the people in your source audience - in this case, people who visited your store and took action in it.

Facebook has rich data about its user characteristics and it can provide you with great help finding exactly the people who have a higher chance to drive conversions for you.

Example: If you create a custom audience of the people who made purchases in your Shopify store, you can create a lookalike audience of people with similar characteristics. These people are likely to make purchases in your store as well and that’s a great way to expand your customer base.

4. Optimize your ad campaigns for conversions

One of your objectives when running ads is to display them to an audience likely to earn conversions for you.

The data you collect using the Meta pixel can help you deliver ads to audiences, which are likely to engage with your products and convert. It will display your ads to people with a higher probability of taking desired actions like making a purchase or signing up for a newsletter.

Example: If you are advertising to increase the number of sales on your Shopify store, you can ask Facebook to optimize your campaign for purchase. Based on your Meta pixel data and Facebook’s database, your ads will be shown to people who are prone to make purchases and are interested in brands like yours. Facebook targets these people based on user activity and will display your ads to an audience with high chances of conversion.

5. Understand what actually works

If you don’t analyze your advertising performance and act upon your insights, you’re basically shooting in the dark.

The Meta pixel provides you with essential data regarding your ad performance and you better take advantage of that to improve your future campaigns.

Tracking ad attribution to conversions on your Shopify store will let you know exactly which ads work and which don’t, so you can distribute your advertising budget wisely and improve your results. This data will also help you plan your future campaigns.

You can also analyze your performance among different audience segments according to demographics, placements, and devices. This will help you enhance your audience targeting.

Example: If you run a campaign that includes 5 different ad sets, but only one of them drives purchases on your Shopify store, you can pause all the others and scale the top-performer. You can also go down to the ad level and focus only on your successful ads.

This was a brief summary of the great advantages of the Meta pixel. You can, of course, read another article in order to learn how to use Meta pixel in ads.

If you're planning a Black Friday/Cyber Monday campaign (or any other big sale), you should check out our 10 Black Friday/Cyber Monday tips for Facebook advertisers.

How to add a Meta pixel to Shopify

If you didn’t create a Meta pixel yet, you should read our article about creating a Meta pixel.

Do you have a Meta pixel already? Great!

Let’s install it on your Shopify store then.

How to install the Facebook Pixel on your site

Removing old pixels from your Shopify store

If you have taken over an existing store or already installed a pixel on your store and you want to use a new one, you should first remove any old pixel from your store to avoid duplication of Meta pixels and conveyance of incorrect data.

You can remove any old Pixels from your store by editing the theme.liquid file if it was hard-coded into the store theme or using Online Store > Preferences.

Removing an old Meta pixel by editing the theme.liquid file

  1. Access your Shopify admin and go to Online Store -> Themes.
  2. In your Current theme section, click Actions, and then select Edit code.
  3. Click the theme.liquid file in order to open it in the code editor.
  4. Search for the Meta pixel code between the header tags <head> and </head>. You can also search for “fb” via Ctrl + F on Windows or ⌘ + F on Mac to locate the Meta pixel script.
  5. Delete the code and click Save.

Removing the old Meta pixel via Preferences

  1. Select “Online Store” on your Shopify admin and go to “Preferences”.
  2. Remove the current Meta pixel ID from the “Facebook Pixel account”.
  3. Click “Save” for the changes to take effect.

Adding Meta pixel to your Shopify store

You can add the Meta pixel to your website via Shopify or via Facebook’s Events Manager.

Add your Pixel ID to your Shopify store’s preferences

  1. First, you need to go to Facebook’s Events Manager and copy your Pixel ID.
  2. To add your Meta pixel ID to your Shopify store's preferences, go to your Shopify dashboard > Online Store > Preferences.
  3. Paste your Pixel ID under “Facebook Pixel ID”.
  4. Click “Save” to apply the changes.

Implementing the Meta pixel via the Shopify integration

  1. Go to the Events Manager.
  2. Select your pixel.
  3. Click “Continue Pixel Setup” and then “Use a Partner”.
  4. Note: If you already installed your pixel on another website, you can connect it to your Shopify store as well by selecting “Partner Integrations” on the left-side menu when you enter the Events Manager.
  5. Select “Shopify” from the partner integration list.
Shopify partner integration
  1. Follow the on-screen setup instructions.

Meta pixel standard events for Shopify

Christmas at the office

Meta pixel standard events for Shopify are visitor activities that the Pixel captures to help you understand how they interact with your store. These activities range from landing on your store through interaction with products to check out.

  • Add To Cart: Tracks data of visitors adding products to their shopping carts.
  • Add Payment Info: Fires when visitors enter payment information during the checkout process.
  • Initiate Checkout: Tracks visitor activities when they click the checkout button.
  • Purchase: Tracks when customers complete a purchase and view the “Thank You” page in the checkout flow.
  • Search: Tracks information of visitors when they search for information or products on the store.
  • View Content: Captures visitor activity when they visit store pages like product pages.

Custom conversions

When should you create additional custom Meta pixel conversions beyond the standard events you set up for your Shopify store?

Do it when you want to tell Facebook what’s the value of specific conversions for you.

You can also use customization to distinguish between people who viewed different products in your store. Later on, you’ll be able to show them exactly the ads they'll be interested in.

Custom conversions use URL rules based on specific URL or URL keywords, domains, or additional parameters.

Read another one of our articles if you wish to learn how to set up custom conversions on your Shopify store.

An example of a useful custom conversion

Let’s say you have a clothing Shopify store.

You decided to create a Facebook ads campaign to promote your new leggings. Hence, you want to target an audience of people who will be interested in this kind of product.

In this case, you can create a View Content event and add a URL-based rule that will make the Pixel fire whenever someone views a page at a URL that contains the keyword “leggings”.

Once you achieve a big enough number of conversions, you can create a custom audience of people who completed this event and target them.

Offline events

What if, in addition to your Shopify store, you also have a physical store?

How can you track the effect your online advertising has on sales in your “real-world” store?

Have no fear, Facebook offline events are here!

Tracking your offline conversions will allow you to get a full view of your ad performance and also let you create custom and lookalike audiences based on visitors to your physical store.

Efficiently monitoring offline events is essential for implementing a successful omnichannel marketing strategy.

Read another one of our articles if you wish to learn how to set up offline events.

How to check if your Meta pixel is working?

The most simple way to check that your Meta pixel was successfully installed on your Shopify store is by utilizing Google Chrome’s Facebook Pixel Helper extension.

This extension is now also available for Microsoft Edge and not only for the Chrome browser.

The Pixel Helper will show you whether your Pixel is active and help you troubleshoot different issues.

Use this link to add the Facebook Pixel Helper Chrome extension to your browser and go to your store.

If your Pixel is working, the extension icon will turn blue, and it will show the number of active Pixels on the store’s website. Check also that the Pixel installed on your store has the same ID as the one you see in the Events manager.

Clicking on the extension icon will open a pop-up window, that will tell you whether your Pixel is working properly. If not, an error notification will appear.

You can troubleshoot Pixel-related issues using Facebook’s Diagnostics and Test Events tools. Moreover, Facebook’s Test Events tool will help you test that your Pixel registers events properly.

Meta pixel is not matching products with my catalog

Your Pixel might not be sending data on user activity and the most common reason for that is faulty Meta pixel and product catalog sync.

The first thing you can do to fix this issue is to install the Facebook Pixel Helper Chrome extension to verify that the Pixel is associated properly with your product catalog. Remember to turn off your adblocker for effective results. If they are not associated properly, you can proceed with the troubleshooting tips below.

Important! The product catalog is owned by Shopify. Therefore, if you connect a Facebook channel with a Shopify store, Shopify doesn't allow you to change the catalog ownership.

You should add a product feed to a separate self-owned product catalog that you will create.

This is how you do it:

You can use Flexify to obtain a product feed URL. Once you obtain the feed URL, you should add it to a new product catalog using the procedure below

  1. In your Facebook Business Manager, go to Business Settings. Under Data Sources on the left side menu, select “Catalogs”.
Go to Catalogs on Business Manager
  1. Click “Add” and select E-commerce as the category.
  2. Select “Upload Product Info” and ensure that your business’ name appears under “Who owns this catalog?”. Give your catalog an indicative name and hit “Create”.
  3. View the catalog you just created and go to Product data sources > Add Data Source > Add New Product.
  4. Select “Use Data Feeds”.
  5. Select “Set a Schedule” in order to make sure your inventory updates automatically. Paste the URL you got from Flexify under “Add a Data Feed URL”.
  6. Go to Event data sources and click “Connect to Tracking”.
  7. Select your Pixel to connect it to your catalog (make sure it’s the Pixel you set up on your store). Click “Done” and your product catalog should be now well-connected for tracking and use for dynamic ad targeting.

Key takeaways

In conclusion, installing a Meta pixel on your Shopify store is crucial for succeeding with Facebook ads. Now you also know it’s not such a complicated process.

Having a Meta pixel installed on your store will help you improve your targeting, expand your customer base, and gain more conversions.

Both Facebook and Shopify provide you with interfaces that will make it easy for you to install the Pixel properly.

I’ve also provided you with important information regarding the events you can track with your Pixel and about different ways to identify and troubleshoot Pixel-related issues.

So, I think you’re good to go now. Good luck!

*Contributed to this article: Caleb M.

Think Your Ad Strategy Still Works in 2023?
Get the most comprehensive guide to building the exact workflow we use to drive kickass ROAS for our customers.
Pixel is not enough post-iOS 14

After the iOS 14.5 update, the Meta Pixel alone can no longer give you all the data you need to make effective scaling decisions. Solution? Get accurate performance data with Madgicx Cloud Tracking (MCT).

Oct 20, 2021
Aug 25, 2020
Yuval Yaary

Yuval is the head of Content Marketing at Madgicx. He is in charge of the Madgicx blog, the company's SEO strategy, and all its written marketing materials.

Start your 7-day free trial today

Get Started
Get Started
No credit card required
Free training + live chat support
No results? Get a free trial extension
Facebook Ad Optimization checklist ebook

Should we just give this to your competitors?

We’ve created the most comprehensive guide to help you build the exact workflow we use to drive kickass ROAS for our customers. Want a free copy?

Get free e-book
Get free e-book

No, let my competitors have it