Protect your Salesforce form from bots
In short: To stop spam on a Salesforce Web-to-Lead form, generate the form's HTML in Setup, run it through the SpamKill Setup Wizard, and paste the protected code on your page. SpamKill checks every submission without a CAPTCHA, and real leads still land in Salesforce with Lead Source "Web". It takes about 10 minutes, with no code to edit by hand.
Bots are filling your Salesforce Web-to-Lead form with fake leads. Protect the form's HTML with SpamKill and real leads keep landing in Salesforce while the spam stops at the door, with no CAPTCHA for your visitors to solve.
- About 10 min
- 6 steps
- Copy and paste one snippet
Last verified on Salesforce Web-to-Lead (Developer Edition) with the SpamKill Setup Wizard
What changes, and what doesn't
- Leads still arrive in Salesforce, with Lead Source "Web"
- Your Return URL: visitors land on your thank-you page
- Your page: only the form code changes
- Every submission is checked before it reaches Salesforce
- No reCAPTCHA box for visitors to tick
- Undo it anytime by putting your old form code back
Before you start
Have these ready so nothing stops you halfway.
- A SpamKill accountNo account yet? Start a free trial.
- A Salesforce user that can open SetupYou need access to Setup › Web-to-Lead.
- Access to the page your form goes onFor example your WordPress, Webflow or Squarespace editor, or your landing page builder.
Quick setup
For returning users. Each line links to its full step.
- In Salesforce Setup, type Web-to-Lead in Quick Find, open it and click Create Web-to-Lead Form. Step 1
- Pick your fields, enter your thank-you page as the Return URL, untick Include reCAPTCHA in HTML, click Generate and copy all the code. Step 2
- In the SpamKill Console, open Setup Wizard, click No to the WordPress question and paste the code. Step 3
- Click Generate Protected Code, check the email field is email, then click Yes, protect my form. Step 4
- Paste the protected code where the Salesforce form code was, publish the page, then click Next. Step 5
- Submit [email protected] and expect an error, then submit a fresh address and check the lead. Step 6
Open Web-to-Lead
Where: SalesforceSetupWeb-to-Lead
In Salesforce, open Setup. Type Web-to-Lead in the Quick Find box and click Web-to-Lead (1). Under Web-to-Lead Settings, click Create Web-to-Lead Form (2).
You should see: Create a Web-to-Lead Form, with Available Fields and Selected Fields lists.
Is Web-to-Lead Enabled unticked?
Ask your Salesforce admin to turn it on under Web-to-Lead Settings.
Generate the form code
Where: SalesforceSetupWeb-to-LeadCreate a Web-to-Lead Form
Move the fields you want into Selected Fields. Enter the page visitors should see after they submit as the Return URL (1). Untick Include reCAPTCHA in HTML (2): SpamKill checks submissions without a CAPTCHA. Click Generate. Copy all of the HTML in the box (3), then click Finished.
You should see: The form code on your clipboard. It includes <form action="https://webto.salesforce.com/.
Already have a Web-to-Lead form on your site?
You can use its code. If you no longer have it, generate the form again with the same fields and Return URL.
Paste it into the Setup Wizard
Where: SpamKill ConsoleSetup Wizard
In the SpamKill Console, click Setup Wizard in the sidebar. If your site isn't on WordPress, click No under Is your website developed in WordPress?. Paste the Salesforce code into the box (1).
You should see: Tips under the box, then Please select the email field input showing email.
Generate the protected code
Where: SpamKill ConsoleSetup Wizard
Click Generate Protected Code. SpamKill asks you to check the email field: it should be email (1). Click Yes, protect my form (2).
You should see: Replace the existing code with this code on your website, above your protected code.
Swap the code on your page
Where: Your website editor
Copy the protected code from the box. Open the page with your Salesforce form in your website editor. Delete the Web-to-Lead form code and paste the SpamKill code in its place. Save and publish the page. Then click Next in the wizard.
You should see: Your page shows the same form as before.
Does your site style the form by field name?
SpamKill renames each field, and the wizard lists the old and new names. Update any CSS or scripts that point at the old names.
Test it twice
Open your page in a private window. Submit the form with [email protected] (1). Then submit it again with a name and an email address you haven't used in a test before. Salesforce sends you to your Return URL page (2).
The first try shows That email address doesn't look right.
The second try appears in Leads, with Lead Source Web.
Back in the wizard, click Both Tests Passed.
You should see: Your Return URL page after the second try.
Your Salesforce form is protected
- Bots are stopped before they reach Salesforce.
- Real leads arrive exactly as before, with no extra steps for them.
- Every block is logged in your SpamKill dashboard.
Something not working?
Find what you're seeing.
Real leads aren't showing up in Salesforce
Check the live page has the protected code: its form sends to protect.spamkill.dev. If you changed the form in Salesforce, generate its code again and repeat steps 3 to 5. Testing again? Use an email address you haven't tested with before.
A real visitor was told their email doesn't look right
SpamKill checks for missing @ symbols, extra spaces and common typos. The visitor can click Go back to the form, fix the address and send again.
Does Salesforce require reCAPTCHA in your org?
We tested with Require reCAPTCHA Verification turned off under Web-to-Lead Settings, and the form generated without reCAPTCHA. If your org requires it, ask your Salesforce admin before you switch.
Changed your mind? Undo in under a minute
- Open the page in your website editor.
- Delete the SpamKill code and paste your original Web-to-Lead form code back.
- Save and publish the page. Your form is back to how it was.
Thanks! Glad your form is protected.
Sorry about that. Tell us which step tripped you up and we'll fix the guide.
Stuck? We'll set it up with you.
Free setup help for every plan. Send us a message and we'll walk through your Salesforce form with you.
Get setup help