Cognito-forms – Facebook pixel Event tracking code implementation

cognito-forms

I have a very specific question regarding the publishing code of Cognito Forms.

Can I (and how) insert a Facebook pixel event tracking code on a Cognito form code. For instance to track when a submit button has been clicked.
Lets say this event for example: fbq('track', 'AddToCart', {});

I couldn't find an answer to this question in the Q&A data base.

Best Answer

The only solution for this would be to redirect the form to a thank you page in your own system which has the Facebool pixel enabled. Then after that you can create a custom conversion based on the url the person visited on FB's side.

So you have: yourpage.com/form (a embeded cognito form)

Once completed, make it redirect to yourpage.com/thankyou_form (Make sure the pixel is here)

Then on Facebook, go to pixels->custom coversions-> new
and make a new conversion that matches /thankyou_form