< Blogs

A Guide to Facebook Pixel Events and Campaign Optimization

Are you thinking of running Facebook and Instagram ads targeting users who have shown interest in your product?
Do you want to track the people who visit your website?

Then Facebook pixel is of great use to you.
In this article, you are going to learn in detail what a pixel is, how Facebook tracks visitors using events in pixel, how you can optimize your campaigns and much more. No matter what your Facebook advertising proficiency is, this article will serve as an easy-to-understand guide about Pixel.

Facebook Pixel Events and Campaign Optimization

Table of Contents

Facebook pixel is an analytics tool that lets you understand the actions visitors take on your website. To use pixel, Facebook gives you a piece of code that you need to install on your website.

Pixel allows Facebook to receive information from your website and serve more relevant ads to your audience. It also helps in retargeting consumers with the help of the Custom Audience feature.

What is Facebook Pixel

1. Retarget your potential customers

When someone visits your website after clicking on a Facebook ad, they may not always complete an action, such as making a purchase. Facebook pixel collects the data of these website visitors whom you can retarget through Facebook ads.
For example , if you are a real estate agent, you can retarget the people who have visited your website, seen your project, and left the website.

2. Measure cross-device conversions

Facebook pixel lets you track how your customers move between their devices, across the web, and mobile apps before they convert. You can have a detailed analysis of how your cross-device ads influence conversions.
For instance, a restaurant owner can see the number of customers who clicked his ad using an iPhone but later got converted on a desktop. These cross-device insights help the restaurant owner to identify how and where their ad campaigns are performing.

3. Optimize ads for conversions using events in pixel

Suppose you are running an ad to drive sales. The ad reached 100 individuals, out of which ten individuals made a purchase.
Facebook pixel learns about the audience that made the purchase and helps create a similar audience. So you can show your ad to the kind of customers who are more likely to perform the purchase action. These actions are called ‘Events.’ We are going to shed more light on it ahead.


  • We use events for registering actions on the webpage.
  • Facebook then helps us optimize the campaigns based on the information collected from the event.
  • We just need to place the appropriate pixel code on our website or landing page.

It does it through two kinds of events:
1. Standard events 2. Custom events

1. Standard events

As the name suggests, Standard events are predefined by Facebook. These are the actions that Facebook identifies and supports across ad products.
Here is an example of a Standard event: Suppose someone wants to click through your website. They navigate to your contact page and fill out a contact form. Then you take them to a ‘Thank You’ page.

Now, we can have an event code as part of the Facebook pixel installed on the ‘Thank You’ page. Suppose if we set that event as ‘Lead’, when someone reaches the ‘Thank You’ page, the event pixel is fired and is counted as a lead.

You can run a conversion campaign (explained later in the article) that’s optimized for this lead event. This means Facebook will find more people similar to those who opt in to become your lead.

Similarly, you can set up appropriate events for different businesses, such as an Add-to-cart event for e-commerce businesses.

Preset standard events include:
  • Purchase
  • Lead
  • Complete registration
  • Search
  • Add to wishlist
  • Add to cart
  • View content
  • Contact
  • Add payment info
  • Initiate checkout
 Standard Events in Facebook Pixel

You have the option to set up standard events while creating your pixel. If you do not set up events at that time, you can still add them later.

2. Custom events

Custom events are like standard events, but they are custom. They are unique for you.

Let us say your website has 3 different marketing funnels. And if you set a common, standard Lead event for all of them, it might get confusing when the lead event is fired. The lead event may not be for the funnel that you intended it to be.

In that case, you would need to give a unique name to each of your lead events (e.g. lead_a, lead_b, lead_c).

Custom events are not URL based. Even if you change the URL of the page where you have installed the custom events, it still works fine.

From tracking clicks when someone clicks a specific section on your website to tracking engagement when someone clicks the play button in a particular video, you can literally track whatever you want.

To set up custom events, we follow the same process as standard events. Just add your code or name instead of the standard event codes.

You can track all the events in your events manager and also create Custom Audiences with events.

An easy tutorial on installing Facebook pixel and adding Events to your website:

Till now, we learnt the fundamentals of what is pixel, what are its uses, how it tracks data using events in pixel.

