You can easily track leads collected by Wisepops in your Facebook Advertising analytics. We do this, we will use the Wisepops JS callbacks feature.
Prerequisite
The Facebook pixel must already be installed on your website, on the page where Wisepops will collect leads. Please follow this guide from Facebook to learn how to do this.
Track the lead event on Facebook
Once a Wisepops form is posted and the validation passes, we want to track the lead event on Facebook.
Open your popup in the campaign builder. In the left menu, select JS callbacks.
Create a new callback, linked to the After form submit event:
Copy and paste the following snippet. Since this callback is expecting JavaScript, the snippet does not need to be surrounded with
<script>
tags.if (event.target.elements['email']) {
fbq('track', 'lead');
}Why
if (event.target.elements['email'])
?
In a multi-step campaign, the After form submit event is triggered at each step completion. By testing the presence of the email in the collected data, we ensure that the lead is tracked only once on Facebook, when the step containing the email is completed.Save your campaign.
You're done! The pixel will be fired every time an email is collected.