if (document.readyState !== 'loading') { us_sendFormAfterSuccess(); } else { document.addEventListener('DOMContentLoaded', us_sendFormAfterSuccess); } function us_sendFormAfterSuccess() { var forms = document.querySelectorAll('.js-form-proccess'); Array.prototype.forEach.call(forms, function (form) { form.addEventListener('tildaform:aftersuccess', function () { mySuccessFunction(form); }); }); } function t396_onSuccess(form) { if (!form) return; if (form instanceof jQuery) { form = form.get(0); } gtag('event', 'submit_form'); }