How does Facebook Pixel work

The Facebook pixel and how it works

If you regularly use Facebook, you will be surprised by the ads in your timeline: Facebook often shows ads for products that the user has previously viewed in an online shop. Therefore the question arises: How does Facebook recognize that a user has visited a website and bought or not bought a product?

Facebook uses tracking pixels. This is one HTML code snippets, which is loaded on every subpage of a website and can send various information to Facebook. In this case, loading means that a Facebook URL enriched with parameters called becomes. The parameters help Facebook to interpret the data received. In the case of Facebook, a user is identified via the user ID. By means of this ID, the assignment is later also made across devices, since users are often logged in on several devices with their Facebook profile. The Facebook pixel uses website data and tries to pair it with user data on Facebook. The unique identification is encrypted on the profile on Facebook.

Important: The transferred data must not identify specific persons. Therefore, no individual persons are addressed, but only groups of at least 20 users who show similar behavior. For this, Facebook uses a so-called hashing process, in which personal data is encrypted in such a way that Facebook can no longer assign it to individual users.

From the point of view of an advertiser, the advantages of the Facebook pixel are obvious: The tracking offers the possibility to measure the return on investment (ROI) of your own investments in the Facebook ad. In detail this means:

  • Optimization of advertisements for conversions (including sales, leads)
  • Tracking of conversions and assignment to an advertisement
  • Creation of custom audiences via a website for remarketing
  • Create dynamic ads
  • Custom conversion (tracking specific events on a website)


Where is the pixel stored?

The pixel is text information that is made available in every Facebook advertising account.

  1. Select the "Pixel" tab in the Business Manager.
  2. Click "Create Pixel".
  3. Select a name for the Pixel and agree to the terms of use for the Facebook Pixel.
  4. Create pixels.

The JavaScript code provided can either be copied directly or sent to an e-mail address including instructions and then set up. Users with no programming knowledge manage the Pixel relatively easily using the Google Tag Manager. If the pixel is correctly integrated, its activities can be monitored in the Business Manager area or via Facebook Analytics.


This is how the Facebook pixel is structured

To better understand how the pixel works, it helps to take a closer look at the structure of the pixel.

The basic code is based on JavaScript and must be integrated on every subpage of a website. No adjustments have to be made to the standard pixel. The pixel always looks the same and only differs in one aspect, the Facebook pixel ID. This varies for each account. Thus there is only one standard pixel per advertising account.

The section fbq ('track', 'PageView') clarifies which event the pixel triggers in this case when a user visits a page. The event “PageView” represents the basic version of the code. It clarifies the “visit to a page”.


Standard events and dynamic parameters

If you want to track whether a user has bought products or completed a registration on your own site, you have to change this event. The pixel therefore shows additional differences with regard to the so-called "standard events" (also standard events or events) and the "dynamic parameters".

Facebook distinguishes between nine different standard events with which the code of the Facebook pixel can be enriched. It is important that the one with the Standard event modified code activated only on the associated page becomes.

The operator of an advertising account must therefore consider which event he would like to track on which subpage. The following three events are most relevant for a classic eCommerce shop:

  • View Content (product viewed)
  • Add to card (added to cart)
  • Purchase

If you want to track whether a Facebook user has made a purchase, you have to include the standard pixel and the "Purchase" event on the order confirmation page, for example. On the shopping cart page, the pixel should be integrated with the event "Add to Card" in order to determine whether someone has placed something in the shopping cart. The event "View Content" is integrated on pure product detail pages in order to track whether users have called up a product.

If you want to understand a purchase with value or create a dynamic ad, you have to add (dynamic) parameters to the tracking pixel. In order to be able to measure the value of purchases and the ROI of advertisements, the event purchase must be supplemented by the following parameters:

In order to show the ROI as meaningfully as possible, the value should be filled dynamically as a net value without shipping costs and VAT.

The following dynamic parameters must be added for dynamic remarketing:

The first case is about actually tracking the value of a conversion. In the second case, on the other hand, it is about addressing a customer again with the product he has previously viewed.


Where and by whom is the pixel integrated?

In order to add the pixel to the website, the text information must be placed between in the code of the website on which the conversions are to be tracked.

The standard events should be added below the standard pixel, in the code between , in order to shorten the loading time of the page. If the pixel were fully integrated in the head of the page, it must first be fully loaded before other elements can be used. The chronological division between head and body avoids prolonged loading times.

Experience has shown that one cares Programmer or the responsible IT department to implement the pixel. Only minimal programming knowledge is required for integration via the Google Tag Manager.


How do I check the pixel?

Any effort is worthless as long as the pixel is not working properly. The Facebook Pixel Helper plug-in is installed quickly and provides initial information about whether and how the pixel has been integrated. If there are no error messages here, conversion tracking should verified with a test order become. When ordering a test, the browser's developer tools (Chrome Console) in particular provide information about the error-free implementation of the pixel. Facebook tracking should be checked regularly. After a relaunch or a change to the website, tracking errors are not uncommon.


Excursus: Custom Events

Custom conversions can be created using standard events, as described above, or using custom events. It always happens that the nine available standard events are not sufficient, or they cannot be added to the default pixel. There are many reasons. Facebook has remedied this with the implementation of URL-based custom events. Custom events allow you to optimize and track a greater number of specific actions (40 maximum) than the nine standard events using URL rules. Important: The standard pixel, as it is described above, is still the basic requirement for both variants.

The advantage of standard events over URL rules is that the event is only triggered when someone is clearly involved in the decisive action. Pixel events are much more stable than fluctuating URL variants, where all possible changes have to be considered. Marking using a pixel event is therefore less prone to errors than marking using a URL. In addition, high-quality events and combinations of events can be tracked via pixel events. An additional advantage of pixel events is that dynamic parameters can be assigned to an event (e.g. purchase value and product ID).


The Facebook Pixel is not a silver bullet, but rather pure code. It provides the necessary basis for sensible control and optimization of Facebook ads. If you want to achieve specific goals and remarketing with your ad, you cannot avoid the integration of conversion tracking.