Hi there, following this community post from former unbounce staff I was able to add JS snippet to select landing pages to prevent form submissions with spam domains
I’ve confirmed it works when applied on a per-page basis but when I put it in script manager to make it domain wide, it doesn’t work anymore unless the script is on that page already.
here's what it looks like on a page
<script>
window.ub.form.customValidators.EmailDomainValidation = {
isValid: function(value) {
return /\@(?!(me|mac|qq|yandex|gamil|aol|tasla|msn|teleworm|business|getmail|mailinator|mailina|mail|hhh|domain|gmailr|bussiness|businessmail|jourrapide|armyspy|hldrive|gmailinator|eamail|tech|email|info|armyspy|manimailinator|mailin|memail|hhh|gamail|fuck|memail|email|asdfasd|out|efu|ko|domain)\.)/.test(value.toLowerCase());
},
message: 'Please enter a valid email address',
};
</script>
<script>
window.ub.form.validationRules.work_email.EmailDomainValidation = true;
</script>
I’ve tried placing it in the <head> in script manager, but that didn’t work. Any advice is appreciated as I’m not a technical person.
At the end of the day we are validating domains with hubspot so even if a user submits a spam email in unbounce they won’t be synced into our contacts but I’d still like to keep our stats as clean as possible in unbounce.
Thanks!
Best answer by Hristian
View original