Keap or Infusionsoft is a very famous and widely used CRM. It provides different ways to capture leads (contacts) through it’s API and web-based forms. These lead capture forms can be embedded on a website using Keap’s javascript snippet as well as plain HTML code.
This post is related to those HTML based forms only.
While these forms are very handy, there is a drawback. These forms are prone to capture a lot of spam leads whether the Infusionsoft Google recaptcha field is enabled or disabled. For that reason we are going to use a very simple trick to stop spam leads in Keap (Infusionsoft).
Recently one of my client had their leads increased by 300% in a single month and all of those were spam contacts.
The Google recaptcha was already enabled on the forms along with our custom javascript validation, but the spam leads continued to optin.
This is how we came up with a solution on how to stop spam leads in Keap (Infusionsoft):
Step 1: Modify the <form> tag
Grab the HTML code of the optin form from Keap (Infusionsoft) and open in a html code editor.
- Modify the <form> tag and give it a name attribute. For this example, I am going to give it the name attribute of name=”myINFFrm”. The only purpose of this attribute is that we can later target the form for javascript validation. We can also use a CSS ID or class but here I am using the name to keep this simple.
- Remove the value of action=”” attribute which usually is a link or url to Infusionsoft form processor (Infusionsoft submit url).
Save this url somewhere because later in the process we’ll add it using javascript. This will prevent exposing the submit url to bots where javascript is mostly disabled. Without javascript the value of action=”” will remain empty, hence there will be no form submissions.
Step 2: Add a new field to the form
Next, we need to add a new field to the form and hide it. I am going to name this field “inf_re_email”.
<input name="inf_re_email" id="inf_re_email" type="text" value="">
The purpose of hiding this field is that it should remain invisible to humans but visible to bots.
Bots will be prone to fill this field and we can stop the form submission if this field is filled using our custom javascript (Step 4).
Step 3: Modify the submit button code
We need to modify the submit button code to remove references to Google recaptcha class and ID. It would be best to comment out the old submit button code and add new one so in case we need to rollback our changes, we can do that easily.
Step 4: Add some Javascript validation
Add the following javascript to the form.
<script type="text/javascript">
document.getElementById("inf_re_email").setAttribute("style", "display:none;");
var inf_Form = document.forms["myINFFrm"];
inf_Form.setAttribute("action", "https://xxxxx.infusionsoft.com/app/form/process/12345657890");
inf_Form.addEventListener("submit", validateForm);
function validateForm(e) {
var isValid = true;
var re_email = e.target["inf_re_email"];
if ( re_email.value != "" ) {
isValid = false;
e.preventDefault();
}
}
</script>
This does the followings:
- Hide the new field we created in Step 2.
- Add the submit URL to the action=”” attribute that we removed in Step 1.
- Validates the form so if our new field is filled or has some value, the form should not submit and if its empty, the form should submit.
That’s All: Save and use this new form code.
I hope this method will prevent spam bots from submitting the form and ensure only genuine human leads are sent to Keap (Infusionsoft).
For any questions or feedback, post your comments below.
Leave a Reply