Hello. I’m attempting to submit an event to our mixpanel dashboard when a user submits their email address to a signup form. I have this code snippet before the closing </body>
<script>
window.addEventListener("klaviyoForms", function(e) {
if (e.detail.type == 'submit') {
let formLocation = 'Popup';
if (e.detail.formId === '<FORM_ID>' || e.detail.formId === '<OTHER_FORM_ID>') {
formLocation = 'Footer;
};
mixpanel.track('Email List Signup', {
'Form location': formLocation,
'User email': e.detail.metaData.$email
});
};
});
</script>
I added a console log statement in there as well but was not seeing it get hit when I submit either of the forms. It’s like the listener for `klaviyoForms` is failing. Any help here would be great,
Thank you