In order to use Facebook remarketing/retargeting, you’ll need to add a blip of code to your site. Once you’ve created the code with your FB account, you have a few ways to add Facebook pixel code.
Option 1: Add Facebook pixel code with a plugin
For those that aren’t super nerdy or techy, using a plugin is your best bet. The only downside to this route is that you have a new plugin to run updates for + test. However, if it keeps you from needing to edit PHP files when you don’t know what the heck PHP even is, you’ll be happy to have the plugin work to do.
Within your WordPress dashboard, go to Plugins > Add New and search for Facebook pixel.
My favorite plugin option for clients is Facebook Pixel – Pixel Cat because it’s really easy to use. Simply install, activate + then paste in the code you got right from Facebook.
If you have a headers/footers code type plugin already installed, you can paste your pixel code into the header scripts area of that plugin too.
Option 2: With your theme
With a little more nerd know-how, you can install the Facebook pixel without adding another plugin to your site. But keep in mind two things —
- That making a typing error can lead to your site not working (if you remove too much of the PHP code)
- If you aren’t using a child theme, you could lose your changes the next time your theme is updated
With those in mind, head to the Appearance area of your dashboard + click Edit. This will bring up your theme file editor (hopefully it’s a child theme!) where you can locate header.php.
Once you click on that file + it loads, search for </head> within the textrea. You’ll want to paste your pixel code just before that in order for it to work on your site. Save your changes + you’re done!
Option 3: With the customizer
This is the one option that not everyone will have, because it is theme specific.
If you click on Appearance > Customize + see any sort of option like Header/Scripts/Advanced that gives you a text block to paste in scripts for your header, that’s where you’ll want to add the tracking code.
The nice thing about this option is that it saves you the risk of losing changes from a pending update + from taking down your entire site by removing necessary code from header.php, but also keeps you from having another plugin to maintain. So if your theme has this option, it’s the one you’ll want to use over the other two.