Welcome to the Instapage Support Center


Using events to track conversions with the Facebook Pixel

Our direct Facebook Pixel integration allows you to track page view event tracking on your landing pages. Besides this, Facebook allows for custom events usage. The advantage of implementing custom events instead of the standard page view event is that you can use conversion optimization and track more efficiently. Furthermore, using custom events will allow for a more granular use of Facebook's Custom Audiences feature.

Custom conversions can be triggered either by button clicks, by form submissions or by visits to a thank you page (used as a conversion page).

Please check our article on how to connect your Facebook Pixel to your landing page.

After placing your Facebook Pixel ID on your page, follow the instructions below to set up your desired event tracking.

The code snippets will need to be placed in Settings - Javascript - Body.




1. Conversions triggered by button clicks

For tracking button clicks or form submissions on your page as Facebook custom events, you will need to use the following code snippet:

window.addEventListener('DOMContentLoaded', function () {
var element = document.querySelector("#element-123 .btn");
element.addEventListener("click", handler);
function handler() {
fbq('track', 'Lead');

You will need to customize the code with your Facebook event and change the #element-ID with the corresponding element ID that you want to trigger the event. Here is how you can find the button element ID number:


2. Conversions triggered by form submissions

For tracking form submissions as Facebook custom events, please use this code snippet:

<script type="text/javascript">
window.instapageFormSubmitSuccess = function( form ){
fbq('track', 'Lead');


If you have multiple forms on the same page, please use the snippet below. This needs to be pasted into Settings - Javascript - Body:

window.instapageFormSubmitSuccess = function( form, wid ){
if ( wid === 6 )
fbq('track', 'Lead');
else if ( wid === 7 )
fbq('track', 'Lead');
// do nothing out of a box

For this second code snippet, you will need to edit the "wid" value, which is only the digit part of the element ID. For #element-659, the "wid" value is "659".

When using the FB Pixel Helper (browser extension) to check if the pixels are firing correctly, please disable the AdBlocker extension (if the case).

3. Conversions triggered on the thank you page

You can also track conversions with a thank you page. First, create and publish a thank you page, and then set your main landing page to redirect to the thank you page.

In this case, both pages should have the Pixel ID connected through our direct integration in Settings - Analytics, according to this article.

After making sure that the pixel is connected on both pages, add this code snippet only to the thank you page, in Settings - JavaScript - Body: 

fbq('track', 'Lead');

In the code snippets above, fbq('track'  , 'Lead') is an example, but you can choose to replace it with any predefined Facebook events:

Standard Event Name

Promoted Object custom_event_type value




















Here's more about setting up a custom event, from Facebook: Create custom conversions using events.

In case you need help with a custom functionality or any code customization that is not provided through our Help Center articles we have a Professional Services team that can help our Enterprise users. The Enterprise Solution includes Professional Services as well as additional features and services that can be seen here: https://instapage.com/enterprise-benefits

Have more questions? Submit a request
Was this article helpful?
2 out of 2 found this helpful

Need Further Help?

Tell us what you need and we will be happy to assist you.

Our team of expert support staff and our community can answer your questions. Submit a ticket, or reach out on live chat!