Product

Create, publish and optimize pages with a drag&drop, pixel perfect and mobile-friendly builder

Speed up the creation process with 400+ customizable templates for landing pages, pop-ups and sections

Track microconversions in your Dashboard and analyze events and clicks with visual map

Integrate your pages with your favorite mar-tech apps and solutions to get the flow of your campaign going

Drive sales and conversions with irresistible product displays and seamless shopping experiences

Use a reliable and secure platform that smoothly handles millions of visits

Resources

Master digital marketing with the help from savvy professionals and increase your website’s conversions

Guides for beginners, set-up instructions and creation tips to get started and optimize your pages

A free online course for landing page creators! Learn the secrets of high-converting pages and become an expert

Get the answers you’re looking for – contact us

Schedule a one-on-one meeting with us and learn more about the benefits of our platform

Hire a Design Expert or order an import of your existing page from other platforms to Landingi

Home Help Center Blocking custom email domains

Blocking custom email domains

TABLE OF CONTENT

You can turn on email validation on your landing page to block nonprofessional email addresses. By blocking custom email domains in the form, you can avoid spam leads.

See also other methods of spam protection:

Add email domain validation

1. To add email validation to your form, you need form button and email field IDs. To find them, go to your published landing page, right-click next to the form and select Inspect.

2. An HTML code window will open. Click on the select tool (1) and hover over the email field (2). The part of the code relevant to the field will be highlighted. Copy the email field ID (3).

3. Then hover over the button and copy its ID.

4. Go to the landing page Dashboard and navigate to the JavaScript code tab. Click Add script.

You can access the JavaScript code tab also directly from the editor:

5. Copy the code indicated below. 

Change DOMAIN1 and DOMAIN2 to the domains you want to block, e.g. @domain.com, @gmail.com (you can specify only one domain or as many domains as you need).

Change FORM_BUTTON_ID and EMAIL_FIELD_ID to relevant IDs copied from your landing page.

<script>
$('.keywordError').hide();
let triggerWords = ['@DOMAIN1', '@DOMAIN2'];
let buttonColor = '#FORM_BUTTON_ID';
function containsBannedWords(input) {
let result = false
triggerWords.forEach(function(triggerWord) {
if (input.toLowerCase().includes(triggerWord)) {
result = true
}
});
return result
};
$('#EMAIL_FIELD_ID').keyup(function(event) {
if (containsBannedWords(event.target.value)) {
$(event.target).prop('value', "");
$('.keywordError').fadeIn(500);
$(buttonColor).css('background-color', 'red');
} else {
$('.keywordError').fadeOut(500);
$(buttonColor).css('background-color', '#0e9ae5');
}
});
</script>

6. Name (1) the script and paste the code in the Content (2) field. Choose the Body bottom (3) position on the Main page (4). Save by clicking Add.

7. Go back to the landing page editor.

8. Add a Text widget and place it beneath the email field. Type an error message that will show when someone enters the email address you want to block.

9. Then go to the Other tab in the right-side toolbar. Type keywordError in the Classes field.

10. Publish your landing page.

Fill out your form and check if the validation works correctly.