• Skip to content
  • Skip to footer
A Bright Clear Web

A Bright Clear Web

A Bright Clear Web - Simple, effective, accessible websites

  • Home
  • About
  • Websites
  • Writing
  • Learn
  • Blog
  • Contact
You are here: Home / WordPress / How To Add The Facebook Pixel To WordPress

How To Add The Facebook Pixel To WordPress

Posted: April 7, 2017 Updated: July 13, 2018 by Claire Brotherton
25 Comments

Create a Facebook pixel

If you’ve used Facebook for any length of time, you’ll be familiar with Facebook ads in your timeline.

You’ve also probably visited a website, gone to Facebook and then noticed an ad for the very thing you were looking at minutes before!

What’s going on? Is the business psychic?

The truth is that they’re using something called the Facebook pixel to retarget their users. That is, they serve an ad to someone who’s already expressed an interest in their product or service.

All business owners with a Facebook account can take advantage of this technology to reach their most engaged prospects.

If your site runs WordPress, the first part of that process is to add the Facebook pixel to WordPress.

Here are the points I’m going to run through:

  • What is the Facebook pixel?
  • What kind of data does the Facebook pixel collect?
  • I’m not running Facebook ads – do I need the Facebook pixel?
  • Where do I get the Facebook pixel?
  • How to add the Facebook pixel to WordPress
  • Check that the pixel is working
  • Update your privacy policy

What is the Facebook pixel?

Facebook’s definition of the Facebook pixel says:

The Facebook pixel is a piece of code for your website that enables you to measure, optimize and build audiences for your ad campaigns.

Facebook used to have two types of pixel – conversion tracking and Custom Audience pixels. They have now consolidated those into one for simplicity.

The pixel itself is a 1×1 px image (a tiny dot that makes up a larger image). When set on a web page, it sends information to a server which sets a cookie in the user’s browser.

Learn more about cookies, tags and pixels

What kind of data does the Facebook pixel collect?

The Facebook pixel will tell you:

  • How many people visited your site in a given time period
  • Which pages your visitors went to
  • What type of device they used (desktop, mobile or tablet)

There are also options to collect data from specific events, such as email signups, views of particular pages or purchases made.

I’m not running Facebook ads – do I need the Facebook pixel?

If you have plans to run Facebook ads in the future, you can start the data collection now. You can retrieve data up to 180 days old.

I won’t go into the how of running Facebook ads in this post.

Suffice it to say that you can gain insights into your audience’s age, gender, job and relationship status via the Facebook pixel. Using this information you can create laser-targeted Facebook ads.

Read more about Facebook custom audiences and creating Facebook ads

  • The Importance of the Facebook Pixel
  • How to Get Deeper Insights on Your Website Visitors Using the Facebook Pixel
  • The Ultimate Facebook Advertising Blueprint

Where do I get the Facebook pixel?

You need a personal Facebook account, and to be logged in.

Choose Create Adverts from the dropdown menu accessible from the white arrow. (I’ve highlighted it with a red border in the screenshot.)

Facebook Create Adverts link leading to Ads Manger

You will momentarily see this:

Facebook preparing ad account

Then the Facebook Adverts Manager.

Facebook Adverts Manager highlighting hamburger menu

Clicking on the hamburger menu is supposed to bring up a mega menu where you can select the Pixels option.

Facebook Adverts Manager mega menu showing Pixels menu option

If you find you can’t click on it, as I did, use this link to go directly to the Facebook pixel section of the Ads Manager.

You should see this screen:

Create a Facebook pixel

Select the Create a Pixel button at the bottom.

 

Name pixel and agree to terms

Name your pixel – I renamed mine to A Bright Clear Web Pixel.

Read the Facebook pixel terms. Choose Next.

The pixel will be created and you get a confirmation.

Facebook pixel created

Well done! Now you have to add the code to WordPress.

How to add the Facebook pixel to WordPress

Choose how you want to install the pixel.

Choose how you want to install your pixel code

If you’re using Google Tag Manager already you can go for the first option, Use an integration or tag manager.

Otherwise, choose the second option, copy and paste the code.

Carry out step 1, Install the pixel base code, by copying the generated code.

(In the screenshot, I’ve blanked out the tracking code, which is a numerical ID unique to you.)

Install pixel base code

You will paste this code into the header section of your website. Your site must be running a self-hosted WordPress.org installation (not WordPress.com) to do this.

Your WordPress theme might have an area in theme settings to do this. My theme (Genesis) does.

Otherwise you can install a plugin like Insert Headers and Footers. This might be a better solution anyway. If you ever switch theme, you won’t lose the pixel.

Go to Settings > Insert Headers and Footers.

Paste the code into the Scripts for Header area and save.

