Facebook Pixel (Meta Pixel): Events, Conversions API and Tracking via a Tracker

The Facebook pixel is code that tells Meta what a visitor from your ad did on your site. Here is how Meta Pixel works, which events it needs and why in affiliate marketing it is almost always paired with server-side events.

Tracking and Analytics10 min read
Facebook Pixel (Meta Pixel): Events, Conversions API and Tracking via a Tracker
Contents
  1. How the Facebook pixel works
  2. Meta Pixel standard events
  3. How to install the Facebook pixel
  4. Browser limitations: why the pixel loses events
  5. Pixel and Conversions API: how they work together
  6. Facebook pixel when working through a tracker
  7. Common Facebook pixel mistakes
  8. How ArtisanClo sends conversions to Meta
  9. Summary

Without events, the Meta ad account only knows how many people clicked the ad. What happened next (a lead, a purchase or leaving after a second) is reported by the Facebook pixel. How completely and accurately it works affects both the report and whom the algorithm will show your ads to tomorrow.

Meta Pixel is a JavaScript snippet placed on your site's pages that sends events to Meta: page views, leads, purchases and others. Based on these events the ad system measures campaign results, builds audiences and optimizes delivery. In the current interface the pixel is called a dataset in Events Manager, and its server-side partner is the Conversions API.

How the Facebook pixel works

The pixel code has two parts.

  1. The base code loads Meta's library and sends a PageView event every time a page opens. It goes into the <head> of every page on the site.
  2. The event code is called at the right moment: on form submission, on the thank-you page, on a button click.

When a visitor arrives from an ad, the link carries the fbclid parameter. The pixel stores it in the first-party cookie _fbc, and _fbp holds the browser identifier. Using these values Meta links an event on the site to the ad click. What fbclid is and where it comes from is explained in fbclid, gclid, ttclid: what these parameters are.

The simplest event call on a thank-you page looks like this:

<script>
  fbq('track', 'Lead', {value: 10, currency: 'USD'});
</script>

Meta Pixel standard events

Meta offers a set of standard events. Use them instead of your own names: the algorithm understands better what to optimize for.

Event When to send What for
PageView when any page opens baseline traffic, visitor audiences
ViewContent view of a key page: offer, product audiences of interested users
Lead lead form submission optimizing for leads
CompleteRegistration completed sign-up services, apps, dating
Contact call, tap to messenger leads without a form
AddToCart, InitiateCheckout cart and checkout start e-commerce
Purchase payment, confirmed sale optimizing for revenue
Subscribe subscription subscription services

Besides standard events you can send custom events and create custom conversions: rules such as "event X with parameter Y" or "a page with a given URL was opened".

Event parameters

You can add an amount (value) and a currency (currency), a product ID and a category to an event. The amount is especially important for Purchase: without it, value optimization and ROAS are impossible. On metrics, see affiliate marketing metrics: ROI, ROAS, EPC, CR.

Which event to optimize for

  • Lead: many events and fast campaign learning, but leads include junk and duplicates.
  • Purchase or an approval event: reflects money more accurately, but arrives later and less often.

A common approach is to start with Lead and switch optimization to confirmed sales once there are enough of them. On lead statuses, see conversion statuses: lead, hold, approved.

How to install the Facebook pixel

  1. Create a dataset in your ad account's Events Manager.
  2. Install the base code first thing in the <head> of every page. Site builders usually have a "Pixel ID" field for this.
  3. Add events to the actions that matter: the form, the thank-you page, the messenger button.
  4. Verify your domain in Business settings; Meta recommends this so you can manage events for your domain.
  5. Check that it works in the Test events tab of Events Manager or with the Meta Pixel Helper browser extension.
  6. Choose the optimization event in the ad set settings.

Tip. Submit a test lead yourself and check that the event arrived once, with the right amount and currency. Re-firing when the thank-you page is refreshed is a frequent cause of inflated results in the ad account.

How to check that the pixel is working

After installation, walk the visitor's path yourself: open the page via an ad link with a test fbclid, submit the form and wait for the thank-you page. In Events Manager, the Test events tab should show PageView and Lead, once each, with the right parameters. Then look at the dataset overview a few hours later: it shows how many events came from the browser and how many from the server, and whether there are warnings about duplicates or missing parameters. Repeat the check after every landing page edit; a broken event code can go unnoticed for a long time until results drop.

Browser limitations: why the pixel loses events

The pixel runs in the visitor's browser, and anything that gets in the browser's way gets in its way too.

  • Ad blockers stop Meta's code from loading.
  • Cookie restrictions in Safari and other browsers shorten the lifetime of identifiers, making it harder to tie an event to a click.
  • In-app browsers of Facebook and Instagram sometimes lose part of the data during navigation.
  • iOS privacy rules let users opt out of in-app tracking, and some events reach the ad account delayed or aggregated. Meta's attribution rules have changed more than once, so check the current terms in the platform's own help center.
  • Leaving before the code loads. If someone closed the thank-you page within a second, the event may never have been sent.

Hence the discrepancy: the pixel shows fewer conversions than the affiliate network. Why Facebook and tracker numbers never fully match is covered in Facebook Ads tracking: macros, fbclid, Conversions API.

Pixel and Conversions API: how they work together

The Conversions API (CAPI) sends the same events from a server: your backend or your tracker. Ad blockers and cookies do not affect it, and the server knows things the browser does not: that a lead was approved or rejected a week later.

Meta Pixel Conversions API
Who sends visitor's browser server or tracker
Ad blockers and cookies get in the way do not matter
Status after the lead unknown known, if the network sent it
What you need code on the page pixel ID and access token

