Hub Hack: Block Free or Personal Email Addresses on Form CTAs

Follow

Use this Custom Code snippet to prevent Hub visitors from entering non-work emails when submitting Form CTAs.


 

Details

  • Type: JavaScript
  • Placement: Body Bottom
  • Notes: Choose between two options: block emails from both a predefined list of free domains plus a list of domains you specify; or block emails from just a list of domains you specify. In either case, clicking on Submit on a Form CTA after entering an email from a blocked domain will return the error message "Please enter a valid work email".

 

Code

Option 1: Block Free Domains & Specified Domains

This will block emails from a predefined list of domains (see the full list here) as well as domains you have specified (such as competitor domains).

To specify domains, replace DOMAIN1.COM, DOMAIN2.NET, etc. in the code below. You can list as many domains as you want. Add more domains by separating with a comma, and enclose all domains within double quotation marks, e.g. "anotherdomain.com","yetanotherdomain.org". If you don't want to specify custom domains and use only the predefined list, leave this section unchanged.

<script>
/* Prevent CTA Submit for both free domains and specified domains */
$.getScript('//cihost.uberflip.com/plugins/block-emails/script.js')
.done(function( ) {
/* Additional domains to block */
window.domains.push("DOMAIN1.COM","DOMAIN2.NET");
});
</script>

 

Option 2: Block Specified Domains Only

This will block emails only from domains you have specified (such as competitor domains). Emails from domains not explicitly specified in the script will be allowed.

To specify domains, replace DOMAIN1.COM, DOMAIN2.NET, etc. in the code below. You can list as many domains as you want. Add more domains by separating with a comma, and enclose all domains within double quotation marks, e.g. "anotherdomain.com","yetanotherdomain.org".

<script>
/* Prevent CTA Submit for specified domains only */
$.getScript('//cihost.uberflip.com/plugins/block-emails/script.js')
.done(function( ) {
/* Domains to block */
window.domains=["DOMAIN1.COM","DOMAIN2.NET"];
});
</script>

 

 

0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.