Inserting the Facebook pixel in header scripts

The following step, adding code to specific pages to track events, is something you can leave at this stage. You can add event tracking later when you know what you want to track!

Check that the Facebook pixel is working

Facebook give you a step to follow to make sure the pixel is installed correctly.

I must admit I didn’t bother with this and left it to its own devices. I later got a Facebook notification to say the pixel was up and running.

Notification of active Facebook pixel

Facebook have created the Pixel Helper tool to troubleshoot pixel errors. Make sure you have the Chrome browser to install it.

Clicking on the icon in the browser bar will show you the pixel on your site or any other.

Facebook Pixel Helper Chrome extension showing A Bright Clear Web pixel

Update your privacy policy

Every website should have a privacy policy.

Why? You need to inform your users about the information you collect from them and how you use it.

Let your users know that you are using the Facebook pixel and tell them how they can opt out of data collection.

Not everyone finds using the Facebook pixel appropriate. King County local government authority decided not to use the Facebook pixel because:

…the data Facebook collects from its pixel feature is not anonymous and can be tied to individual users, often by name. This kind of data tracking violates our privacy policy, and is therefore not allowed on King County websites.

Facebook’s page Cookie Consent Resource suggests that the following is a potential case for asking for consent:

A Facebook advertiser who installs the Facebook or Atlas pixel on its website in order to measure ad conversions or retarget advertisements on Facebook

It goes on to suggest that consent could be asked for and given by means of a banner or notice on the website with a button to indicate agreement.

This is very similar to what many companies have done regarding the EU cookie law, with popups and banners saying, “This website uses cookies. Do you accept?”

However, Heather Burns, who writes about laws relating to web professionals, wrote in a recent blog that the EU have acknowledged cookie consent fatigue. From May 2018, the onus will be on web browsers to manage consent.

I asked Heather what her recommendation was regarding the Facebook pixel and user consent.

Use it to have a practice run at a GDPR-compliant information notice, and link to https://t.co/8t7JhdFVkW and https://t.co/Ylgm9TDUZz

— Heather Burns (@WebDevLaw) April 4, 2017

GDPR is the new EU data protection law that comes into force in 2018. It is going to affect everyone that holds personal data on Europeans – whether you live within or outwith Europe. There will be hefty penalties for non-compliance with the new law.

The links Heather recommended are to services that allow opt-outs to advertising services.

I’ve now updated my privacy policy accordingly.

To think about

Are you using the Facebook pixel on your WordPress site?

How are you keeping your users informed about the privacy of their information?

Related

Category: WordPress Tags: Facebook pixel

About Claire Brotherton

Freelance web designer and front end developer based in Edinburgh, Scotland. I love WordPress, code, learning and blogging.

Reader Interactions

