The Facebook Pixel: What it is and how to set it up

Digital Advertising

Bottom line: if you’re running Facebook ads, you should be using the Facebook pixel, a short piece of code that tracks what users do on your site and passes that data back to Facebook and Facebook’s Ad platform. Facebook then uses this information to help you create better campaigns on Facebook (plus a lot of other cool stuff).
Think of this pixel as the bridge between your website and your Facebook Ad account. It can help you to optimize your Facebook advertising strategy for conversions on your site, create ads that retarget your site visitors, and better understand the traffic on your site that is generated by Facebook ads. This helps you reach the right audience with Facebook ads and keep your costs down. 

What you can do with the Facebook pixel

1. Create + Retarget to Custom Audiences

Facebook already has a ton of targeting options, but adding the pixel code in turn adds remarketing to the mix. Also known as remarketing, retargeting lets you create a Custom Audience of users that have already interacted with your organization. You can target that cohort, such as users who have already visited your site, or already visited a specific page on your site, with a campaign. Perhaps you want to target users that visited your donation page but never completed the donation. Or, you can target people that did take certain actions, like signing a petition or registering for an event. This can be a great way to reach users that have already shown an interest in your organization and are therefore likely to engage and take further action.

2. Create Lookalike Audiences

A lookalike audience is a group of users that are similar (in traits or behaviors) to another audience. Targeting a lookalike audience helps you reach people that are most likely to be interested in what you’re offering. The Facebook pixel lets you target users that share similar traits as your Facebook fans, your website visitors, or even visitors on specific pages of your website. If you want to increase readership of your organization’s blog, for example, you can create a lookalike audience of the users that frequent your blog pages and target them on Facebook. Instead of reinventing the wheel, you’ll be building on something that’s already working.

3. Optimize Ads for Conversions

When you run cost per click (CPC) ads on Facebook, the website shows your ads to the users that it believes to be the most likely to click. This helps keep your costs low and also means Facebook users are seeing ads that are most relevant to them. Facebook pixel data allows you to run ads optimized for conversions so that Facebook will show your ads to the users that it thinks are most likely to convert on site. These ads bring users straight to the end goal, like signing up for a newsletter, registering as a volunteer, or any other action that is important for your organization. The advantage here is that sans-pixel, Facebook has no way of knowing when a user “converts.” This strategy helps Facebook see this full pathway from Facebook ad to conversion.
The what, why, and how of the Facebook pixel. Share on X

Online Course

Google Analytics for Nonprofits

Master Google Analytics to drive impact!

4. Take Advantage of Facebook Analytics

Proper pixel implementation (say that 3 times fast) also gives your organization additional data through Facebook Analytics. This tool gives organizations even more insight into how users interact with their Facebook page and website. Using this, you can see how users interact with your Facebook posts and then see how those same users move over to your site and convert. Paired with Facebook Analytics, the Facebook pixel can give advertisers and social media managers more insight into user behavior.

How to install the Facebook pixel with Google Tag Manager

The Facebook pixel can be added to your website in a couple of ways. Google Tag Manager is the easiest way to install and manage pixel. If you don’t already have GTM installed, do that first.

  1. Head over to Facebook Events Manager and click Set Up Pixel
  2. Choose Use an Integration or Tag Manager and select Google Tag Manager
  3. Choose the Quick Install option
  4. Select the appropriate Google Tag Manager account and container
  5. Skip Configure Advanced Matching. This isn’t necessary right away and can be completed later if desired.
  6. Add and edit your tags. This is where you can choose which on-site events you want the Facebook pixel to track for you. To do this, select the relevant trigger from your Google Tag Manager account. Don’t worry if you can’t find an Event option that makes sense for the actions you want to track — you’ll be able to update this in Tag Manager later if you’d like. If you don’t already have triggers set up in Google Tag Manager, you can also add additional event tracking to the pixel later.
  7. Hit Publish and you’re all set!

How to name your tag

Let’s say Power Poetry wants to use the Facebook pixel to track people who viewed their poetry lesson plans. They can select the event type ViewContent and choose the Uploaded Content View trigger that they had already created in their GTM account.
The Tag Name is how you’ll be able to identify this tag in Tag Manager, so we recommend including “Facebook Pixel” somewhere in the Tag Name so you’re able to easily identify these tags in Tag Manager later. In this case, Power Poetry might therefore name this tag “Facebook Pixel – Lesson Plan Views”

How to update Facebook pixel events in Google Tag Manager

Hitting Publish will cause multiple tags to be created in your Google Tag Manager account. This might take 30-60 minutes to populate. Once the configuration is complete, you’ll see the pixel tags in your account with the names.

You’ll see at least one tag for Pixel Base Code — this is the code that tracks simple pageviews to your website. If you configured additional event tracking during the setup process, you’ll see those added as tags too. Remember, event tracking tags will be named whatever you named them in the setup process. Search for those to ensure everything’s gone through properly.
You can click on any tag to edit the naming conventions mentioned earlier. For example, if you selected the ViewContent event earlier, but that’s not relevant to what you’re actually tracking, you can edit that name directly in the tag. We may update the ViewContent text in the tag below to say “EmailSignup” since that is the action we’re actually tracking:

Once the tag is updated, the event will appear with the proper name in Facebook.

How to create a new Facebook pixel event in Google Tag Manager

Creating a new event in Google Tag Manager after your initial pixel installation is super simple:

  1. Create a new Custom HTML Tag in Google Tag Manager
  2. Copy and paste the code of your Facebook Pixel Base Code tag into the new tag
  3. Edit the PageView text to the desired name of the new event (‘EmailSignup’, ‘Donation’, ‘VolunteerRegistration’, etc.)
    creating facebook pixel events in google tag manager
  4. Change the trigger from all pageviews to the trigger that corresponds with what you want to track.
  5. Test the tag in Google Tag Manager’s preview mode, review, and publish!

The bottom line

When it comes to tracking events, remember that most conversions aren’t a one-and-done situation. Many users take a few steps before converting. You’ll therefore want to understand each step that led them to take action. If you’re tracking donations, don’t just track donations. Set up event tracking for content views, video views, and other smaller actions. Seeing all of these steps together will help you understand the big picture of how people engage with your site after being served one of your ads.
The Facebook pixel isn't as scary or complicated as it seems. Here's how to get started. Share on X
Have you tried out ads optimized for conversions or set up the pixel yet? We want to hear about it!