Skip to main content
Solved

Can you fire custom JS on a form submit?


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!

View original
Did this topic or the replies in the thread help you find an answer to your question?

2 replies

stephen.trumble
Community Manager
Forum|alt.badge.img+60
  • Community Manager
  • 1518 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!