I'm trying to track (with Adobe Analytics and Tealium) as an event when someone submits email form successfully.
I can get the event to fire when a user clicks submit but it fires even if the email field is empty or an error
jQuery(document).on('mousedown', 'button[name="dwfrm_requestpassword_send"]', function() {
utag.link ({
"link_name": "password email reset",
"event_name": "email password"
});
});
but this fires on every click. Then I tried to add a condition as such:
jQuery("#dwfrm_requestpassword_email-error")[0]
or if (jQuery("#dwfrm_requestpassword_email-error").length == 0)
but couldn't get it to tie together.
Trying to get the following: When a user clicks submit and it's successful fire the tracking event
I expect to fire the utag.link only after an email address has been put in and hits submit with no issues