Meta Pixel 

Meta Pixel and Conversions API: sending website events to Meta

Two people work at a desk with computers in a modern office.
Ralph Grundmann · Last updated on 2 November 2026

The Meta Pixel is a piece of JavaScript code that records visitor actions on your website and reports them to Meta. This shows you in Ads Manager which ads on Facebook and Instagram lead to purchases or enquiries. The Conversions API also sends such events directly from a server. Meta recommends using both together.

What is the Meta Pixel?

The Meta Pixel, formerly the Facebook Pixel, is a code snippet for your website. It loads a small library of functions. You use these to report visitor actions, known as events, to Meta. Meta treats them as conversions and shows them in Ads Manager.

The data serves three purposes. It measures the success of ads, it helps Meta deliver them to suitable people, and it makes remarketing to past visitors possible. The principle is the same as conversion tracking in Google Ads.

Which events the Pixel measures

The base code reports a PageView event each time a page loads. You define everything else yourself. Meta provides 17 standard events, which you can extend with your own. These are commonly used:

Event Meaning Typical use
ViewContent Content viewed Product page
AddToCart Added to basket Basket button
InitiateCheckout Checkout started Start of checkout
Purchase Purchase completed Confirmation page
Lead Lead generated Enquiry form submitted
CompleteRegistration Registration completed Account or newsletter

A purchase with a value looks like this in code:

fbq('track', 'Purchase', {value: 49.90, currency: 'EUR'});

Meta calls additional details such as value or page type Custom Data. For Purchase, value and currency are required, while the details are optional for the other standard events.

If the standard events are not enough, you can create custom events with fbq('trackCustom', 'Name'). The name can be up to 50 characters long. Custom conversions are something else. You define them without code in Events Manager, for example using part of the address such as /thank-you. Meta restricts custom conversions that suggest health or financial status.

Setting up the Meta Pixel

  1. Get the base code: you will find it in Events Manager. You can create a Pixel there if you do not have one yet.
  2. Add it to the site: according to Meta, the code goes in the head section of every page you want to measure. Many websites add it through Google Tag Manager and link it to consent there. Shop systems often offer their own integrations for adding the code.
  3. Add events: call fbq('track') in the right places. In Tag Manager, values from your shop are best passed through the data layer.
  4. Check it: load a page and look for the event in Events Manager. The Meta Ads Data Advisor browser extension, formerly the Meta Pixel Helper, also shows errors. You can test individual actions such as clicks under Test Events in Events Manager.
  5. Verify your domain: in your business account, you can verify the root domain with a meta tag, an HTML file or a DNS record. Meta particularly advises this if Pixels from several businesses run on your pages.

Base code

This is the base code from Meta’s documentation. Replace PIXEL_ID in both places with your Pixel ID from Events Manager:

<script>
  !function(f,b,e,v,n,t,s)
  {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
  n.callMethod.apply(n,arguments):n.queue.push(arguments)};
  if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
  n.queue=[];t=b.createElement(e);t.async=!0;
  t.src=v;s=b.getElementsByTagName(e)[0];
  s.parentNode.insertBefore(t,s)}(window, document,'script',
  'https://connect.facebook.net/en_US/fbevents.js');
  fbq('init', 'PIXEL_ID');
  fbq('track', 'PageView');
</script>
<noscript>
  <img height="1" width="1" style="display:none"
       src="https://www.facebook.com/tr?id=PIXEL_ID&ev=PageView&noscript=1"/>
</noscript>

Setup through Google Tag Manager

  1. Create a Custom HTML tag with the base code and fire it only once consent has been given.
  2. Create a second tag for the purchase that fires on the purchase event from the data layer. The placeholders in double braces are data layer variables:
<script>
fbq('track', 'Purchase', {
  value: {{dlv_value}},
  currency: {{dlv_currency}}
}, {eventID: {{dlv_transaction_id}}});
</script>

The purchase tag needs the base code. Ensure this with tag sequencing, so that the base code runs first.

Advanced matching

Advanced matching also sends details such as the email address, so that Meta can match conversions to people more reliably. You switch on the automatic version in Events Manager, while the manual version extends fbq('init'). The Pixel hashes the values itself with SHA-256. Include this data in your data protection review.

What is the Conversions API?

The Conversions API connects your marketing data directly to Meta. The events come from your server, a website platform, an app or a CRM. It therefore runs outside the browser and can also report conversions that happen offline.

Meta recommends using the Conversions API in addition to the Pixel and sending the same events through both. There are several ways to do this:

Route How it works What to look out for
Setup in Events Manager For website events in one click, without code and, according to Meta, with no setup fees Requires an existing Pixel, no hosting of your own
Conversions API Gateway Self-service setup in Events Manager, runs in your own cloud account Cloud or partner costs, some technical knowledge
Server container in Google Tag Manager The browser sends to your server, which passes the data to Meta You run it yourself, read more under server-side tracking
Direct integration Your server sends POST requests to Meta Development effort, full control

Pixel and Conversions API together: avoiding double counting

If the same purchase arrives by both routes, Meta must recognise it as one event. This is called deduplication. According to its documentation, Meta recommends this approach:

  • The event name must match: event in the Pixel, event_name on the server.
  • The event ID must match: eventID in the Pixel, event_id on the server.
  • The second event must reach Meta within 48 hours of the first.

