OptinMonster Documentation

Documentation, Reference Materials, and Tutorials for OptinMonster

Home

Docs

Using the Facebook Pixel with OptinMonster

Using the Facebook Pixel with OptinMonster

OptinMonster makes it easy to integrate the Facebook Pixel with your campaigns.

In this article, you’ll learn how to add Facebook’s Pixel tracking code to your OptinMonster campaigns.

Before You Start

Here are some things to know before you begin:

  • Due to the advanced nature of this guide, at this time we do not provide support for Facebook Pixel implementation.
  • The Success Scripts implementation option in this guide requires a Growth subscription.
  • This guide provides additional options for implementing the Facebook Pixel that are available with all plans.

Get Started With OptinMonster Today!

BONUS: Done-For-You Campaign Setup ($297 value)
Our conversion experts will design 1 free campaign for you to get maximum results – absolutely FREE! Click here to get started →

Facebook Pixel Base Code

Before you can implement the Facebook Pixel with your OptinMonster campaigns you’ll need to add the Base Code to the website where your campaign(s) will appear.

Facebook recommends that you add the Base Code for the Facebook Pixel to all pages of your site in their Facebook Pixel documentation.

You'll want to add the Facebook Pixel Base Code to all pages of your website according to Facebook's documentation.
The Standard Event code is what will be added to your OptinMonster campaign in the next steps.

Example of Standard Event Code
<script>
fbq('track','Lead');
</script>

There are several different approaches you can choose to add the Facebook Pixel to your OptinMonster Campaign. We’ll walk through each option step-by-step.

Add Pixel via Success Scripts

If you are using one of our native integrations, the easiest way to implement the Facebook Pixel with your OptinMonster campaign(s) is using Success Scripts.

Success Scripts requires a Growth subscription. If you are using a Custom HTML integration be sure you’ve edited your custom form to track conversions when submitted.

Add Pixel via HTML Block

If you do not have a Growth subscription or would like to trigger the Facebook Pixel on a different event than conversion, you can use our Javascript Events API.

Follow these steps to add the Facebook Pixel using an HTML Block.

  1. First, you will need to determine which event your Facebook Pixel should be fire on. All OptinMonster events are outlined in our Javascript Events API doc.
  2. Next, add an HTML Block to your campaign.
    Add an HTML block to your campaign.
  3. Add your Facebook Pixel code to the HTML Block.
  4. When you’re finished, click Save.

HTML Block Examples

The following are some examples you can use to get started triggering your Facebook Pixel on different OptinMonster Javascript Events.

Trigger Facebook Pixel on Successful Conversion
<script>
document.addEventListener('om.Optin.success', function(event)
if (event.detail.Campaign.id === "{{id}}") {
// Your Facebook Pixel Code
}
});
<script>
Trigger Facebook Pixel When Campaign is Closed

In this example, the om.Optin.close event will fire only when the campaign is closed.

<script>
document.addEventListener('om.Optin.close', function(event)
if (event.detail.Campaign.id === "{{id}}") {
// Your Facebook Pixel Code
}
});
</script>
Trigger Facebook Pixel When Campaign First Shows

In this example, the om.Optin.afterShow event will fire only after the campaign becomes visible.

<script>
document.addEventListener('om.Optin.afterShow', function(event)
if (event.detail.Campaign.id === "{{id}}") {
// Your Facebook Pixel Code
}
});
</script>

FAQs

How can I trigger a different Facebook Pixel event?

You may need to customize the specific Standard Event to fit your needs, please refer to this list of Facebook Pixel Standard Events for what’s available.

Do I have to add the code to an HTML Block in the campaign builder?

No, you can use the Success Script option if you have a Growth subscription or you can add the Javascript directly to your website where the campaign will appear to visitors.

How can I add JavaScript to my WordPress site?

See how to add JavaScript to your WordPress site by following this guide.


Still stuck?

How can we help?

Last updated on


Start Getting More Leads & Sales Today with OptinMonster!

Start Getting More
Leads & Sales Today
with OptinMonster!

Create and launch smart capture forms today in minutes. What are you waiting for?

Create and launch smart capture forms
today in minutes. What are you waiting for?

OptinMonster has transformed our business. Before integrating their optins, our clients saw a 2% conversion rate from web traffic, which is slightly above the standard for their industry. With the integration of OptinMonster’s lightbox popup, exit-intent technology, split testing, and other tools, our client’s conversion rates soared by an unprecedented 500%. They attracted substantially more customers while spending less on digital advertising. Their success propelled them to the top of their markets, outperforming national chains and other medical spas with much bigger marketing budgets. Our client’s success in their market has distinguished us in our own. We are now one of the most sought-after marketing firms in the industry of aesthetic medicine. We know that the integration of OptinMonster, more than any other tool or marketing strategy, has supported this growth and achievement.

chris zelig medstar media

Chris Zelig

Partner, Medstar Media

OptinMonster has been a game-changer for us. From driving donations to collecting new leads, there is nothing that this simple tool has failed to accomplish. Our lead collection rate has jumped by over 1,000%.

joe lowe american bird conservancy

Joe Lowe

Director of Digital Communications, American Bird Conservancy

Through OptinMonster’s exit-intent popups, we have more than doubled our sales conversion rate. Best of all is the compound effect of using OptinMonster over a long period of time—more conversions mean more customers, which means more word of mouth.

mitch smith, managing director, shockbyte

Mitch Smith

Managing Director, Shockbyte.com