Function on Form Submit Click

I am trying to add a function to my form submit button but I cannot get it to trigger.

I have done the following

  1. Added embedded element → Submit Button
    image

  2. Added function in in custom code for the page
    image


Example Page: https://www.cruiseplus.ca/offers/7-night-alaska-roundtrip-vancouver-8)
Read Only Link: Webflow - CruisePlus Travel & Tours

Hi @jordancp,

You’re missing the closing ‘}’ for your function. This is resulting in this message in the console: ‘submitTrack is not defined’.

Try replacing the code with this:

<script>
function submitTrack() {
window.pagesense = window.pagesense || [];
window.pagesense.push(['trackEvent', 'submit_success']);
}
</script>

If it’s still not working, we can troubleshoot from there.