Now we learn how to create and install Facebook pixel on your website

It is an easy, three step process:

Step 1: Create a Facebook pixel

Step 2: Add the Facebook pixel to your website

Step 3: Set up events

Step 1. Create a Facebook pixel

A. Open Events Manager.

Digital Marketing Quote

B. Click Connect data sources and then select Web.

Events Manager for Facebook Pixel

C. Select Facebook pixel and then click on Create.

Connect data sources in Facebook Pixel

D. Add your pixel name and enter your website

Learn How to Create a Facebook Pixel

Step 2: Add the Facebook pixel to your website

Once you have created your pixel, you can install it on your website’s header. You can do these using any of the options mentioned below:

  1. Use an Integration or Tag Manager
  2. Manually install the code yourself
  3. E-mail instructions to a developer

We demonstrate here the easy manual setup method:

A. Select installing code manually and copy the pixel base code

Adding a Pixel Name and Website
Adding Facebook Pixel Code to Website

B. Find the header of your website or the header template in your CMS platform. Paste the code at the bottom of the header section, inside the closing <\ head > tag.

Way to install Facebook pixel code on a website

On a CMS like WordPress, you can download a plug-in like “Insert Headers and Footers by WPBeginner '' and easily insert the pixel code in it.

C. Optionally, you can toggle on ‘automatic advanced matching’ and verify the customer information that you want to send. Click Continue.

Adding Facebook pixel code in WordPress

Step 3: Set up events

It is time to set up the events.
We can do event setups either by manually installing the code or using the event setup tool.With the event setup tool, you can add your event to the website in a few clicks.

A. Click on ‘Open Event Setup Tool’

B. Enter your web page URL on which you want to install the Facebook pixel event.


C. Facebook Event Setup window will pop up. Click on the event you want to track.

D. Now there are two main ways to track events:

  1. Track a URL
  2. Track new Button

Facebook Event Setup Tool Demo

1. Track an event using a URL

Click ‘Track a URL’ if you want to track the action of someone landing on a page. Select the event from the drop-down menu—e.g. Lead, Add to Cart, etc.). Then click ‘Confirm’.

Web page URL for installing Facebook pixel event

Quick info: The event triggers only when a customer lands on this page and allows it to load completely.

2. Track an event with a button click

If you want to track the action of someone clicking something like a button on a webpage, click ‘Track new Button’. Facebook will then highlight all of the clickable button options on your webpage. Select the one on which you want to set up your event.
Remember, when you set up an event on a button, it gets added to all buttons having the same or similar text on your website.

Track an event using URL in Facebook pixel

Now select the event that you want to trigger. Click ‘Confirm’.

Track an event using button click in Facebook pixel

Once you have selected the type of ‘event type’ you want to track, you can see it in the Facebook event setup tool window.

Types of Facebook pixel events

E. Review your Facebook pixel events: Once you have added and reviewed all of the events, click ‘Finish Setup’. Then click ‘Finish’.

Facebook event setup tool

F. Finally, test if the pixel setup is correct.

Review Facebook pixel events

G. Get insights on how your pixel is working under the Diagnostics tab, in Events Manager.

Test Pixel event setup

Pro Tip: Install Facebook Pixel Helper extension in your browser that shows if your pixel is firing properly or not.

That’s how we install the pixel and set up the events. Believe me, it is much easier once you try.

Now comes the part where we learn about how to use the event insights to run better ad campaigns.
Under Events Manager, there are broadly four ways to create highly targeted campaigns:

  1. Create a custom audience 
  2. Create a Lookalike audience
  3. Create conversion campaigns
  4. Create Ad

To run them, first you need to assign your pixel to your ad account: Here is how you do it!

  1. Follow this path Facebook Business Settings > Data Sources > Pixels. Select the pixel that you would want to assign to your ad account.
  2. See if your personal account already has the rights to “Manage Pixel”. Else, follow this path: Add People > Manage Pixel; to create, edit and view pixels.
  3. Click “Add Assets” and select the ad account you want to assign your pixel to.
  4. Finally, check if the connection is made successfully by clicking the “Connected Assets” tab.
Check how Facebook pixel works under diagnostics tab

