Back to blog

TipsMinutes to read: 8

How to Connect Meta Pixel to Your Website

HeroContent editorial team

Meta Pixel is a small piece of code that you place on your website to connect your site's visitor data to your Facebook and Instagram advertising. Once connected, you can track the actions people take on your website after clicking your ads, build audiences of website visitors for retargeting, and let Meta's algorithm optimize your campaigns based on the conversions you care about most — purchases, sign-ups, form completions, and more.

Connecting Meta Pixel to your website is one of the highest-impact setup steps you can take for your advertising effectiveness. This guide explains what the Pixel does, how to create and install it, and how to verify it is working correctly.

Why It Matters

Without a Meta Pixel, your Facebook and Instagram ads are essentially blind to what happens after someone clicks. You can see how many people clicked your ad, but you cannot see how many of those clicks led to a purchase, a phone call, an email sign-up, or any other valuable action on your site.

The Pixel closes this loop. It fires a tracking event every time a website visitor completes an action you have configured — a page view, a product added to cart, a checkout started, a purchase completed, and so on. This data flows into Ads Manager and enables several powerful capabilities: conversion-optimized campaigns (where Meta shows your ads to people most likely to convert), custom audiences built from website visitors, lookalike audiences modeled from converters, and attribution reporting that tells you which ads are driving real business results.

What You Need Before You Start

You need a Meta Business Manager account with an active ad account. You need a website with the ability to edit its code or use a plugin/integration. You need either access to your website's code (HTML), or access to a platform like Shopify, WordPress, Squarespace, Wix, or similar that has a Meta Pixel integration. You also need to be an Admin of the Business Manager or have the Analyst or Admin role on the Pixel.

Step-by-Step Guide

Step 1: Open Meta Events Manager

Go to business.facebook.com and log in. In the left menu or through the grid icon, find and click Events Manager (also accessible at business.facebook.com/events_manager). This is where all your data sources — pixels, server-side API events, offline data — are managed.

Step 2: Click "Connect a Data Source"

In Events Manager, click the green + Connect a data source button. A dialog will appear asking what type of data source you want to connect. Select Web (for a website pixel). Click Next.

Step 3: Name Your Pixel

Enter a name for your pixel. Use something descriptive, like your website name or business name followed by "— Website Pixel". Click Create pixel.

Step 4: Choose Your Installation Method

Meta will now ask how you want to install the pixel. You have three options:

Partner integration: If your website is built on Shopify, WordPress with WooCommerce, Wix, Squarespace, Magento, or another supported platform, choose this option. Meta will guide you through a platform-specific setup that does not require any code editing.

Manually add code to website: For custom-built sites or platforms without a native integration, choose this option to copy and paste the pixel code directly into your website's HTML.

Email instructions: If someone else manages your website (a developer or web agency), use this to email the installation instructions to them.

Step 5A: Install via Partner Integration (Shopify Example)

If you are using Shopify: In the partner list, click Shopify. Meta will show you your Pixel ID. Copy it. Then go to your Shopify admin → Preferences → Facebook channel (or Marketing → Meta Business) and paste your Pixel ID in the appropriate field. Shopify will handle the rest of the installation automatically.

Similar processes exist for other platforms. Follow the on-screen instructions for your specific platform.

Step 5B: Install via Manual Code

Select Manually install code yourself. Meta will show you the base pixel code. Copy the entire code block. Paste it into the <head> section of your website's HTML — on every page. The pixel needs to be on every page to track all visitor behavior, not just specific pages.

Step 6: Add Standard Events

Standard events are specific actions on your website that you want to track, such as:

  • ViewContent — someone views a product page
  • AddToCart — someone adds a product to their cart
  • InitiateCheckout — someone starts the checkout
  • Purchase — someone completes a purchase
  • Lead — someone fills in a contact form

For e-commerce, the most important event to add is Purchase. Work with your developer (or use Meta's Event Setup Tool — described below) to add these event codes to the relevant pages.

Step 7: Use the Meta Pixel Helper to Verify

After installation, go to your website in the Google Chrome browser. Install the Meta Pixel Helper browser extension from the Chrome Web Store. Once installed, visit your website and click the Meta Pixel Helper icon in your browser toolbar. If your pixel is installed correctly, you will see a green checkmark and the pixel ID, along with any events that are firing.

Step 8: Use the Event Setup Tool (No-Code Option)

If you are not comfortable editing code, Meta's Event Setup Tool lets you set up events without touching code. In Events Manager, click on your Pixel → Settings → Event Setup Tool. Enter your website URL and Meta will launch a visual overlay of your website where you can click on buttons, forms, and links to set up tracking events without writing any code.

Common Issues and How to Fix Them

The Meta Pixel Helper shows no pixel detected. This means the pixel code is either not installed, is installed in the wrong location, or has a typo. Double-check that the code is in the <head> section of every page, and that you copied the complete code without modifications.

The pixel is firing but I am not seeing data in Events Manager. There can be a delay of up to a few hours before pixel data appears in Events Manager. Also check that your website does not have a caching layer that is serving an old version of the page without the pixel code.

I see "pixel not active" in Events Manager. This usually means the pixel was created but no events have fired yet. Visit your website after installation — even a page view should trigger the pixel and change its status to active.

My pixel is installed but conversions are not being attributed to my ads. Make sure the conversion events are correctly configured. If you are optimizing for purchases, the Purchase event must be firing with the correct value parameter. Use the Test Events tool in Events Manager to verify.

Tips to Get the Most Out of Meta Pixel

Install the pixel before you launch campaigns. The pixel collects audience data over time. The earlier you install it, the more data you will have when you are ready to run retargeting campaigns. Even if you are not running ads yet, install the pixel on your website now.

Verify domain ownership. Meta's data policy changes introduced domain verification as a required step for certain pixel event tracking and Conversions API setups. Verify your domain in Business Settings → Brand safety → Domains to avoid data disruptions.

Use the Conversions API alongside the pixel. Pixel data is subject to browser limitations (ad blockers, cookie restrictions). Meta's Conversions API sends event data directly from your server to Meta, bypassing these limitations. Using both the pixel and the Conversions API together gives you the most complete data possible.

Create custom audiences from pixel data immediately. As soon as your pixel starts receiving data, create a custom audience of website visitors in Ads Manager → Audiences. Start with "All website visitors in the last 30 days" — this audience will automatically grow and be ready for retargeting campaigns when you launch.

Frequently Asked Questions

Can I use the same Meta Pixel on multiple websites?

Technically yes, but it is not recommended. Using one pixel across multiple unrelated sites mixes visitor data in a way that makes audience segmentation confusing. For distinct websites, create separate pixels and keep their data separate.

Do I need to update the pixel when I make changes to my website?

The base pixel code generally does not need to change. However, if you add new pages, change your checkout flow, or restructure your site's URL pattern, you may need to update where specific event codes are placed. Use the Meta Pixel Helper to verify events are still firing correctly after major site changes.

Will GDPR or cookie consent laws affect my pixel?

Yes. If you operate in the EU or other regions with privacy regulations, you need to obtain user consent before the pixel can fire. Implement a cookie consent tool on your website and configure it to only load the Meta Pixel code after user consent is given. Consult a legal professional for guidance specific to your situation.

How long does pixel data stay available?

Meta retains pixel event data for up to 180 days. Custom audiences built from pixel data can use data from the last 180 days as a maximum lookback window. Historical data beyond that point is not available for audience building or attribution.

Don't want to worry about all of this yourself? Try HeroContent

What can you get:

  • Content preparation (posts, stories, reels)
  • Posting
  • Facebook and Instagram management
  • Social media ads
Start free