How to Add Facebook Pixel to WordPress Without a Plugin

Facebook Pixel is a bit like Google Analytics. It allows you to track your marketing strategies through Facebook and gives you some insight to the impacts of your posts. Utilizing Facebook Pixel also allows you to adjust your target audience and gives you access to additional advertising tools.

This post will serve as guide to the process of creating your Pixel code and then adding that fantastic little snippet to your WordPress installation. Without a plugin. You could use a plugin, but it’s a good practice to keep your plugins as a minimum for optimum performance. And even if you aren’t comfortable with code, the process is pretty straight-forward.

Sign up for your Pixel code via Facebook

The first thing you’ll need to do, is obtain your Facebook Pixel script. This guide provided by Facebook is helpful. Of you can follow this quick rundown of tasks:

  1. Log into your Facebook account
  2. Access your Facebook Pixels tab in your event manager: Pixels Link
  3. Create your Facebook Pixel
  4. From the setup options available, you can email the code to your developer – or if you are doing this yourself, select the option to manually install the code yourself.
Add Script to your WordPress Installation

Since we are adding the Facebook Pixel script to your WordPress website without a plugin, we’ll need to do a teeny tiny bit of coding. And by this, I seriously mean that this is a copy & paste job. Easy peasy. Even if you don’t know code, you’ll likely find that this process is fairly easy to follow.

You will need to be able to access your files. Usually your website files are accessible through your cPanel that is provided by your hosting company or via FTP. The following steps will walk you through the process:

  1. Access your WordPress website files
  2. Follow the following path to reach your theme files, open the folder that contains the files for the current theme you are using
    1. wp-content
    2. themes
  3. One in your current theme files, locate the file titled: header.php
  4. Open the file and locate the following line/tag that reads: </head>
  5. Right before that line, enter the script that you were provided through your Facebook Pixel setup. It will look something like this:
    1. <!– Facebook Pixel Code –>
      fbq(‘init', ‘12345678910');
      fbq(‘track', ‘PageView');
      <img height=”1″ width=”1″
      <!– End Facebook Pixel Code –>
  6. Save your file
In Conclusion

If you've made it this far – congratulations! You've now integrated a valuable marketing tool provided by one of the most popular social media platforms in the world. You can begin to analyze the data and adjust your strategies for greater impact and successful conversions.


Aloha, I am a Hawaii based freelance web designer and developer located on the beautiful island of Maui. Where the skies are blue, the palm trees sway and spam is a pretty big deal. My articles are geared towards site design and development, nifty wordpress tips and and other ramblings of webthings amusement.

If you need to secure your domain and hosting for your website, I highly recommend Siteground. You can learn more about them in theses posts:


Leave a Comment

Your email address will not be published. Required fields are marked *

( Advertisement )

Need a Host?

I noticed that you mentioned that you haven’t secured your hosting and domain. I would highly recommend SiteGround!

These are a couple posts from my blog that you can read to learn more about SiteGround:

I noticed that you mentioned that you haven’t secured your hosting and domain. I would highly recommend SiteGround!

Sign up here

Sign up here!