This article explains how to set up a Facebook Pixel in the Classic Builder.
Adding a Facebook pixel to your landing page requires 4 steps:
- Option 1: Manually add conversion event tracking
- Option 2: Track events using Facebook's Event Setup Tool
Step 1: Create your Facebook Pixel
- Log into your Facebook Business Manager.
- Click the menu icon on the left-hand side & navigate to the Events Manager.
- The Data Sources page will appear.
- Within the left-hand side menu bar, click the green plus button titled Connect Data Sources.
- In the dialog box that appears, select the Web option. Click Connect to continue.
- In the next step, select Facebook Pixel:
- Click Connect to continue, then add the details required for your FB pixel setups, such as your pixel name, and your landing page URL (optional).
- Click the Continue button to finalize these changes.
You’re all set! You’ve now created your Facebook pixel. Next, we can copy the code & embed this pixel onto your landing page(s).
Do note that Facebook’s display settings may change with regards to steps on creating your pixel. Please review Facebook’s documentation to access the most up-to-date steps: Create & Install a Facebook pixel.
Step 2: Install your Facebook Pixel code on your Unbounce landing page.
- From the Facebook Data Sources page, choose the option to Manually add pixel code to a website.
- From the Install Base Code page, click the Copy Code button from the dialog box:
- Back in the Unbounce Builder, navigate to the page where you'd like to install the Facebook Pixel.
- Paste in the pixel base code copied from Facebook's Ad Manager:
- Name the pixel script, and select the Head option in the Placement drop-down menu.
- Once you've completed all these steps, click the Done button in the bottom right corner of the dialog script box in Unbounce.
- Be sure to Save & Republish/Publish your page.
Step 3: Track Conversion Events with FB Pixel (Optional)
Once you’ve set up your pixel base code, you can manually install and add event tracking scripts to the same pixel code to track custom events. You can set up conversion tracking for both or either standard events & custom events.
Or, you can utilize Facebook’s nifty point-and-click Event Setup Tool that lets you add event tracking automatically within the Business Manager.
What you’ll need:
- Your base code must be embedded onto your home page/main landing page (Step 2), i.e., on every page where you want to track a conversion back to Facebook.
Option 1: Manually Adding a Facebook Pixel tracking event in Unbounce
Be sure to install the event tracking snippet only on the final page your users land on once they complete the conversion action. In some cases, this will either be the form confirmation dialogue, or a separate thank-you/ confirmation page.
To relay this back to Unbounce, here’s a table to break what to install & where:
Main Landing Pages
Confirmation Page (thank-you page or Unbounce’s form confirmation dialogue)
|Facebook pixel base code only||
Facebook pixel base code + conversion tracking snippet
Follow these steps to install the conversion tracking snippet on your form confirmation dialogue.
- Within the builder, navigate to your landing page, and select the Form Confirmation Dialog tab at the top left corner.
- Paste in your Facebook pixel base code again within a new dialog box.
- Name your script, & this time set the placement to After Body Tag.
- Within the base code, be sure to remove the 12th line of code (or whichever line includes fbq('track', Pageview);, as shown in this screenshot:
Now, we’ll edit the script to include the conversion tracking code.
- You can choose from the list of custom events provided by Facebook’s list of standard events.
- As an example, let’s manually set up event tracking to track a lead. The snippet of code looks like this: fbq('track', 'Lead');
- Add the conversion tracking snippet to the base code:
Here’s how the implementation of installing the base code & event snippet looks like:
- Once you've completed all these steps, click the Done button in the bottom right corner of the dialog box.
- Be sure to Save & Republish/Publish your page.
Option 2: Tracking Conversion Events using Facebook’s Event Setup Tool
- Back in Facebook’s Business Manager, navigate to the Data Sources page (to view your list of all current events).
- Click the Add Events dropdown button.
- From the drop-down menu, select From the Pixel:
- When prompted, enter the URL for your landing page, then click Open Website.
- Your landing page will launch in a new window, along with a pop-up of the Facebook Event Setup Tool.
- Choose the option to either
- Track New Button, or
- Track a URL
- Follow through all the Facebook prompts to select the type of standard or custom event you’d like to track.
- Repeat this process for every button or URL for which you’d like to set up triggers or events.
- When you’ve finished, click Finish Setup and save your changes.
For more detailed steps, take a read of Facebook’s documentation explaining how to use the Event Setup Tool.
If you run into trouble using this tool, we recommend reaching out to Facebook's support team, as the Event Setup Tool is outside the scope of Unbounce's support.
You can use Unbounce’s Script Manager to apply the pixel code across all pages linked to a particular domain. However, variant-level scripts (as demonstrated in this article), load before domain-level scripts. Be sure to install the scripts in either Script Manager OR the page-level, not scattered between both: meaning, all scripts either in Script Manager, or all scripts at the variant-level.
Step 4: Testing your Facebook Pixel Base Code & Events
Download the Facebook Pixel Helper plugin to test if your pixel is firing correctly or what information is firing back to Facebook. You can also submit test lead submissions on your page(s) and check the plugin for details on the conversion event.
Ad-blocking tools can sometimes prevent the Facebook pixel code from firing when your landing page loads. To remedy this, remove/disable the ad-blocking script from your page, and test the page again using the plugin. Or, you can submit a test conversion and check your stats in Facebook’s Ad Manager.