Guide

How to Set Up the Facebook Pixel on Your Website

If you run or plan to run Facebook or Instagram advertising, the Facebook Pixel (now officially called the Meta Pixel) is one of the most valuable tools available to you. It’s a small piece of tracking code that you install on your website, which then sends data back to Facebook about what visitors do on your site — what pages they view, what products they look at, what they add to a shopping cart, and whether they complete a purchase or enquiry.

This data powers two things: audience targeting (so you can show ads to people who have already visited your site or shown interest in specific pages) and conversion tracking (so you know exactly which ads are driving real results). Without the Pixel, you’re running Facebook ads partly blind. This guide explains how to install it and get the most from it.

How to Install the Facebook Pixel

Log in to Meta Business Suite (business.facebook.com) and navigate to Events Manager. Select Connect Data Sources, then Web, and choose Meta Pixel. Give your pixel a name, enter your website URL, and Meta will generate a pixel ID and a code snippet. You then need to install this snippet on every page of your website, between the opening and closing head tags in the HTML.

If you use WordPress, the easiest method is a plugin like Meta for WordPress or PixelYourSite, which handle installation without requiring you to touch code. Shopify has a native Facebook sales channel integration. Google Tag Manager is another clean option if you’re already using it — you paste the pixel code into a new custom HTML tag and trigger it on all pages. After installation, use Meta’s Pixel Helper browser extension to verify the pixel is firing correctly.

Setting Up Standard Events

Beyond basic page view tracking, the Pixel can track specific actions — called Standard Events — such as a form submission, a product added to cart, or a purchase completed. These events are triggered by additional code snippets or, in some cases, via Meta’s Event Setup Tool, which lets you define events by clicking through your website interface without writing code.

The most important event for most service businesses is the Lead event — triggered when someone submits an enquiry form. For e-commerce, the Purchase event is critical. Setting these up means you can track exactly how many leads or sales each Facebook ad campaign produces, calculate your cost per lead, and optimise your campaigns towards the actions that matter.

Using Pixel Data for Retargeting

Once your Pixel has collected data from at least 100 visitors, you can create Custom Audiences in Meta Ads Manager. For example: everyone who visited your website in the last 30 days; people who visited a specific product or services page but didn’t enquire; people who reached your thank-you page (meaning they did enquire). These audiences let you show highly targeted follow-up ads to people who have already shown interest in your business.

You can also create Lookalike Audiences — Meta analyses the profile of your website visitors or customers and finds other Facebook users with similar characteristics. Lookalike audiences are consistently among the best-performing targeting options in Facebook advertising, and they’re only possible if you have Pixel data to build them from. Installing the Pixel as early as possible, even before you start advertising, means you’re accumulating this valuable data from day one.

FAQs

Common questions.

Do I need a Facebook ads account to install the Pixel?
You need a Meta Business Suite account and at least one ad account within it to access Events Manager and create a Pixel. You don’t need to have any active ad campaigns running — installing the Pixel early is recommended precisely so data starts accumulating before you launch ads.
Does the Facebook Pixel affect my website’s speed?
The Pixel script adds a small amount of load to each page, but it’s loaded asynchronously, meaning it doesn’t block the rest of the page from loading. The impact on page speed is minimal for most sites. Make sure you’re using the standard base Pixel code (not older or unofficial versions) to keep the impact as small as possible.
Does GDPR affect how I use the Facebook Pixel in the UK?
Yes. The Pixel collects data about website visitors, which requires user consent under UK GDPR. You must have a cookie consent mechanism on your website that clearly explains tracking and allows users to opt out. Only fire tracking pixels for users who have consented. Meta provides guidance on cookie consent integration, and platforms like Cookiebot or CookieYes can automate compliant consent management.
Related guides

More on web design & ux.

Want a hand putting this into practice?

Book a free, no-obligation consultation with a Norwich-based specialist.

Book a free consultation
Get started

Let's put your business in a better light.

Book a free, no-pressure consultation. We'll talk through your goals and tell you honestly what we'd do — whether you work with us or not.

  1. 01
    Tell us a bitFill in the form — two minutes, tops.
  2. 02
    We'll call you backWithin one working day, no pressure.
  3. 03
    Get a clear planHonest advice and a fixed quote.

Free · No obligation · We reply within one working day

Book a free consultation