Running js on submit of a form or on success #492
-
Looking to track conversions from Linkedin on a form. LinkedIn gives us a snippet of code like |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @lpearson-trek10! Thanks for the question. Assuming that you're using AJAX to submit forms, it would look something like this: const myForm = document.getElementById("my-form");
myForm.addEventListener("freeform-ajax-success", function (event) {
const form = event.form;
const response = event.response;
window.lintrk('track', { conversion_id: response.submissionId })
}); |
Beta Was this translation helpful? Give feedback.
Hi @lpearson-trek10!
Thanks for the question.
You would have to write an event listener that listens to form submit events. The documentation for it is here
Assuming that you're using AJAX to submit forms, it would look something like this: