Adding Facebook Pixel Code To Your WordPress Website Without A Plugin

One of the things I’ve learned over the years working with the WordPress platform is that less is more.

WordPress has a huge learning curve, one that even those who are proficient in HTML and CSS languages have a challenging time picking up. It’s not because it’s difficult. It’s just different.

Once you get started with WordPress you will soon find out that you can pretty much add just about any imaginable functionality to your website with “PLUGINS”. It’s easy. You need to have a contact form in your contact page? There’s a plugin for that. Oh, you want to add social share buttons to your site? You sure will find a plugin for that too. Oh, what about an instagram feed? Yup, you’ve got it, there’s a plugin for that too!

Plugins are the answer to everything. We can thank the developers that dedicate their time to do just that. It saves a lot of time and headaches for those who are not savvy with PHP, CSS and HTML. For me, personally, I use them as a last resort…after anything I try with writing code becomes more time consuming than what I want to spend on a website.

There is a down side to plugins. Some of the free plugins available on the WordPress repository could be plagued with errors, and quite often those errors could leave open doors that compromise the security of your website. Additionally, some plugins that are poorly or carelessly written end up making unnecessary requests to your database thus slowing down your website. Lastly, we are at the mercy of the developers who took their time to develop a plugin and then add it to the WP repository – sometimes they abandon the project and move on which means that as WordPress progresses with updates, the plugin is not kept up. This causes compatibility issues that could potentially break your website!

In any case, if you are serious about your marketing efforts and want to use another tool besides the “jetpack” plugin, you could add the Facebook pixel to your WordPress website. And you don’t have to use a plugin or know too much coding! You just have to be cautious and pay very close attention to what you are doing!

Ready? Here we go!

Make sure you create a backup of your website! You can do this via your hosting plan. If you don’t have access to this information ask your developer or designer for it. Having access to all your files is imperative! (I always stress this to my clients!).

Obtain your Facebook pixel code. This page walks you through the steps on how to create a FB pixel. Note: You will need a Facebook business page/account.

Copy your pixel code once it’s generated.

Go back to your WordPress dashboard and navigate to your Appearance >>> Then click on “Editor”.

Take a deep breath…you’ve made it and now you are looking at code! Isn’t it a beauty!

Ok…moving on. If you are using a parent theme, all the files should appear listed on the right column. If you are using a child theme, go to the top of the right column. There is a pull down menu. Select the parent theme of the child theme you are using. (Learn more about why you should use a Child Theme here).

Find the HEADER.PHP file. In some instances it will be titled THEME HEADER. Click on it.

More code! Beautiful! 🙂

Somewhere in the text of the file named header.php you will find an opening tag like this <head> and a closing tag </head>. This is where any scripts that your website needs to include in every page will go, such as your Facebook pixel code, google analytics, google fonts, etc.

Right before the </head> (and after any code that’s there), paste your pixel code.

How do I know my pixel code is working? What to do next?
Your pixel code will take some time to gather the data. You can find out if it’s active by going to the Pixels tab on your Ads Manager account where you should be able to see a green light to let you know your pixel is active. A red light means it was not properly implemented or it is still gathering information. While you are on that page you can also learn more about the many uses of a pixel code for your advertising and marketing campaigns.

About Author

Amanda Eva went to college for Engineering but after spending 2 years in the program, she decided to go more where her heart was. She graduated with a B.A. in Sociology and M.Ed. in Student Development with a concentration in Social Justice Education.
She loves her family, empowering women, makeup and ice cream.
To read more visit the About Me page. :-)