Once done, we are ready to run optimized ad campaigns. Let us look at the four ways to do it.

1. Create Custom Audience

You can reach an audience who have already engaged with your brand using custom audience selection.
These audiences are registered when they engage with the page where your pixel is on.
Since they are already aware of your brand, ads targeting them have much higher chances of bringing you business than ads targeting a general group of Facebook audiences.

Optimizing Campaigns using Facebook Pixels

2. Create Lookalike Audience

It is helpful when you want to expand your audience reach beyond those who have visited your website. Using your custom audiences, you can create new audiences similar to them.
As a result, your new audience has the potential to be as effective as your existing, best-performing ones.

Create a custom audience in Facebook

3. Create Custom Conversions

Just like events, conversions are also actions that people take on the website. With one exception—you can auto-optimize campaigns for conversions. That’s the big difference between an event and a conversion.
Conversions are typically created from a URL. You can set up custom conversion from the Events Manager.
Conversions are of two types:

1. Standard Conversion
You can run conversion campaigns based on standard events. Facebook pre-configures all standard events to standard conversions.


1) Add to Cart Event = Add to Cart Conversion

2) Lead Event = Lead Conversion

2. Custom Conversions
Unlike standard conversions, if you have a custom event to optimize your campaign for, you will need to turn it into a custom conversion first (since you could auto optimize for custom conversions, but not custom events). Then you choose a standard event that best matches your custom conversion.

By doing it, Facebook can deliver your ad to those who are most likely to take this type of action.

We can choose to track people from the entire website by selecting All URL Traffic.

We can even customize it.

For instance, you have an e-commerce website. You have a 'Trial' offer for customers buying a specific product.

Create a lookalike audience in Facebook
  • We set the URL equals to: xyz.com/trial-product-abc (without http:// or https://)
  • On Facebook, we name the custom conversion as: Trial-ABC
  • We turned our custom event ‘JoinChat’ into a custom conversion.
  • Then we find the best standard event match to track the custom conversion.
  • Based on the tracking info, we can optimize the campaign for the custom conversion and find more people who would like to have a trial of that specific product.

This is how you can record events for specific pages and optimize campaigns based on it.

If you want to track all those people visiting the URL that contains a particular word, set the URL to ‘contains’.

An e-commerce business might set the URL rule as that contains something like 'Ethnic Fashion’. This helps them know who all visited pages about ethnic fashion.

Suppose you run ads for particular categories such as 'Electronics', you still get to know who all browsed from the Electronics section to 'Ethnic Fashion'.

On the contrary, set the URL to ‘doesn't contain’ if you want to exclude people who visit specific pages on the website. You can add more than one rule as well.

4. Create Campaigns (Create Ad)

You can create an ad with any of the three objectives of awareness, consideration and conversion. Using the pixel information, you can drive conversions.

Campaigns with a conversion objective encourage the audience to perform a specific type of action, such as filling a lead form or making a purchase. Let us say you want to increase sales on your website.

Using the Conversions objective, you can deliver ads to people who are more likely to buy from your website. You can also get the direct cost per conversion event to better estimate your ROAS.

Optimize campaigns for a custom conversion

To do this, select the appropriate event that you want to use for optimizing your campaign. For website-related events, select a standard event or custom event or custom conversion. Similarly, if you want to promote an app to existing users, you can choose a standard event.

However, if you want to reach new users to increase app installs, change the campaign objective from Conversion to App Installs, and optimize your app ad for a custom event.

As we see, in conversion campaigns, it is crucial to set the right event to determine your ad delivery. That is because Facebook understands and delivers what you ask it to deliver.

Based on your business type and the stage of your audience you intend to target, you can select the right event that helps you find better ROAS for Facebook conversion ads.


  • Facebook pixel is a powerful tool to track audience engagement and create high-performance ads based on the engagement insights. We learnt about setting up Facebook pixel events and how you can choose the right Facebook pixel event to optimize your ad campaign.
  • At Mediaqart, we help customers execute end-to-end Facebook campaigns with an automated performance advertising platform. Please share your insights or ask if you have any query on Facebook advertising in the comment section. We would be happy to learn and improve your ROAS for Facebook ads.