Skip to content

A Complete Guide to Facebook Tracking for Beginners

Article by David Vranicar

Tucked away inside websites across the internet, the Facebook Pixel calmly watches what we do online. Whether we’re reading up on politics or adding items to a shopping cart, it keeps tabs for future reference.

And by “future reference,” we mean “future advertising.”

This post will help you understand what the Facebook Pixel is, how to install a pixel, and different ways to use a pixel to improve the ROI of your ads. 

    Start selling online now with Shopify

    Start your free trial

    What Is the Facebook Pixel?

    The Facebook Pixel is a piece of code you can install on your website. It helps to measure the effectiveness of your Facebook ad campaigns by monitoring the actions people take both on your site. 

    You can use the Facebook Pixel code to track events on:

    • Pageviews
    • Time on page
    • Scroll depth
    • Add to cart
    • Purchase
    • And more

    Additionally, it can be used to create retargeting campaigns and remarket to people who have taken a desired action or visited a specific page on your website.

    In short, the Facebook Pixel:

    • Lives on your website
    • Tracks visitors as they interact with your webpages
    • Gives you the ability to build custom audiences for retargeting
    • And enables you to track the ROI of your Facebook and Instagram campaigns

    How Does the Facebook Pixel Work?

    We’re going to get technical for a minute here. It won’t be painful – there will be lots of pictures and not a lot of jargon. But if you want to skip ahead to How to Install Facebook Pixel or How Do You Target People With the Facebook Pixel, no hard feelings.

    Still here? Great. Now, let’s do some shopping!

    We’re going to visit two stores today. The first is Esprit. The other is Nike. There is nothing unusual about these stores; they are simply being used to represent ecommerce in general. To be sure, neither Esprit nor Nike are doing anything unusual or sinister with their tracking and advertising. They’re just clothing stores going about their business and using Facebook pixel tracking to reach frequent visitors.

    Let’s find something on Esprit. Oh, yeah – this white and blue sweater is nice:

    And here is all the Facebook-related code spinning in the background:

    The Facebook Pixel will know when we add the sweater to our cart:

    Of course, we’ll never squeeze into that slim-fit sweater if we don’t stay in shape. So let’s head over to Nike for some new running gear, including these running pants:

    Like Esprit (and every other ecommerce store), Nike has plenty of Facebook code keeping track of our visit:

    But that won’t stop us from adding the item to our cart:

    And Now for the Pixel Tracking Magic

    Let’s say that we leave these sites without buying anything. Abandoned carts are a nightmare for every ecommerce shop, even the big boys.

    Look at what happens the next time we go to Facebook:

    A moment later, just to make sure we remember:

    Another moment, and things get a bit less subtle:

    Nike’s has their own Facebook Pixel ID, and their own ads:

    Indeed, both companies’ Facebook Pixels seem to be working just fine:

    It’s impossible for us to know the sort of targeting rules that Esprit and Nike created for shoppers like us. For example, would we have seen so many ads if we hadn’t added these items to our carts? And maybe geography plays a role, too: Would these ads have appeared with the same frequency if we shopped from, say, South Korea instead of Germany?

    The parameters of these companies’ Facebook campaigns – the rules, the target groups, the bids, the time period, and so on – are entirely unknown.

    Even so, you can see how the Facebook Pixel works:

    • Add the pixel – The process begins after you add a snippet of tracking code to your website.
    • Gather insights – Your Facebook Pixel gathers insights about visitors, such as where they come from, what device they’re using, and other relevant information.
    • Analyze behaviors – Learn how people interact with your website, whether they add a product in their cart or check out a specific product page.
    • Create audiences – Use the data gathered from Pixel events to build lookalike audiences, custom audiences, and more.
    • Assess events – Evaluate conversion events to come up with the best Facebook ad campaigns for your business. 

    How to Install Facebook Pixel 

    Now that you know its function, it’s to install the Facebook Pixel on your website. You can do that by taking the following steps steps:

    1. Create a Facebook Pixel

    First, you’ll need to create your pixel. Head over to your Facebook Events Manager, then click Connect a Data Source > Web. Now select Facebook Pixel and click Connect to continue. 

    how to install the Facebook Pixel

    → Click Here to Launch Your Online Business with Shopify

    Then add Pixel details.

    2. Add the Facebook Pixel to Your Website

    There are three ways to integrate the Facebook Pixel:

    • Manual installation
    • Using an integration or tag manager
    • Emailing instructions to a developer

    Let’s look at each option in more detail:

    1. Add the Facebook Pixel to your website manually

    The Facebook pixel works best when it’s displayed on every page of a website. However, you don’t need to put it on every page; just put the pixel code in the global header, i.e., <head> </head> of your website. Paste the FB pixel code in the middle of the header code, before </head> and after <head>, and click Save Changes.

    2. Use an integration to install the Facebook Pixel in Shopify

    If you own a Shopify store, follow these steps to set up your Facebook Pixel:

    1. Open your Shopify admin, then select Facebook from the Sales channels tab.
    1. Click Settings > Data sharing settings.
    1. Scroll down until you see the Customer data-sharing section. Now click Enable data sharing. 
    1. In the section Choose the data-sharing level, choose Standard, Enhanced, or Maximum.
    1. Choose your pixel from the list, or follow the on-screen instructions to create one.
    1. Click Confirm, and you’re done!

    Pro tip: After you add a Facebook Pixel to your online store, wait for customer activity to happen before checking out your Facebook Ads Manager to see the data. 

    3. Ask a developer to add the Facebook Pixel code to your website

    If a web developer maintains our website, you can also email them instructions and code to add the Facebook Pixel. Select Email Instructions to a Developer, and put in their email address. 

    After the code is added, use the Facebook Pixel Helper to see if it’s working properly.

    Facebook Pixel Helper also informs you about errors – enabling you to redo the installation steps to ensure that it’s working correctly.

    facebook pixel helper

    If the Pixel Helper displays no errors, you can start viewing real-time event and conversion data in your Facebook marketing campaigns. 

    It makes sense that installing the Facebook Pixel is as straightforward as copying and pasting. After all, having the Pixel on your site incentivizes you to advertise with Facebook, as well as Facebook-owned Instagram. That makes Facebook happy.

    Facebook is also happy for you to use the Pixel because – whether you advertise with them or not – you are helping Facebook build richer profiles of its users. Having its tracking pixel scattered all over the internet lets Facebook know what its users are doing outside of the platform.

    Not that anybody would ever accuse Facebook of being sneaky with data, but it is quite the coincidence that I saw this adidas ad on Instagram the same day I was shopping at Nike.

    facebook pixel retargeting ad

    At any rate, incentives are aligned with when it comes to installing the code in your store: You get better advertising, Facebook gets better data.

    How Do You Target People With the Facebook Pixel?

    If we’re being technical about it, the code doesn’t actually do any targeting. Instead, it is the foundation for targeting.

    It’s up to you to tell Facebook how to target.

    Inside of your Facebook Business Manager, you can create “Custom Audiences” with rules ranging from basic to super complex. For example, let’s say you sell fashion accessories, including sunglasses. The Facebook Pixel will know all the Facebook users who browsed your sunglasses, and when they did it. So you could have a Custom Audience of people who visited “sunglasses” pages on your website in the last, say, 30 days.

    facebook pixel people who visited specific web pages

    You can also target Facebook ads to people who have already converted. For instance, maybe you want to treat buyers with a discount code for their next purchase. You could do that by setting a URL rule for a post-conversion page –  like, say, a Thank You page.

    You could flip that around and create a group of people who have been to your store but didn’t get to the Thank You page.

    One more: You can create Custom Audiences based on the amount of money people have 35-year-old spent at your store. A “Big spenders” segment could contain people you want to target with your more expensive items. (And you’ll know who the big spenders are thanks to the pixel.)

    facebook pixel custom audience

    Facebook Pixel’s Additional Targeting Options

    Lookalike Audiences

    One of the great things about Facebook advertising is “Lookalike Audiences.” You can design Lookalike Audiences to reflect the characteristics of your best customers.

    The code knows who did what on your website, and the Facebook platform can use that data to identify people who share similar traits as your visitors. So if your “Big spenders” segment is full of 25-35 year old females who live in urban areas, Facebook can create a Lookalike Audience of other 25-35 year old females who live in urban areas and who Facebook thinks might be interested in your products.

    Standard and Custom Events

    You can also use it to create what are called “custom events,” which are the more evolved relative of “standard events.” Standard events are actions that the Facebook Pixel tracks automatically, like “add to cart” and “purchase” (there are nine total). Custom events, on the other hand, are events that you design yourself, allowing you, in Facebook’s words, “to define more granular data around events.” This could be all sorts of different stuff – scroll depth, button clicks, and video tracking, to name just a few.

    Custom Conversions

    Another fascinating thing about Facebook Pixel is the ability to create Custom Conversions. This is built by choosing a completion page, such as a Thank You page, and giving a name to the conversion. For example, you can use something like “thank you for subscribing, here’s your 20% discount” as the conversion name. And because the tracking pixel is already running on your website, it can track when someone arrives on a completion page.

    facebook pixel custom conversions

    You can also select a conversion category and enter a monetary value for the custom conversion. For instance, if you create one that tracks people to a product page, you can include the cost of the product. This can help you determine whether you’re earning a profit from your campaigns or need to make some tweaks. If the product is priced at $50, but you’re spending $60 for every conversion that comes via Facebook ads, it’s probably time to re-evaluate your campaign setup.

    If you want to optimize ad groups for Custom Conversion, select “Website Conversion” as your Facebook advertising objective, type in your site’s URL, and then choose the conversion you want to track and improve upon. The current maximum number of custom conversions an ad account can have is 100, but Facebook gives you the freedom to delete the ones you’re not using and develop new ones.

    Creating Facebook segments and ads is a science all its own. So for now, let’s leave it there.

    The takeaway is that whether you’re using out-of-the-box events or customize more advanced events, the Custom Audiences you create are underpinned by Facebook Pixel data. It can tell you who looked at the sunglasses. It also knows who did and didn’t get to your Thank You page, and how much they spent.

    Facebook Pixel Is One of Many Advertising Tools

    Facebook isn’t the only advertising tech floating around the code of sites like Nike and Esprit. And that’s why we see the same sort of ads popping up all over the place – not just at Facebook.

    Here, for example, is what a visit to The New York Times looks like a day after shopping around on these two online stores:

    How does The New York Times also know that we were at Esprit? Well, they don’t. But tools like Criteo, which specializes in retargeting, sure do. Criteo is one of the 30 or so advertising tools hooked up with Esprit’s website. Just as the Facebook Pixel helps Facebook fill its ad space with relevant ads, the Criteo’s of the world help The New York Times fill its ad space with relevant ads.

    There are, however, a few things that make Facebook unique in this ecosystem. First off, Facebook is huge. It has two billion-plus daily active users, and at least some of them are going to be part of your target audience.

    Second, Facebook’s ad platform isn’t perfect, but for scrappy ecommerce store owners, it’s pretty great. Designing ads is relatively simple, creating target groups is manageable, and of course, the Facebook Pixel ID is a breeze to install.

    So even if you have ambitious retargeting plans, the Facebook Pixel should be one of the first tools you use.

    Technical Details

    If you want to get a better idea of the mechanics behind all the advertising that ecommerce stores are using, you can use the Ghostery browser extension. Every time you visit a new website, Ghostery will give you a list of the advertising, analytics, and engagement tools living on the site.

    facebook pixel tracking

    You can peer further underneath the hood with Google Chrome’s “Developer Tools,” which is standard in the Chrome browser. That’s the tool we used earlier to look at all of the code firing during our shopping trips at Esprit and Nike.

    Make no mistake: You can run retargeting campaigns without knowing about this stuff. No problem. Just a heads up that there are some tools available if you want to dig around.

    iOS 14’s Effect on Facebook Pixel

    Due to updated rules for third-party tracking in iOS 14.5, updated Apple devices will lack some Facebook pixel functionality. Does that mean we’re doomed? No, because only 14.7% of Facebook mobile users access the site via iOS devices.

    One important iOS 14.5 requirement is that you need to keep the number of custom conversions and standard events to eight. This is the maximum limit. Plus, you can only have one domain for conversion tracking since iOS 14.5 removes the ability to track across multiple domains.

    Conclusion

    With Facebook advertising, you have several opportunities to engage and convert visitors even after you’ve shown them a front-end offer. The kind of data presented by the Facebook Pixel helps you retarget your ads to potential customers in the future.

    The analytics tool provides excellent insights into your audience, delivers ads to audiences who’ve shown interest in your business, and enhances the overall efficiency of your ad campaigns. 

    Seriously, do your business a favor and tap into that pixel goodness!

    Facebook Pixel: Frequently Asked Questions

    What does the Facebook Pixel collect?

    It collects data that makes it possible to track conversions from Facebook ads, including visitor behavior and cross-device activity. As a result, you’re able to generate a more targeted audience for future ads, retarget visitors who have taken specific actions on your website, and optimize existing campaigns to improve Facebook ads ROI.

    How do I get a Facebook Pixel?

    Here are the six steps for creating Facebook Pixel:

    1. Open Events Manager from our Facebook Ads Manager dashboard. 
    2. Click Connect to Data Sources and choose Web.
    3. Select the Facebook Pixel and click Connect.
    4. Add a name for your pixel. 
    5. Enter your website URL and click Continue.  

    How many Facebook Pixels do I need?

    Facebook allows you to create up to 100 pixels in your account. However, you don’t need that many pixels unless you have hundreds of websites with different audiences. One Facebook Pixel with sufficient data is enough to improve ad targeting and create more effective Facebook ads. 

    Start selling online now with Shopify

    Start your free trial

    Want to Learn More?

    Facebook can be huge for your store’s advertising and reach. Here are some more Facebook goodies.

    Related