Solved

Pass a custom event through a legacy form?


Badge

Hi! I’ve hit a bit of a wall with creating a custom event to trigger a email flow. Here’s the situation:

  • We created a Klaviyo Legacy Form to capture customer info. This uses FormData. We used this option because we needed the form to have dynamic hidden fields (based on the user’s answers to a quiz).
  • We would like to create a custom event that sends a “submits form” event to Klaviyo to trigger a flow each time someone submits the form. (Creating a flow that is triggered based on someone being added to a list does not work for our use case, as we want someone to get this email flow if they submit the form multiple times).
  • We’ve been told the best way to create this custom event is through custom API, but this requires a JSON-object to pass the event over. Normally, it would not be a problem to add code to send JSON through FormData, but it appears that Klaviyo views a FormData-object as an endpoint.

Based on the information above, does your team have any insight on how to create a custom event trigger for submitting a form using the Legacy Form?

 

**Note, I am not the developer; I’ve been working with an agency that does our development and they’ve hit a wall. I’ve relayed the information to the best of my abilities based on what they’ve described, but if there are flaws in my lingo/phrasing, please let me know!**

icon

Best answer by jallain 22 July 2021, 18:27

@aereid If you are submitting the legacy form to the https://manage.kmail-lists.com/ajax/subscriptions/subscribe endpoint with the FormData, nothing about that needs to change.

 

All you will want to do to create a custom event is to leverage _learnq and feed it any data that you want to record about the event. If you already have our onsite javascript, _learnq should be available to you. 

https://apidocs.klaviyo.com/reference/javascript-client-library

View original

2 replies

Userlevel 3
Badge +2

@aereid If you are submitting the legacy form to the https://manage.kmail-lists.com/ajax/subscriptions/subscribe endpoint with the FormData, nothing about that needs to change.

 

All you will want to do to create a custom event is to leverage _learnq and feed it any data that you want to record about the event. If you already have our onsite javascript, _learnq should be available to you. 

https://apidocs.klaviyo.com/reference/javascript-client-library

Badge

Thank you @jallain, that seems to have done the trick!

Reply