how to add a facebook pixel to shopify

How to Add Facebook Pixel to Shopify: Step-by-Step Guide

By Daniel Rodriguez
AD

Boosting your Shopify store's marketing effectiveness with Facebook Pixel involves tracking and analyzing user behavior, enabling targeted ads and improved conversion rates. This guide will walk you through the step-by-step process of adding a Facebook Pixel to your Shopify store, optimized for search engines to help your business rank higher.

Before we dive in, ensure you have a Facebook Business Manager account and access to the Facebook Events Manager. If not, you can create one at business.facebook.com. Now, let's get started.

Creating Your Facebook Pixel

Your first step is creating the Pixel in Facebook Events Manager. Here's how:

AD
How To Use Pixels To Create Facebook Ads That Convert
How To Use Pixels To Create Facebook Ads That Convert
the facebook page for how and why to setup facebook pixel on your website blog & shop
the facebook page for how and why to setup facebook pixel on your website blog & shop
How to Set Up Facebook Pixel on Your Website (Step-by-Step Guide)
How to Set Up Facebook Pixel on Your Website (Step-by-Step Guide)

1. Go to eventsmanager.fb.com and click on 'Pixel'.

2. Click 'Connect Data Source', select 'Web', and name your Pixel. Click 'Next'.

How to Add the Facebook Pixel to a Squarespace Website — Louise Henry — Tech Expert & Online Business Strategist
How to Add the Facebook Pixel to a Squarespace Website — Louise Henry — Tech Expert & Online Business Strategist
How I Added Facebook Pixel to My WordPress Site (+ eCommerce Tracking)
How I Added Facebook Pixel to My WordPress Site (+ eCommerce Tracking)
How to Install Your Facebook Pixel on Squarespace or WordPress
How to Install Your Facebook Pixel on Squarespace or WordPress

Adding the Base Code to Shopify

After creating your Pixel, the next step is adding the base code to your Shopify store.

1. From your Shopify admin, go to 'Online Store' > 'Preferences'.

AD

2. Scroll down to the 'Facebook Pixel' section. Paste your Pixel ID (e.g., '1234567890123456') and save your changes.

How to add Facebook Pixel to WordPress?
How to add Facebook Pixel to WordPress?
How To Add Facebook Pixel To WordPress - Kim Scotland Web Design
How To Add Facebook Pixel To WordPress - Kim Scotland Web Design
What Is a Marketing Plan? + How to Write One (2026) - Shopify
What Is a Marketing Plan? + How to Write One (2026) - Shopify
Comment j'ai ajouté le Pixel Facebook à mon site WordPress (+ suivi e-commerce)
Comment j'ai ajouté le Pixel Facebook à mon site WordPress (+ suivi e-commerce)
What is the Facebook pixel? #facebook #facebookads #digitalmarketing #facebookadvertising
What is the Facebook pixel? #facebook #facebookads #digitalmarketing #facebookadvertising
The Facebook Pixel Guide for Creative Entrepreneurs
The Facebook Pixel Guide for Creative Entrepreneurs

Adding Standard Event Code

Adding standard event code to specific pages of your store allows Facebook to track user activity better. Let's add 'AddToCart', 'InitiateCheckout', and 'CompleteRegistration' events.

1. From your Shopify admin, go to 'Online Store' > 'Themes'. Click 'Actions' for your current theme and select 'Edit code'.

AD

2. Open the 'theme.liquid' file (at the root of your theme folders). Add the following script right after the opening `` tag:

a woman smiling with the text how to install the facebook pixel on your wordpress site
a woman smiling with the text how to install the facebook pixel on your wordpress site
How to Install the Facebook Pixel: Squarespace Sites [Step-by-Step Guide]
How to Install the Facebook Pixel: Squarespace Sites [Step-by-Step Guide]
How to install Facebook Pixel on your Squarespace site + set up events
How to install Facebook Pixel on your Squarespace site + set up events
<script>
  fbq('init', '1234567890123456'); // Replace with your Pixel ID
  fbq('track', 'AddToCart');
  fbq('track', 'InitiateCheckout');
  fbq('track', 'CompleteRegistration');
</script>

Replace '1234567890123456' with your Pixel ID. Save your changes and click ' Temploate Review'.

Enabled Enhanced E-commerce Tracking

Enabling enhanced e-commerce tracking in Shopify allows Facebook to access data like products added to cart, quantities, prices, and more.

AD

1. From your Shopify admin, go to 'Online Store' > 'Preferences'. Scroll down to the 'facebook pixel' section and click 'Edit'.

Adding Dynamic Event Code

Now let's add dynamic event code to capture additional data about your products.

1. In the 'Events' section of Facebook Events Manager, click 'Create Rule'.

2. Choose 'Event Source' as 'URL Contains', enter '[yoursite.com]', and click 'Create'.

3. Click 'Add Event' and select 'AddToCart'. Click 'Save Rule'. Repeat for 'ViewContent' and 'Purchase'.

Testing Your Pixel

Before wrapping up, let's test if your Pixel is working correctly.

1. Open Facebook Events Manager and look for your new events in the last 30 minutes. If they're displayed, your Pixel is working.

Congratulations! You've successfully added a Facebook Pixel to your Shopify store. This setup will provide valuable insights to improve your marketing strategies and, ultimately, boost your sales. Monitor your Pixel regularly to ensure it's tracking data accurately. Happy selling!

AD