The aggressive Tilda CAPTCHA was already enabled on our client's website, yet spam kept arriving. Submissions came in batches through the same form from Yandex contextual advertising. At first they looked like ordinary enquiries: the names and phone numbers seemed plausible. Repeated email domains such as test.ru, demo.io and sample.net raised suspicion, and the messages ended with “(!)”.
CAPTCHA was not stopping these submissions. The advertising click had already been charged before the visitor reached the form, while a successful submission appeared in the campaign's statistics. I needed to add protection at the form itself while keeping it convenient for someone with a real enquiry.
Why I kept the submission process simple
I decided against putting a second CAPTCHA on top of the first. Visitors already have to pass a check, and another obstacle does not necessarily mean fewer spam enquiries. I looked for a way to check how the form was filled in without asking every visitor to prove they were human again.
SMS verification spoils the user flow: a real customer has to take an extra step. They have already filled in the form and are ready to send an enquiry, only to be asked to wait for a message, find the code and return to the site. I decided not to add that process for this task.
A country restriction has its own problem: Tilda determines location from the IP address, so a visitor using a VPN can appear to be in another country. It could shut out a real customer. I also set aside an email domain blacklist and a check for “(!)”: a bot can easily change its address or message, leaving another list to update.
How the additional protection works
I added a regular single-line field to the forms, with the variable name url_site. I left its label, placeholder and default value empty and made it optional. The script then moved it off screen and excluded it from Tab navigation and autofill. Visitors cannot see the field and do not fill it in.
For a bot that fills in every field, it looks like another question. If any text appears in it, the script stops submission before Tilda's handler runs. It needs to be a regular field: Tilda's built-in “Hidden field” is intended for advertising tags and does not act as this kind of question for a bot.
The second check concerns timing. If a form is submitted less than two seconds after the page opens, the script stops it. This helps filter out immediate submissions where a visitor would hardly have had time to read and fill in the form.
I put both checks into a single script in the shared footer. It adds the field's styles itself, so there is no separate CSS to install. Forms without url_site are left alone. When Tilda opens a form after the page has loaded, the script prepares its field too. I added the field to all enquiry forms, including the shopping cart.
What I checked on the website
After installation, I submitted an enquiry on our client's website as an ordinary visitor would. The CAPTCHA appeared and the submission went through. The additional field stayed off screen and did not interfere with the enquiry.
I also checked the trap itself: a filled field stops submission. If it is empty and more than two seconds have passed since the page opened, this protection lets the enquiry through. That confirmed the intended condition was being checked and the ordinary form still worked.
The limits I kept in mind
This protection has clear limits. It is intended for bots that fill in every field or submit the form immediately after the page opens. A bot that skips the invisible field and waits more than two seconds will not be stopped by these checks. Nor can the script see a request sent directly to Tilda's receiving endpoint, bypassing the page. That is why I kept CAPTCHA enabled.
Advertising that has already collected spam enquiries also needs attention. Form protection does not recover money already spent or change the campaign's accumulated statistics. The quality of subsequent enquiries is what will show how the changes help and what is happening with the advertising; one successful test cannot establish that.
The form protection script
Each form needs a regular, optional url_site field with an empty label, placeholder and default value. The full script is below. Its comment describes installation in HEAD; on our client's website, I placed it in the shared footer and tested it there.
<script>
/*
Name: Tilda form protection against bots
Where to insert: site settings → More → HEAD code; paste the whole script.
No separate CSS is needed: the script adds the hidden field's styles itself.
Before publishing:
add a regular optional single-line field to every enquiry form,
with the variable name url_site. Leave its label, placeholder and default
value empty. Do not use Tilda's built-in hidden field:
a bot does not fill it in like a normal question.
What it does:
1. Moves url_site off screen so visitors cannot see or fill it in.
2. Stops a submission if the field has content, as happens with bots
that fill in every field.
3. Stops a submission if the button is pressed less than 2 seconds
after the page opens.
Forms without url_site are left alone.
*/
(function () {
var SCRIPT_NAME = 'Tilda form protection against bots';
var FIELD = 'url_site';
var MIN_MS = 2000;
var started = Date.now();
/* Honeypot styles: the field stays in the form code, but is off screen. */
var css = ''
+ '.t-input-group[data-field-name="' + FIELD + '"]{'
+ 'position:absolute !important;'
+ 'left:-9999px !important;'
+ 'top:auto !important;'
+ 'width:1px !important;'
+ 'height:1px !important;'
+ 'overflow:hidden !important;'
+ 'opacity:0 !important;'
+ 'pointer-events:none !important;'
+ 'margin:0 !important;'
+ 'padding:0 !important;'
+ '}';
var style = document.createElement('style');
style.setAttribute('data-script', SCRIPT_NAME);
style.appendChild(document.createTextNode(css));
document.head.appendChild(style);
/* Keep keyboard navigation and browser autofill out of the field. */
function prepare(root) {
var inputs = (root || document).querySelectorAll('input[name="' + FIELD + '"]');
for (var i = 0; i < inputs.length; i++) {
inputs[i].setAttribute('tabindex', '-1');
inputs[i].setAttribute('autocomplete', 'off');
inputs[i].setAttribute('aria-hidden', 'true');
}
}
/*
Only stop forms that contain the trap.
Stop when the field is filled or the submission is too fast.
*/
function blocked(form) {
if (!form || !form.querySelector) return false;
var input = form.querySelector('input[name="' + FIELD + '"]');
if (!input) return false;
if (input.value && input.value.trim() !== '') return true;
if (Date.now() - started < MIN_MS) return true;
return false;
}
/* Stop submission before the Tilda handler so the enquiry is not emailed. */
function stop(e) {
e.preventDefault();
e.stopPropagation();
if (e.stopImmediatePropagation) e.stopImmediatePropagation();
}
document.addEventListener('submit', function (e) {
if (blocked(e.target)) stop(e);
}, true);
document.addEventListener('click', function (e) {
var node = e.target;
if (!node || !node.closest) return;
var btn = node.closest('.t-submit, button[type="submit"]');
if (!btn) return;
if (blocked(btn.closest('form'))) stop(e);
}, true);
/* Prepare fields in regular forms and forms that Tilda opens later. */
function boot() {
prepare(document);
if (!window.MutationObserver) return;
new MutationObserver(function (records) {
for (var i = 0; i < records.length; i++) {
var nodes = records[i].addedNodes;
for (var j = 0; j < nodes.length; j++) {
if (nodes[j] && nodes[j].querySelectorAll) prepare(nodes[j]);
}
}
}).observe(document.documentElement, { childList: true, subtree: true });
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', boot);
} else {
boot();
}
})();
</script>
After the changes, visitors follow the familiar process: fill in the form, pass CAPTCHA and send an enquiry. They do not have to find an SMS code or deal with another question. The form checks for automated filling in the background.
I wanted visitors to be able to send an enquiry easily while the protection worked without their involvement. During testing, an ordinary enquiry went through and a filled trap stopped submission. The next thing to watch is the quality of actual advertising enquiries: they will show whether these changes are enough. I would not promise that spam will disappear forever.
Tilda form improvements for your website
If your website's forms need attention, I can check how they work, set up the required checks and improve your Tilda website with your customers' experience in mind.
