А Beginner’s Guide to Using Facebook Pixel for E-commerce

A Beginner’s Guide to Using the Facebook Pixel for E-Commerce

What’s inside:

This guide explains how to setup and use Facebook Pixel work in your Ecwid store. You’ll learn:

  • {color:#000;} What Facebook Pixel is
  • {color:#000;} How to understand the Pixel code
  • {color:#000;} How to add Facebook Pixel to your store
  • {color:#000;} Ways you can use Facebook Pixel

This e-book will help you to get the most out of Facebook advertising, to track your conversions and to analyze your performance.

As an e-commerce store owner, you already know that Facebook is vital for your business. Thanks to its massive user base and hungry audience, Facebook can drive traffic and sales to e-commerce stores in any niche imaginable.

If you want to get the most out of Facebook, however, you will eventually need to invest in advertising.

And to get the most out of Facebook advertising, you will need to use the Facebook pixel to track conversions and analyze your performance.

In this e-book, we will show you a step-by-step process for adding the Facebook pixel to your store. We will also show you how you can use this pixel to drive more conversions.

What is the Facebook pixel?

Facebook pixel is essentially a piece of Javascript code that tracks user behavior on any page.

You can think of the Facebook pixel as a “black box” that captures lots of data from a user’s browser. You can later extract this data and analyze it to better understand your users.

Moreover, you can integrate this pixel with a number of tools such as [+ Unbounce ] [   +] to run more targeted campaigns.

While there is nothing stopping you from running a Facebook ad campaign without this pixel, you will get far better insight into your performance if you add it to your store or website.

Suppose you run a t-shirt store. You want to run a remarketing campaign where you target people who’ve visited your best selling t-shirt page, but haven’t purchased anything.

With the help of Facebook pixel, you can create a Custom Audience of people who have visited this page.

You can then offer these customers a 20% off coupon through a targeted Facebook ad to spur conversions.

Understanding the Facebook Pixel Code

The Facebook Pixel code can be difficult to understand at first, even if you’ve used tracking code from AdWords or Google Analytics in the past.

The first thing you need to understand is that the pixel code has two parts: the base pixel code and the event code.

1. Base pixel code

This is the base code that you’ll need to add to your site’s … section. Without it, Facebook can’t track user action, optimize ads or create custom audiences.

Here’s what the code looks like:

The highlighted numerical part after ‘init’ is your Facebook pixel ID. This is unique to each ad account. The rest of the code remains the same for every account.

2. Event code

While you can use the pixel code by itself, Facebook makes it much easier to track specific events (such as adding a product to cart) using event codes.

This is a small piece of code that accompanies the pixel code. It looks something like this:

The event code tracks user actions (or “events”) on a page either as a result of Facebook ads or organic traffic.

You can add different event codes to different pages depending on what you want to track.

Facebook offers tracking capabilities for several “Standard Events” by default. You can see a [+ full list here +] .

This should cover the entire scope of operations for most e-commerce store owners. If you need to track events beyond this, you can create custom events.

For example, if you want to track the number of people who’ve viewed a certain page, you’d add this code to the page:

The part highlighted in blue is entirely optional; it only serves to define what a page view is worth to you (for conversion tracking).

If you’re tracking an action that takes place immediately on page load (such as viewing a product page or reaching an order-confirmation page), you’ll want to add the event code to immediately after the tag.

On the other hand, if you’re tracking on-page actions, such as clicking a button, you’ll want to add the code inline, like this:

You don’t always need to use the event code, but it makes conversion tracking and creating custom audiences much easier.

This might be very confusing right now, but understand that this is merely theory – once you see how it is actually used, things will make much more sense.

How to Add Facebook Pixel to Your Store

You’ll understand the Facebook pixel much better once you actually start using it.

To do this, start off by creating a pixel by following the steps below:

Step #1: Log into your Facebook account. Then click the drop-down menu and select “Create Ads” (if you’ve never logged into Facebook ads before), or “Manage Ads” (if you’ve used Facebook ads before).

Click “Close” on the next screen to show the dashboard.

Step #2: In the dashboard, click on Ad Manager in the top left menu and select “Pixels”.

On the next screen, select “Create Pixel”.

Facebook will ask for a name for your pixel. You are limited to one pixel per account, so make sure that this is something easy to identify and related to your business name.

Click on “Next”. You’ve now successfully created a pixel.

Step #3: When you click on “Next” above, Facebook will ask you to install the pixel code. You have two options here:

  • {color:#000;} Use Facebook’s tag manager or built-in integrations
  • {color:#000;} Install the code manually by copy-pasting

Ecwid doesn’t have a built-in Facebook integration at the moment, so choose the second option.

Facebook will then show you your pixel code. Hover over the code to copy it.

The numbers highlighted in blue above is your Facebook pixel ID. This is unique to your account; the rest of the code is the same for every other user.

By default, the code tracks views (i.e. page opens). You can customize the code with different event codes as shown above.

Step #4: Your next step is to add the Facebook pixel code to your store.

If you can edit your store’s HTML, you can add the code simply by copy-pasting it in the … section.

You can see this source code right now by pressing CTRL + U on your site (on Chrome).

Place the code anywhere on a new line here.

If you’re adding the code to your Ecwid store, you’ll have to first log into your control panel.

Once you’ve done that, go to your Ecwid control panel, then click on Settings -> General -> Cart.

On the next screen, scroll down to the “Tracking code on…” section and select “Enable”. You will need a premium Ecwid account to do this.

After clicking “Enable”, you’ll see a pop-up box. Paste your code into this box and click “Save”.

Your Facebook pixel is now live!

Keep in mind that this is a general-purpose tracking code area; it not specific to Facebook. You can add code from AdWords or Google Analytics here as well.

This code will trigger when a customer reaches your store’s order confirmation page. Ecwid will take data from the customer’s browser and relate it to Facebook, which will then count this as a conversion.

You can then use this data to create custom audiences.

Step #5: After adding the code and saving the settings, check Facebook after a few minutes to see whether your pixel is active.

Log into Ad Manager then click on “Pixels”. Look for a green light next to your Facebook pixel code in the right pane:

Facebook will also show any “Pixel fires” (i.e. number of times the pixel was triggered) on this screen.

You’ll also see a list of actions for which the pixel was triggered – content views, add to cart actions, etc.

Step #6 (Optional): You might be wondering what was all the fuss about event codes.

Here’s how it works: event codes track specific actions on a page. You might want to track number of searches performed on a page, number of ‘add to cart’ actions or number of pageviews.

Specific standard event codes can track any or all of the above, regardless of where the traffic is coming from (paid or organic).

Now when you go to Facebook to create your ads, you can optimize the ads for specific actions (provided you have the event code for it on the page).

You can choose this under “Conversions” on the ad creation page:

Notice how the icon next to “View Content” is green while all the others (“Search”, “Add to Cart”) are inactive?

That’s because the pixel in the above example only includes the “view content” event code.

You can also define custom conversions here, though you won’t need to bother with that for now.

By choosing the conversion event, you can optimize your ads for better performance for that specific event.

It’s not necessary for running an effective campaign, but it does make your job a lot easier.

What are the Uses of Facebook Pixel?

Facebook pixel is a powerful tool for tracking your users and creating hyper-targeted experiences.

As an e-commerce store owner, you’ll mostly use it for the following:

1. Retargeting

Retargeting is a cookie-based technology that uses simple a Javascript code to anonymously ‘follow’ your audience all over the Web, so you can advertise to them later.

Ever looked up for a product on Amazon and then saw it on Facebook later? That’s retargeting .

Facebook knew you visited Amazon because Amazon placed bits of Facebook code (cookies) on its site.

Retargeting is one of the most effective display advertising tactics around.

According to a study by [+ ComScore +] , retargeted ads lead to a 1046% increase branded search and a 726% lift in site visitation after four weeks of retargeted ad exposure.

As [+ WebsiteSetup shows +] , adding cross-device retargeting significantly increases reach and CTR globally, while reducing CPC by as much as 35%.

As a recent [+ MarketingLand +]  article explained:

[_ “It’s not uncommon to see amazing CTRs with retargeting, anywhere from 0.30-0.95% - which is 3-10x higher than the industry average.” _]

Facebook pixel can be used to build audiences of people who have visited specific pages on your site.

Retargeting audiences on Facebook are created under the ‘Audiences’ tab in Ads Manager.

To create an audience of people who have interacted with you Facebook pixel, click “Create Audience” > “Custom Audience”.

You’ll find plenty of ways to create your custom audience.

You can:

  • {color:#000;} Import data from a CSV or text file (such as phone numbers, names, emails, etc.).
  • {color:#000;} Import data from your MailChimp account.
  • {color:#000;} Target people who have visited a specific page on your site
  • {color:#000;} Target people who have performed specific actions in your app
  • {color:#000;} Target people who have engaged with any content on your page

For instance, if you want to target people who have viewed a product, you can select the “Website Traffic” option.

On the next screen, choose “People who visit specific pages”. Then select “URL Equals” and enter your exact url (such as “yoursite.com/your-product-page.html”).

You can change the tracking duration as well.

This will create a custom audience of anyone who has visited your product page in the last 7 days.

What if you want to exclude people who have bought from your store?

In this case, you can select “People visiting specific web pages but not others”, then include your “Thank you” order confirmation page URL, like this:

This will create a custom audience of anyone who has visited your t-shirt page but left without buying.

You can easily see the power of such hyper targeting.

2. Optimization

Before you set up any advertising campaign, Facebook asks you the objective of the campaign:

You can tell Facebook exactly what you want your campaign to do.

If you’re running something simple like a Lead Magnet opt-in or a sale, always use ‘Conversions’ option as your objection.

Tell Facebook what to optimize for by using custom conversions on the page where visitors land directly after they perform your target action (such as buying a product).

This way you collect data and tell Facebook exactly what you want from the campaign. Facebook will then use its own internal optimization capabilities to fine tune your ads for your desired action.

3. Tracking

By using Facebook pixel you can track how many times a particular action occurs. For instance, you can track how many products were sold from a specific ad.

This is achieved through the use of custom conversions  as we saw earlier.

A Custom Conversion is created by selecting a completion page and naming the conversion. Usually the completion page is kind of a thank you page.

Custom Conversions can be created separately from your ads and use them later in the future. They can be found in the ad manager menu:

Facebook pixel can easily track the completion page because it already fires on all your website pages.

You can choose the type of conversion, such as ‘Add to cart’, ‘Purchase’ etc. It also lets you add a monetary value.

For example, if you create a Custom Conversion that tracks visitors to an ebook download page, you can include the cost of the ebook.

This feature helps you to figure out how profitable your ad campaigns are and if the pricing of your products is right.

Once you create a Custom Conversion, it will be tracked for all your ads, whether you choose to optimize for it or not.

You can see the number of particular conversions/events in Ad Manager -> Pixels:

When creating your campaigns, be sure to check the “track all conversion from my Facebook pixel” option at the ad level.


The Facebook pixel can take a while to understand, especially after Facebook merged all tracking pixels into one. But once you start using it, you’ll realize its effectiveness, especially if you use retargeting.

Adding the Facebook pixel to your Ecwid store is dead easy, and once you’ve set it up, you can run all sorts of interesting promos to your best customers.

Go ahead and give the pixel a try and let us know the results in the comments below!

А Beginner’s Guide to Using Facebook Pixel for E-commerce

This guide explains how to setup and use Facebook Pixel in the online store (using Ecwid platform as an example). You’ll learn: – What Facebook Pixel is – How to understand the Pixel code – How to add Facebook Pixel to your store – Ways you can use Facebook Pixel.

  • Author: Lina Vashurina
  • Published: 2017-03-30 16:05:15
  • Words: 2477
А Beginner’s Guide to Using Facebook Pixel for E-commerce А Beginner’s Guide to Using Facebook Pixel for E-commerce