Modify form validation to prevent free email domains?


I’m trying to incorporate an extra form validation function that will display an error if users try to submit form data with a free email provider domain in the ‘Email’ input field.

I can do this using an iframe, but I want to do it from within Unbounce since Unbounce uses the MailChimp API and can be set up to not send an “Opt-In” email.

Below is the script I’ve been trying to incorporate but it doesn’t seem to work. I think it’s running into a conflict with the existing validation scripts. Is there a way to add this function to the included form validation, or a way to remove the included form validation entirely?


23 replies

Hi Michael,

Great question! I’ve asked my colleague Mark to hop in on this and provide the technical answer, but in the meantime I was hoping you could give me a bit of insight as to why you’re looking to do this. It sounds like an interesting use case, and I’m curious as to the reason you’re looking to block free email providers.

Stay tuned for Mark’s reply!

B2B landing page with a Free offer. We don’t want people using their @freeemailprovider.com emails as our Sales teams often use publicly available company information to craft product offerings & pitches specific to the company.

In short, we’ve captured those kinds of emails before & for B2B found them to be worthless.

I found a workaround using an iframe -> HTML/CSS w/jQuery validation -> PHP form handler & just dumping the leads into a DB table them syncing it to MailChimp. Hardly efficient, but works none-the-less.

Let me know if you find a solution using Unbounce’s native validation or w/o an iframe though.

Userlevel 2

Hi Michael,

A cleaner way to do this would be to add a rule to the validation that we already use for our forms. I had a bash at it this afternoon, here’s what I’ve got:

Script: https://gist.github.com/markwainwrigh…

It seems to work, but please make sure you test this thoroughly before using it on any live campaigns!

So that’s the how but I’m also interested in the why! Does anyone else in the community have any thoughts on whether this is a good idea or not? If I were a marketer I’d be worried about false negatives and excluding an otherwise qualified lead just because they tried to use their personal email address. What does everyone think?

Mark

Hi, we are in B2B saas business and interested in the feature as well. I’m going to test the script

Gianluca,

Happy to hear that this solution might work for you! If you test it out, be sure to report back and let us know how it goes.

As a side note, I would keep in mind that although this might help weed out some unqualified leads, it might deter some qualified clients from actually signing up.

Personally, when I’m signing up to get more information about something (even business related) I often just use my gmail account instead of my work email. For the most part, I do this so I can test things out without giving up my professional email, but also because I worry that I might be signing up for a spam list unknowingly - which would be detrimental to my professional inbox. Just a thought.

Either way, I’m curious to hear how this works out for you conversion wise - looking forward to hearing back!

I’ve seen a handful of customers specify “Work Email” rather than just “Email” on their forms – might be something worth A/B testing to see if it improves conversion *and* helps address the problems mentioned above.

Has anyone had success trying something like that?

Mark - Absolutely cleaner your way! I haven’t tried it out (about to) but once I do I’ll report back.

Ryan - I can’t say my experience will translate to every niche or market (behavioral heuristics rarely do!) - and this is certainly not something I’d recommend for B2C/eCommerce - but I have A/B tested this within the last year for O&G clients [To be specific, $500K - $5M drilling compression systems in global campaigns].

The result was:

  • Slightly lower lead volume
  • Higher “qualified” lead count
  • Lower cost per qualified lead
  • Slightly lower cost-per-sale
  • Noticeable jump in email list opens/clicks

*** EDIT: We have tested this on our Unbounce pages that utilize the Unbounce forms w/MailChimp integration & it works as intended.

It’s worth noting that if you change the email input field’s ID to something other than ‘email’, you will need to change the JavaScript to reflect whatever you have modified the email input field’s ID to.

We’ve tested this using the Unbounce forms w/MailChimp integration & I can verify this works as intended with that configuration.

Wow – that’s great feedback Michael. Thanks for sharing! Definitely something I’ll keep on eye on with other customers too.

Michael, that’s awesome to hear! I love seeing results that actually come from A/B testing. It sounds like this solution is something that will surely benefit your use case. Thanks for sharing!

As a B2G (biz to government) SaaS company, we definitely prefer to restrict to professional emails. While conversion is lower, the quality of leads is much higher and our BDRs spend less time chasing down worthless leads. Our drip campaign open and click through rates have also skyrocketed since we started blocking free email domains.

Michael,

Thanks for sharing this insight!  I know it has been some time from this post but was curious if this change ultimately ended up correlating with a lower cost per customer acquisition?  Obviously, money saved and earned on better allocating your sales team’s time is a win-win.  Think you could be on to something here 🙂

Unbounce - A way to see how many potential form fills bounce away after having their free email rejected vs. change their email to an appropriate work email would be fantastic.  Could this be accomplished?

This is a fantastic script, but it looks as if it only works for .com addresses. Comcast’s corporate emails are .com while their customer email’s are .net… If I add ‘comcast’ it is blocking the business email addresses. How do I block the .net? 

Thanks for this script. We just started using it. I agree, personal email addresses are worthless for B2B marketing.

Mark, it works when you are eyeing enterprise level clients and what you have been getting is queries from curious onlookers with free email ids…

Mark, can you also advise, how should one apply this script… (within a div, in header or below body tag…) if you can help with a example code that will be great.

Nevermind… got it. 🙂

Hi there, not sure if I missed this, but the script doesn’t seem to work with Lightbox forms - please help. Also, where should the script be placed? In the head, before or after body tag. Thanks a mil!

Hi Ryan,

I have specified “Work Email” rather than just “Email” on the landing page, but still receiving free mail id’s.

Hi Mark, the link is no longer working. Could you please let me know. Really need that!

Userlevel 7
Badge +3

Hey @eCreators,

Take a look at this thread about custom validation. There is an example of how to “reject” free email addresses.

Best,
Hristian

Hi @Mark_Wainwright

I will really appreciate it if you can guide me on how can I exclude personal emails as we are a B2B company, I only want to capture company emails.

The above link shows a 404 error. It is really of utmost importance & urgency for me.

Thanking you in advance for the help.

I realize that someone deleted the original script that helped filter out “free email addresses” or “non-business email addresses”. I found it odd that no one ever replaced this code, and I assume it was because some paid services came out. Well I’m doing my vigilante work today.

Paste the below code either in your page, or you can apply to all your pages by adding to the Script Manager - before end body tag. You can add more email domains to filter by just following the formatting and continuing the list.

 

<script> window.ub.form.customValidators.nonValidDomainEmail = { isValid: function(value) { const forbiddenDomains = ['gmail.com', 'yahoo.com', 'domain.com', 'company.com', 'mail.net']; const email = value.toLowerCase(); const domain = email.split('@')[1]; return !forbiddenDomains.includes(domain); }, message: 'Please enter a valid business email.', }; window.ub.form.validationRules.business_email.nonValidDomainEmail = true; </script>

Reply