How to add the Meta (Facebook) Pixel to WooCommerce and test it
If you advertise on Facebook or Instagram, the Meta Pixel tells Meta which visitors viewed products, added to cart and bought, so your ads can be optimized for real sales and you can measure results. This guide explains how to add the Meta (Facebook) Pixel to WooCommerce and test it: getting the Pixel ID, installing it with the official plugin or with code, checking the main e-commerce events, and verifying your domain.
What you need
- Admin access to your WordPress dashboard.
- A Meta Business account (Business Manager / Business Portfolio) with admin access, and your Facebook page.
- A working SSL certificate on your store (https). See How to get a free SSL certificate (AutoSSL).
Step 1: Get your Pixel ID from Events Manager
- Open Meta Events Manager from your Business account.
- Click Connect data (or the green + button), choose Web, give the pixel/dataset a name and continue.
- If you already have a pixel, select it from the data sources list instead of creating a new one. One pixel per store is usually best.
- Copy the Pixel ID (also called dataset ID), a long number shown under the pixel name.
Step 2 (recommended): Install with the official plugin
The official plugin, published by Meta as Facebook for WooCommerce (newer versions may show the name Meta for WooCommerce), connects your store, sends the standard e-commerce events automatically and can also sync your product catalog.
- In WordPress go to Plugins → Add New, search for "Facebook for WooCommerce", make sure the author is Facebook/Meta, then click Install Now and Activate.
- Open the plugin settings (usually under Marketing → Facebook or WooCommerce → Facebook).
- Click Get started / Connect, log in to Facebook and follow the wizard: choose your Business account, Facebook page, ad account, and the existing pixel (from Step 1).
- Finish the wizard and allow the requested permissions. The plugin will show that the pixel is connected.
- Decide whether to enable product catalog sync. It is useful for dynamic/catalog ads; you can keep it off if you only need tracking.
Alternative: add the base code manually
If you do not want the plugin, you can paste the pixel base code (from Events Manager → your pixel → set up manually) into the site header using a header/footer code plugin or your child theme. This only sends PageView automatically; e-commerce events such as AddToCart and Purchase need extra code with the correct values (product ID, price, currency). For most stores the plugin is easier and more reliable.
Step 3: Understand the standard e-commerce events
| Event | When it fires |
|---|---|
| PageView | Every page load. |
| ViewContent | A visitor opens a product page. |
| AddToCart | A product is added to the cart. |
| InitiateCheckout | The visitor reaches the checkout page. |
| Purchase | The order is placed and the thank-you page loads, with order value and currency. |
The Purchase event is the most important one for sales campaigns, so test it carefully.
Step 4: Test the pixel
Using Test Events:
- In Events Manager open your pixel and go to the Test events tab.
- Enter your store URL and open the website from there (or use the test code if shown).
- Browse a product, add it to the cart, go to checkout and place a test order (for example, Cash on Delivery).
- Watch the events appear in Test Events: PageView, ViewContent, AddToCart, InitiateCheckout and Purchase. Click Purchase to check the value and currency.
- Cancel the test order afterwards.
Using Meta Pixel Helper: install the free Meta Pixel Helper extension in Google Chrome, open your store and click its icon. It shows which pixel ID is found on the page and which events fired, and warns about errors or duplicate pixels.
Step 5: Verify your domain
Domain verification shows Meta that you own the website, and is recommended for managing events and running ads that link to your store.
- In Business Settings (Business Portfolio settings), open Brand safety → Domains and add your domain.
- Choose a verification method: DNS TXT record, meta-tag in the site header, or HTML file upload.
- For the DNS method, add the TXT record in your DNS zone (in cPanel: Zone Editor), wait for it to propagate, then click Verify.
Common problems
- Pixel Helper shows "No pixel found": the plugin is not connected, or a cache/optimization plugin is serving an old page. Clear all caches and test again.
- Events appear twice: the pixel is installed in more than one place.
- Purchase event missing: the customer was redirected away from the thank-you page by a payment gateway or custom checkout, or JavaScript optimization (delay/defer) blocked the pixel. Exclude the pixel scripts from JS delay.
- Wrong currency or value: check the store currency in WooCommerce → Settings → General.
Frequently asked questions
Does the plugin also send server-side events (Conversions API)?
The official plugin supports the Conversions API through the connection wizard, which can help report events that the browser blocks. Check the plugin settings after connecting.
How long until events show in Ads Manager?
Test Events show activity almost immediately; regular reporting can take a while to update.
Do I need a separate pixel for Instagram?
No. Instagram ads are managed in the same Meta Ads Manager and use the same pixel.
Can EgWeb install the pixel for me?
Yes. Our team can install and test the pixel, verify your domain and make sure events are not duplicated. You just need to give us access to your Meta Business account or the Pixel ID. Learn more about our web design and store setup services.
Need help? Open a support ticket or message us on WhatsApp +20 127 113 3655.