Meta recommends using both channels. Choosing between browser-side and server-side tracking is covered in detail in postback vs pixel.

Event deduplication

If the same event arrives both from the pixel and via Conversions API, Meta must understand that it is one lead. For that, the two events must share:

  • the event name, for example Lead in both channels;
  • the event ID: eventID in the pixel and event_id in the server request.

Without a shared ID, one lead is counted twice and the campaign optimizes on inflated data. If linking the IDs is technically hard, it is easier to split roles: the pixel sends PageView and ViewContent, while Lead and Purchase go from the server only.

Event match quality

A server event is matched to a user better the more identifiers it carries: fbc (from fbclid), fbp, the visitor's IP address and browser, and hashed contact details if you collect them lawfully. Events Manager shows an event match quality score for each event; use it as your guide.

Facebook pixel when working through a tracker

In affiliate marketing the offer usually sits on the affiliate network's site, and you have no access to its thank-you page. You cannot place a pixel there. The working setup looks like this:

  1. The ad link leads to your landing page or pre-lander. The tracker records the click together with fbclid.
  2. On your own pages you place the pixel with PageView and, optionally, ViewContent.
  3. The tracker's click ID goes into the offer link, for example aff_sub={click_id}.
  4. The network sends a postback about the lead or approval with that click ID. How it works is explained in postback URL and S2S tracking setup.
  5. The tracker finds the click, takes its fbclid and sends the event to Meta via Conversions API.

This way Meta receives conversions the browser pixel could never see, and with their real status. More on linking the click ID and the conversion in click ID and sub ID.

Common Facebook pixel mistakes

  • The event fires on every page refresh. Someone refreshed the thank-you page three times, and the ad account shows three leads. Send the event when the form is actually submitted, or guard against repeats.
  • Lead sits on the form page rather than on successful submission. Then viewing the form counts as the event, and optimization drifts towards people who filled in nothing.
  • A purchase without amount and currency. Without them, ROAS in the ad account is empty and value optimization is unavailable.
  • The base code is loaded through a tag manager with a delay. Fast visitors leave before the pixel loads.
  • One event from two channels without a shared ID. Duplicates inflate results and throw off learning.
  • Several pixels for one funnel. Data gets split and no dataset collects enough events for stable optimization.
  • A lost fbclid. If redirects or the tracker strip the parameter, server events match clicks less well. Check that it reaches the final page.

How ArtisanClo sends conversions to Meta

In ArtisanClo, sending is set up in the traffic source card. For Meta you need two values from your ad account: the Pixel (dataset) ID and an Access token (available from the Professional plan). Conversions go straight to your ad account using your keys.

  • Where conversions come from. ArtisanClo accepts postbacks from affiliate networks (around 300 ready-made templates) or leads from your own site, via code for the form handler, a script for the thank-you page or its own conversion pixel.
  • Statuses. Network statuses are mapped automatically: approved becomes a Sale, pending is Hold, refund is Rejected. Each conversion and status is sent to Meta once, so a repeated postback does not create a duplicate.
  • Duplicate leads. A repeat lead from the same visitor within the uniqueness window is recorded as Trash and marked as a duplicate.
  • History. In the conversion log every entry shows its history: click data, what the network sent, status changes and sending to the ad platform.
  • Spend. On the Business plan, ArtisanClo pulls spend from Meta every morning for the last three days; this needs the Ad account ID.

Sending works for flows with a tracker. If ArtisanClo sends server events to Meta, do not duplicate the same event with a browser pixel on your page without a shared ID; leave page views to the pixel. The general setup for different ad platforms is in sending conversions to ad platforms, and platform specifics are on the Facebook Ads page in the traffic source catalog.

Summary

The Facebook pixel is browser code that tells Meta about events on your site: page views, leads, purchases. Use standard events, pass amount and currency and check that each event arrives once. The browser loses some data, so Meta Pixel is paired with Conversions API, with a shared event name and ID for deduplication. And if the offer lives on an affiliate network's site, the main channel is a tracker: the network's postback becomes a server event with the conversion's real status.

Frequently asked questions

01

What is the Facebook pixel in simple terms?

It is a snippet of JavaScript from Meta that you put on your site's pages. It tells the ad account that a visitor opened a page, submitted a lead form or made a purchase. Based on these events Meta measures campaign results, builds audiences and learns to show ads to people more likely to take the action.

02

Can I put a Facebook pixel on an affiliate network's landing page?

Usually not: the offer page and the thank-you page belong to the network, and you cannot add your own code there. Some networks let you enter a pixel ID in their settings, but more often conversions are sent through a tracker: the network sends a postback, and the tracker sends the event to Meta via Conversions API.

03

Do I need the pixel if Conversions API is set up?

The pixel is still useful on your own pages: it sends page views, browser identifiers and events the server may not know about. But if an important event such as a lead is sent from both the browser and the server, both must carry the same event name and event ID, otherwise it is counted twice.

04

Why does the Facebook pixel show fewer conversions than the affiliate network?

A browser pixel does not fire with ad blockers, with cookie restrictions in browsers, or when the visitor leaves before the code loads. On top of that, Meta and the network attribute conversions to time and clicks differently. Server-side events and passing the click ID through a tracker narrow the gap.

05

How many pixels can you use on one website?

Technically you can put several pixels on a page and each will receive events. In practice one pixel per funnel is more convenient: events are not split, the algorithm collects learning data faster and reports are easier to reconcile.

Read next

See your traffic for real

Connect ArtisanClo to your site, see who actually arrives from your ads, and why every click got its decision.