In the browser, you pass the event ID as the fourth parameter:

fbq('track', 'Purchase', {value: 49.90, currency: 'EUR'}, {eventID: 'B-10042'});

Your server sends the same purchase with the same ID. You fill in the placeholders in curly braces yourself, and event_time is the time in Unix seconds:

POST https://graph.facebook.com/{API_VERSION}/{PIXEL_ID}/events?access_token={ACCESS_TOKEN}

{
  "data": [{
    "event_name": "Purchase",
    "event_time": 1793577600,
    "event_id": "B-10042",
    "event_source_url": "https://www.example.com/thank-you/",
    "action_source": "website",
    "user_data": {
      "em": ["SHA256_HASH_OF_EMAIL"],
      "client_ip_address": "203.0.113.10",
      "client_user_agent": "BROWSER_USER_AGENT",
      "fbp": "FBP_COOKIE_VALUE",
      "fbc": "FBC_COOKIE_VALUE"
    },
    "custom_data": {"currency": "EUR", "value": 49.90}
  }]
}

The access token belongs on the server only. An event can be no more than 7 days old, otherwise the whole request fails, according to Meta. For testing, add test_event_code and remove the field before going live.

Event Match Quality in Events Manager shows how well Meta matches events to people, as a score out of 10. According to Meta, additional customer details such as an email address or phone number can improve it. These details must be hashed with SHA-256. The IP address, user agent and the values of the _fbp and _fbc cookies stay unhashed. Send events as soon as you can.

Common Meta Pixel errors

  • Installed twice: the Pixel runs through a shop plugin and also through Tag Manager, so events can arrive twice. Check this with Data Advisor.
  • Loading before consent: the base code is hard-coded in the source and runs before the choice in the cookie banner.
  • Purchase without a value: if value or currency is missing, you cannot evaluate revenue.
  • Different event IDs: browser and server use different IDs or names, so Meta cannot recognise the purchase as one event.
  • Reloaded confirmation page: Purchase fires again. Tie the event to the order number and fire it only once.
  • Forgotten test code: test_event_code stays in place in live operation.

Data protection: our assessment

This section is an assessment and does not constitute legal advice. Please check your use of these tools with your data protection officer.

  • Pixel: it works with cookies such as _fbp. We therefore assume that under section 25 of the German TDDDG consent is needed before it loads. In our view, the exception for strictly necessary services does not generally apply to advertising and measurement.
  • Responsibility: Meta places responsibility for GDPR compliance on each company. In 2019, the European Court of Justice ruled in the Fashion ID case (C-40/17) that a website operator embedding a plugin can share responsibility for collecting and transmitting the data.
  • Conversions API: in our view, the server route does not make consent redundant, because personal data still goes to Meta. Hashing does not make it anonymous. Apply the choice made in the cookie banner on the server side as well.
  • Implementation: the Pixel can be blocked with fbq('consent', 'revoke') and enabled after consent with fbq('consent', 'grant'). Alternatively, you can control it through your consent management platform. Google’s Consent Mode only governs Google tags. Our consent management service covers this.
  • Third country: Meta is a US company. List the recipients and data transfers in your privacy policy.


 Your next step 

Do you need support with Meta Pixel?

Our page Web analytics explains how we work. In an initial consultation, we clarify what makes sense for your website.


Request a consultation
 Frequently asked questions 

Meta Pixel: key questions

What is the Meta Pixel?

The Meta Pixel is a piece of JavaScript code for your website. It reports visitor actions such as purchases or enquiries to Meta, so that you can measure and optimise ads on Facebook and Instagram.

Are the Meta Pixel and the Facebook Pixel the same?

Yes. Facebook Pixel is the former name of the Meta Pixel.

Do I need the Conversions API as well as the Pixel?

Meta recommends combining them and sending the same events through both. To avoid double counting, Meta recommends a matching event ID. The setup in Events Manager takes the least effort.

Is the Meta Pixel GDPR-compliant?

That depends on how it is used. In our assessment, it should only load after consent and it belongs in your privacy policy. This is not legal advice. Please check it with your data protection officer.

How do I check whether the Pixel is working?

Open a page with the Pixel and look for the PageView event in Events Manager. The Meta Ads Data Advisor browser extension, formerly the Meta Pixel Helper, also shows formatting errors. You can test clicks and other actions under Test Events in Events Manager.

 Request a consultation 

Questions about this topic?

Tell us briefly what it is about. You will speak directly to Ahmed Badia.
Microsoft Partner Badge
SISTRIX-zertifizierte Agentur
4.9
Based on 32 reviews

Reviews from our Google Business Profile. We check every review against our client projects.

Request a consultation
Ahmed Badia
Ahmed BadiaSenior Software Developer Team LeadCall: +49 228 243 313 54

* Required

Please enter your name.

Please enter a valid email address, e.g. name@company.com.

For a call back.

Please enter your number with area code, e.g. +49 228 243 313 53.

Please tell us briefly what it is about.

Free and without obligation. We usually reply on the same working day.

Information on how we process your data: Privacy policy