Skip to main content
Solved

Can you fire custom JS on a form submit?

  • July 15, 2022
  • 2 replies
  • 919 views

Forum|alt.badge.img+3

Does anyone know if it’s possible to wire the signup form’s submit button to also fire some custom JS?  

 

In a nutshell, I basically want to fire client side JS function as soon as the user submits the form so I can store some data in their session.

 

Any help would be greatly appreciated.  Thanks!

Best answer by stephen.trumble

Hey @SharonSTP 

Thank you so much for asking the Klaviyo Community for help!

There is a track API snippet that you can add to your site. It is documented in our Adding Custom JavaScript Events to Forms guide. Hope this helps!

2 replies

stephen.trumble
Forum|alt.badge.img+60
  • Klaviyo Alum
  • 1515 replies
  • Answer
  • July 15, 2022

Hey @SharonSTP 

Thank you so much for asking the Klaviyo Community for help!

There is a track API snippet that you can add to your site. It is documented in our Adding Custom JavaScript Events to Forms guide. Hope this helps!


Forum|alt.badge.img+3
  • Author
  • Active Contributor I
  • 10 replies
  • July 15, 2022

Thanks @stephen.trumble that’s super helpful!