# How does reCAPTCHA integration prevent spam submissions on public Web-to-Lead forms?

**Topic:** Sales Cloud · **Difficulty:** Medium · **Tags:** Sales Cloud, Web-to-Lead, Spam Protection

Read it on the site: https://www.forcechallenges.com/interview-questions/how-does-recaptcha-integration-prevent-spam-submissions-on-public-web-to-lead-forms

## Answer

**Basics:** Web-to-Lead posts form data straight into Lead records from a public page, so bots can flood your org. reCAPTCHA makes the visitor prove they are human before the post is accepted.

**How it works:**
1. Setup > Web-to-Lead > Create Web-to-Lead Form; select fields, return URL, and the Include reCAPTCHA in HTML option.
2. Register a site with Google to obtain reCAPTCHA keys and add them in the Salesforce settings the generator references.
3. The generated HTML includes the widget and a captcha_settings hidden field containing the key name and org Id; Salesforce validates the response when the form is submitted.
4. Valid submissions create Leads, using the lead assignment rule if you choose one.

**Advanced / deep dive:** Web-to-Lead accepts up to 500 leads per 24 hours; additional submissions are not saved and generate email to the default lead creator, so spam can starve real leads. Defense in depth: a hidden honeypot field that must stay empty (checked by a Flow or trigger that sets status to Spam or deletes), validation rules on email format and domain, duplicate rules, rate-based filtering at your web layer, and a marketing form tool (Account Engagement or Marketing Cloud) instead of raw Web-to-Lead for high traffic. For larger volumes use a server-side form that calls the REST API with its own bot protection and secret handling. Review the Salesforce docs for exactly how and when reCAPTCHA is enforced on your form type.

**Code / config example:**
```html
<form action="https://webto.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST">
  <input type="hidden" name="oid" value="00Dxx0000000000">
  <input type="hidden" name="retURL" value="https://example.com/thanks">
  <input name="last_name"> <input name="email"> <input name="company">
  <!-- honeypot: real users leave blank, bots fill it -->
  <input type="text" name="website_url" style="display:none" tabindex="-1" autocomplete="off">
  <div class="g-recaptcha" data-sitekey="YOUR_SITE_KEY"></div>
  <input type="submit">
</form>
```

**Hidden gotchas & must-remember points:**
- Web-to-Lead is capped at 500 leads per 24 hours.
- Public form fields and org Id are visible to attackers.
- reCAPTCHA keys come from Google, not Salesforce.
- Honeypot logic needs a Flow or trigger on Lead.
- Web-to-Case has a separate limit of 5,000 cases per 24 hours.
- Spam leads still pass through assignment and workflow unless filtered.

**Best practice:** Combine reCAPTCHA with a honeypot and validation, and monitor lead volume against the daily cap.

---
Source: ForceChallenges · last updated 2026-11-02
