Re: How to block bots?

How to block bots?

RolandP
Explorer
49 1 11

Trying again:

I have received many signups to my newsletter from the email domain "rtremail.com" which I suspect of being a bot and not a real email address. I've searched online for more information about rtremail and all I keep getting are links about Right to Represent documents from recruiters. Can someone please confirm that I can delete these @rtremail.com subscribers because they are not real? 

Replies 3 (3)

Entesta
Shopify Partner
80 8 20

Hi Roland,

You can try out this code block. This code will add a frontend check, if the email entered contains the rtremail.com then it will not submit the form.

<script>
document.addEventListener('DOMContentLoaded', () => {
const form = document.querySelector('#ContactFooter');
console.log('form found')
if (form) {
form.addEventListener('submit', (e) => {
e.preventDefault();
const emailInput = form.querySelector('input[type="email"]');
if (emailInput) {
const emailAddress = emailInput.value;
console.log('email ---> ', emailAddress);
if (emailAddress.includes('@rtremail.com')) {
return
}
} else {
console.error('Email input not found in the form');
}
});
} else {
console.error('Newsletter form not found');
}
});
</script>

The #ContactFooter is the ID of the newsletter form of my theme. Your theme can have a different ID for the newsletter form.

Feel free to revert if you need further assistance and do let me know if it helps.

Thanks.
We value your feedback! Let us know if this helped by giving it a thumbs up or marking it as a solution or buy us a coffee.
Looking for Shopify experts to help you with your website? We are just one click away. Drop an email or say hi on WhatsApp to initiate a request support@entesta.com | +91 79083 21294
Entesta - Powering Your E-Commerce Journey with Shopify Expertise
RolandP
Explorer
49 1 11

Thank you very much for this -- it may be helpful.

 

apps-developer
Shopify Partner
50 0 3

yep, with Kedra Shield: Website Security app which has this bot block feature