Comments

  1. Emily says

    April 10, 2017 at 4:45 pm

    Love this step by step process You definitely made it super easy to ad the pixel!!

    Reply
    • Claire Brotherton says

      April 10, 2017 at 7:02 pm

      Thanks Emily – appreciate you taking the time to comment.

      Reply
  2. Susan Velez says

    April 14, 2017 at 12:04 pm

    Hi Claire,

    I actually had to do this for a client about 3 weeks ago. I wish I would’ve had a tutorial like this.

    It was all new to me at the time. Which was kind of confusing at the time and probably took me a little longer than it should have.

    Your tutorial will definitely save a lot of people time on adding the Facebook Pixel to their WordPress site. Love the pics, it definitely makes it easier to follow along with.

    Thanks for sharing your tips with us.

    Have a great day 🙂

    Susan

    Reply
    • Claire Brotherton says

      April 14, 2017 at 6:04 pm

      Thanks, Susan. I wish I had written it earlier now! 😉

      Reply
  3. Gabrielle says

    April 24, 2017 at 10:13 pm

    SO much good info, thanks for the post <3 I'll def be adding a pixel myself.

    Reply
  4. Monica says

    May 14, 2017 at 4:11 am

    Thanks for this clear information!

    Reply
    • Claire Brotherton says

      May 15, 2017 at 10:46 pm

      Cheers Monica!

      Reply
  5. Ashley says

    June 5, 2017 at 9:05 pm

    Hi! I think I’ve managed through the install on the base code but I can’t quite tell where I should be putting the event code piece of things – if I’m just interested in if a specific thank you page loads – where would I install that piece of the pixel?
    Thanks so much!
    Ashley

    Reply
    • Claire Brotherton says

      June 6, 2017 at 10:03 pm

      Hi Ashley

      I didn’t get as far as tracking events, but this article looks like it would help: How to Setup Facebook Conversion Tracking in WordPress.

      Reply
  6. Patrick says

    June 27, 2017 at 5:44 pm

    Hi.
    I’m looking into putting the Facebook pixel on a website. It doesn’t have a cookies policy because it doesn’t take any data yet – this Pixel will be the first attempt to do that.
    Facebook say that –

    1. For websites, a clear and prominent notice on each webpage where Facebook Tools are used that links to a clear explanation….. (b) how users can opt-out of the collection and use of information for ad targeting, and…

    I’m not sure how to do that and have just looked at your own privacy policy.

    Would it be ok to use the text you have done that says –

    This site uses the Facebook pixel to collect data on visitor behaviour, such as:

    which pages are visited
    which device was used to view the website
    what actions were taken
    This information may be used to serve Facebook ads in future.

    You can opt out of collection of information and third party adverts by using the following services:

    Digital Adversting Alliance: Opt Out
    Your Online Choices
    Further reading

    WordPress.org privacy policy

    Google privacy policy

    Facebook privacy policy

    Thanks

    Reply
    • Claire Brotherton says

      June 30, 2017 at 4:59 pm

      Because you asked, Patrick, sure. 🙂

      Reply
  7. AB Rajputt says

    September 23, 2017 at 12:18 pm

    Wow! this looks so great thanks for sharing.

    Reply
  8. Atul Sharma says

    November 19, 2018 at 9:48 am

    very useful information which has provided step by step process you definitely made it super easy to ad the pixel.

    Reply
  9. Pallavi Taru says

    December 21, 2018 at 7:36 am

    Hi Claire, Thank you for sharing. Very useful.

    Reply
  10. Digital Marketing says

    April 2, 2019 at 9:45 am

    Thnaks for information..

    Reply
  11. Dibakar Bala says

    June 10, 2019 at 3:14 pm

    Hi Claire,

    Nice Explanation.

    I think you should update this article with more methods.

    Particularly now we have WordPress plugins specifically dedicated for FB pixel setup.

    Although this one is better, yet, they’re also methods one can use.

    Less Technical.

    Reply
  12. sameer says

    February 5, 2020 at 10:32 am

    Hi Claire,

    Now there are many methods to add pixels in your WordPress site you can do it directly with WordPress plugin.

    Thanks for explaining in soo detail with screenshot

    Reply
  13. Aman says

    March 4, 2021 at 10:02 am

    Hey, Well Explained about Facebook ads pixel. And thank you for give Facebook unique strategy to learn. Nice information provides.

    Reply
  14. Saad says

    March 20, 2021 at 8:17 am

    Hey, Well information about Facebook ads pixel and word press and how’s Facebook pixel ads work. So thank you for unique information about different strategy.

    Reply
  15. Dilawer says

    March 23, 2021 at 11:02 am

    Hey, Well explained about Facebook ads pixel and there WordPress strategies. Thank you for important and informative information’s.

    Reply
  16. minaxi suthar says

    May 26, 2022 at 10:51 am

    Hey, Thank you for giving a detailed explanation about adding Facebook pixels to WordPress.You made it super easy to understand.

    Reply
  17. Joseph Donahue says

    September 20, 2022 at 5:28 am

    Hi there! I could have sworn I’ve been to this website before but after reading through some of the post I realized it’s new to me. Anyhow, I’m definitely delighted I found it and I’ll be book-marking and checking back frequently!

    Reply
  18. Tushar panchal says

    February 22, 2024 at 6:00 am

    Great guide on adding the Facebook Pixel to WordPress! Clear instructions and helpful tips. Thanks for sharing!

    Reply
  19. Vinith says

    March 28, 2024 at 5:34 am

    Thank you so much for sharing the amazing post. Well, there is information about Facebook ads pixel and WordPress and how Facebook pixel ads work.

    Reply

Trackbacks

  1. 3 Quick And Easy Blog Ideas For When You Don't Want To Write says:
    April 16, 2017 at 9:15 pm

    […] How To Add The Facebook Pixel To WordPress […]

    Reply

Leave a Reply Cancel reply

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

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email. Read my privacy policy.

potted cactus and laptop with code

Footer

Categories

  • Accessibility
  • Blogging & Content Marketing
  • Business
  • Personal
  • Software & Tech
  • Websites
  • WordPress

Top Posts

  • How To Create WordPress Excerpts And Include Links In Them
  • How To Solve WordPress Image Alignment And Text-Wrap Problems
  • Improve Your Divi Website's Reach With Divi Accessibility
  • How To Set Up And Customize Twenty Nineteen Theme
  • Registering a Domain Name with GoDaddy - Step by Step

Let’s Be Social

  • E-mail
  • Facebook
  • LinkedIn
  • Twitter
Copyright © 2014 -2025 A Bright Clear Web
  • Privacy and cookies policy
  • Site map