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 tracking more efficiently. Furthermore, using custom events will allow for a more granular use of Facebook's Custom Audiences feature.

Custom Events/Conversions can be triggered either by button clicks, form submissions, or by visits to a thank you 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.

settings_button.png

JAVASCRIPT.png

javascript_body_.jpg

1. Button clicks

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

<script>
ijQuery(document).ready(function(){
ijQuery('#elementID a').on('click', function() {
// add your event code here
});
});
</script>

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. The element ID can be changed by right-clicking on the element and selecting the Inspect option.

For example, your code should look like this: 

<script>
ijQuery(document).ready(function(){
ijQuery('#element-123 a').on('click', function() {
fbq('track', 'Lead');
});
});
</script>

2. Form submissions

Use the following code snippet in order to track form submissions as Facebook custom events: 

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

 3. 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: 

<script>
fbq('track', 'Lead');
</script>

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

Standard Event Name

Promoted Object custom_event_type value

ViewContent

CONTENT_VIEW

Search

SEARCH

AddToCart

ADD_TO_CART

AddToWishlist

ADD_TO_WISHLIST

InitiateCheckout

INITIATED_CHECKOUT

AddPaymentInfo

ADD_PAYMENT_INFO

Purchase

PURCHASE

Lead

LEAD

CompleteRegistration

COMPLETE_REGISTRATION

 

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

Have more questions? Submit a request
Was this article helpful?
0 out of 0 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!