Software and Product Development

From spam to security: keeping online forms reliable

When you launch a website, your first goal is to connect with your audience: to learn who they are, what they’re interested in, and which of your services they want to use. Most often, that means signing up for your newsletter.

The usual tool for this is a form. Alongside the fields for the data you actually want (name, job title, organisation, email and so on), there are two elements that have nothing to do with your main goal but that you simply can’t leave out.

The first is a privacy policy consent checkbox (or an equivalent field), which is essential whenever your form collects personal, let alone sensitive, data.

The second is a captcha, a security check that stops bots from flooding your form with spam. You’ve almost certainly met one: the “I’m not a robot” checkbox, the grid where you pick out every traffic light or bicycle, or the image where you have to click on every square containing part of the subject (often a fiddly, frustrating exercise).

What happens when you forget the captcha

Leaving out the privacy checkbox may not cause problems straight away, though it’s never something to ignore. Forgetting the captcha, on the other hand, makes itself felt almost immediately, especially if the form sits on your home page or another busy page. Spam submissions start pouring in, and if each one triggers an email notification to the site administrator, their inbox is buried within hours.

Spam is usually easy to spot by eye. The text fields tend to be stuffed with links or ads for questionable products, and the email addresses often share the same odd domain across hundreds of entries. Bulk-deleting everything from your site’s backend is tempting, but risky: genuine requests from real users may be hidden among the junk.

The fix is a captcha that screens out suspicious visitors. And as in the endless arms race between viruses and antivirus software, bots keep getting smarter, so captchas have to keep evolving too.

reCAPTCHA v2 vs. v3

Google reCAPTCHA comes in two versions, both of which can be added to a website through plugins.

reCAPTCHA v3 is the newer, less intrusive option. Users don’t have to do anything; the only visible sign is a small badge in the bottom-right corner of the page.

reCAPTCHA v2 is the classic version described above, with the “I’m not a robot” checkbox and image challenges.

reCAPTCHA v3 works by automatically assigning every visitor, human or bot, a score between 0 and 1, based on past and present activity from their IP address. In your form settings, you choose the minimum score required to submit. It needs careful tuning, but 0.5 is a typical starting point. Anyone above the threshold submits the form without friction.

What about visitors who score too low?

The simplest and seemingly safest option is to block them with an error message. But that’s not always the smartest choice. In many cases, it’s better to show low-scoring visitors a classic reCAPTCHA v2 challenge as a fallback.

Why give a suspected bot a second chance, and one that looks easier than the first? There are two good reasons.

First, reCAPTCHA v3 is probabilistic. Along with bots, it can also catch real people who happen to get a low score for one reason or another. A v2 fallback gives them a way through.

Second, reCAPTCHA v2 is less simple than it looks, and it isn’t the same for everyone. Visitors flagged as suspicious get a noticeably tougher challenge.

Getting the configuration right

All of this holds true in principle, but the best setup depends on your real traffic. At COMMpla, we analyse user scores to fine-tune every technical parameter of your forms, starting with the captcha. Get in touch with our team.

Massimo Berutto | Senior Software Developer