Whether you’re a technically-minded site owner or not, it’s easy to add the Facebook Pixel to your WordPress website.
The Facebook Pixel is a vital analytics tool for almost any online business. It helps you track actions taken from your site visitors, create custom audiences, and is a must if you are running, or ever plan to run Facebook Ads.
Read through this brief Facebook Pixel WordPress installation guide and start leveling up your analytics and retargeting game with Facebook Pixel tracking code.
What is the Facebook Pixel, and What Does it Do?
The Facebook Pixel is a piece of code that collects data and tracks events on your website, sending this data back to your Facebook business account. Data collected with the Facebook Pixel can be used to track conversions from Facebook Ads, optimize ad delivery for desired events, create custom audiences, and run retargeting ads.
That was a lot, so let’s simplify it with a couple of examples.
Example #1 – Conversion Tracking
First, say you’re running a Facebook Ad to your online store. Let’s say it’s a simple Facebook Ad > Pricing Page setup, in which the goal of the Facebook Ad is to make sales.
In this case, the Facebook Pixel will provide Facebook Ads Manager the data on who purchased your product after clicking to your site from the ad. This lets you:
- View data on your ad’s conversion rate in Ads Manager, and assess your ad’s performance accordingly
- automatically optimize your ads for your intended conversion event (purchase), showing ads to the type of person statistically most likely to perform this event.
Without the Facebook Pixel installed, you’re left to guesswork when judging how many sales came directly from your ad campaign, and your ads most likely won’t get as good an ROI, as they’ll be served to less optimized audiences.
Example #2 – Facebook Retargeting
A second example: you want to set up a Facebook Ads campaign targeting people who visited your pricing page, but didn’t buy, to offer a discount code.
With the Facebook Pixel embedded and set up on this page, you can create a Facebook audience of just these people. This is not something that can be done without the Pixel.
Even better, you can automatically create custom audiences of people who triggered this event, and have an ongoing Facebook ad campaign that retargets pricing page visitors (who didn’t actually buy).
This is a common way businesses use the Facebook Pixel to create super high-level custom audiences. Another way would be to use the Pixel to create an audience of people who viewed a specific page on your site, and show retargeting ads to them on that specific topic.
Example #3 – Custom Events for Analytics
One more example of the Facebook Pixel in action. You can use the Pixel to track very specific actions on your site, whether you want to create audiences and show ads to these people or not.
Let’s say you made changes to a landing page. You want to see how many people viewing this page clicked on one particular call to action on your landing page. You can create a custom event with the Pixel for people who click on a certain element (the section you want to track). You can then compare it against page views, or other custom events (say other elements on the page).
Using the Pixel as a (free!) analytics tool puts you on the fast track to a fully optimized WordPress site.
Facebook Pixel Standard Events
Here are the standard events you can track with the Facebook Pixel:
- Add payment info – someone enters their payment information (i.e. credit card info) into a payment form on your site.
- Add to cart – someone adds a product to their cart.
- Add to wishlist – someone adds a product to their wishlist.
- Complete registration – someone fills out a registration form (for example, an email optin or user registration).
- Contact – someone gets in touch with you via email, phone, SMS etc
- Customize product – someone uses a function on your site to create a custom version of a product.
- Donate – someone donates to your organization/cause.
- Find location – someone searches for your business’ physical location (e.g. through a Google Maps widget on your site).
- Initiate checkout – someone starts the checkout process on your site.
- Lead – someone submits info or takes an action that identifies themselves as a lead to you.
- Purchase – someone makes a purchase on your site.
- Schedule – someone books an appointment on your site.
- Search – someone uses the search function on your site.
- Start trial – someone starts a free trial offered on your site.
- Submit application – someone completes an application process for a product, service or program offered on your site.
- Subscribe – someone starts a subscription service on your site.
- View Content – someone visits a specific URL.
In addition to this, you can create custom events, if you want to track something outside of the events listed above. For example, if you want to make an event when someone clicks on a specific button, or reads a certain post or article.
How to Install a Facebook Pixel on WordPress Manually
To add the Facebook Pixel to WordPress, you’ll need to install the Facebook Pixel code on your site. You’ll do this by copying the code from Facebook and pasting it into your site’s header.
To get your Pixel code, go to Events Manager in Facebook Ads Manager, and select your ad account. If you don’t already have a Pixel for your ad account, you can create a Pixel now.
You’ll be prompted with installation instructions now. If you’ve already created a Pixel earlier, hit Add Events, then From a New Website to bring up this popup.
Click Install code manually.
Next, copy the Pixel base code. Take this code and paste it into your WordPress site’s code.
You need to paste this between your site’s <head> tags. The most common way is to paste it just before the closing </head> tag.
Now, you can add this directly to your code, or to your site’s theme. If you’ve got a developer, you might want to get them to do this, to ensure nothing gets messed up.
If you’re a non-technical site owner, or just prefer not to mess with your base code, you can use a plugin like Insert Headers and Footers to easily add scripts to your site right from the WordPress dashboard.
After installing and activating the Insert Headers and Footers plugin, just paste the code you copied earlier into the Scripts in Header box. Save and you’re done.
The Facebook Pixel is now installed, but be aware you’ll still need to add Facebook Pixel event code. The base code will track “PageView” events on each page, but you’ll need to add additional lines to this code if you want to track other events.
To do this, you can use Facebook’s event setup tool, or you can paste the standard event code for the events you want to track into your Pixel code.
See all Facebook standard events and their event code here.
How to Add Facebook Pixel to WordPress Using Plugins
The Facebook Pixel code can look pretty daunting to non-developers (like myself). And while installing it manually just comes down to a lot of copy and paste, it’s time-consuming, and it only takes one missed character to mess up your entire code.
That’s why you should consider skipping the technical learning curve and get a plugin to handle everything to do with installing the Facebook Pixel to WordPress, and setting up events.
Facebook has its own official Facebook Pixel for WordPress plugin. However, this plugin is quite limited, has poor reviews and little to no support.
There are other plugins out there that are regularly maintained, supported, and offer much stronger functionality (for free even!).
The Best Facebook Pixel Plugin for WordPress
The best way to add the Facebook Pixel to your site is with the Pixel Cat WordPress plugin.
With this plugin, you can add your Facebook Pixel to WordPress in one click and less than a minute. Seriously, this is how easy it is:
Just install the free plugin, get your Pixel ID from Facebook Events Manager and paste it in the Pixel Cat back end. That’s it – the Pixel is now active on your whole WordPress site.
From this same screen you can set up and customize your events as well.
Click Add New to set up an event. Choose the event, and which pages you want the event to trigger on.
(The Pro version of Pixel Cat also lets you set up advanced triggers, such as click or hover on a particular element, as well as setting a time delay or scroll % before the event triggers).
This is infinitely easier than copying and pasting a bunch of code yourself. A simple WordPress plugin like this cuts down the time it takes to get your Facebook Pixel tracking up and running, giving you (or your developer) more time for more important tasks.
Aside from installing the Pixel and configuring standard events, Pixel Cat comes with more features that maximize the effectiveness of your Facebook Pixel, such as:
- One-click integration with WooCommerce
- One-click integration with Easy Digital Downloads
- WordPress search triggers
- Advanced triggers (Pro)
- Support for multiple Pixels (Pro)
- Dynamic events (Pro)
- Custom events & parameters (Pro)
- Google AMP integration (Pro)
- UTM tag support (Pro)
- Video events (Pro)
- Advanced matching (Pro)
Testing Your Facebook Pixel
Once you’ve installed your Pixel and set up your events, you’ll want to test it to ensure that your Pixel is indeed working as expected. You’d hate to start running ad campaigns just to have the conversion event wrongly configured.
To do this, get the Facebook Pixel Helper extension for Google Chrome.
This extension will show any Pixel activity currently going on in your browser tab. To test your events, perform the event yourself, and click on the Pixel Helper icon to view details.
If your events and/or parameters seem to be off, go back into Pixel Cat’s settings and double-check, then re-test.
Facebook Pixel WordPress Installation – In Summary
The Facebook Pixel is a must for any WordPress site owner who plans to run Facebook Ads. Don’t be put off by the complicated code snippet – the Facebook Pixel is quite simple, especially if you use a WordPress plugin that cuts out all the confusion for you.
To add the Facebook Pixel in WordPress, either install your Pixel manually by copying and pasting your base & event code, or get Pixel Cat Free and have your Facebook Pixel up and running in minutes, without leaving the WordPress dashboard.
For more powerful Pixel configuration, get Pixel Cat Premium, and see some of the incredible things the Pixel is capable of.
To learn more about how the Facebook Pixel works, how to add Facebook Pixel events to track, and best practices, see our ultimate WordPress Facebook Pixel guide.