Skip to main content
All CollectionsLead Form Protection
Protect your Webflow forms
Protect your Webflow forms

Setup form protection on your webflow forms

Written by Eurico Doirado
Updated over a week ago

Before starting, ensure you've taken a look at the getting started guide. Below we describe how to implement it specifically in Webflow.

After implementing the steps below, you will be able to store the Spider AF data into Webflow's form submission data page:

1. Setup your hidden fields to store the Spider AF data

To setup the hidden fields, we add a "code embed" element to the form and manually add the two hidden inputs to store our values.

  1. add the code embed element:

  2. be sure to position it inside the form block:

  3. Set its content as follows:

    <input type="hidden" name="saf_score" value="" />
    <input type="hidden" name="saf_request" value="" />

    Note: you can access this code by clicking on the icon, for example:

  4. Ensure your name, email and phone fields use standard names.

    If you do not use standard names here, when you setup the code below take an extra caution to ensure they match.

2. Add the Spider AF tracking and protection code code

  1. In the page list, click the settings icon to open up the custom code section.

  2. In the "Inside <head> tag" section, copy and paste the code below:

    <script defer src="" type="text/javascript"></script>

    var sptrk=function(){var o="",t="__spd",e=(new Date).getTime();window[t]||(window[t]={init:!1});var c=window[t];c.d||(c.d=[]);var s=c.d;function v(t){var i=document.createElement("script");i.async=!0,i.src=t,document.head.appendChild(i)}c.init||v(o+"u");var u=/^([a-z0-9]{8})-([a-z0-9]{2})$/;return function(){var t=arguments;if(s.push(t),"config"==t[0]&&!c.init&&!c.a){c.init=!0;var i=t[1],n=i.match(u),a=n[1],r=n[2];if(!a||!r)throw"invalid id: "+i;var d=Math.random().toString(36).substring(2,15);v(o+"t/"+a+"?"+("a="+e+"&o="+d))}}}();
    sptrk('config', '<tracker>-01');
  3. Replace the <tracker> at the end by your own tracker ID (available in the configuration page).

  4. In the "Before </body> tag" section, copy paste the code below:

    function addDataToForm(result, form) {
    $('<input>').attr('type','hidden').attr('name','saf_score').attr('value', result.s).appendTo(form);
    $('<input>').attr('type','hidden').attr('name','saf_request').attr('value', result.r).appendTo(form);

    var hasExecutedFormSubmission = [];

    function processForm(e) {
    const btn = $(this);
    const form = btn.closest('form');

    if (hasExecutedFormSubmission[form]) {
    return true;


    var formValues = {};
    // when using default input names, use the default to capture all the form values automatically:
    form.serializeArray().forEach(function(o) { if (o["value"]) { formValues[o["name"]] = o["value"] } });

    // OR specify each value directly:
    // formValues = {
    // name: form.find('#name').val(),
    // email: form.find('#email').val(),
    // phone: form.find('#phone').val()
    // };

    try {
    sptrk('validate', 'conversion', formValues, function(result) {
    // add result.t to form as hidden field
    addDataToForm(result, form);
    } catch (e) {
    addDataToForm({t: "failed", r: -1, s: 0}, form);

    var Webflow = Webflow || [];
    Webflow.push(function() {
    // bind it on every form
  5. Click the save button.

If you use non-standard field names for the name, email and phone, be sure to replace the commented code section:

var formValues = {
// edit with the ID of your fields:
name: form.find('#name').val(),
email: form.find('#email').val(),
phone: form.find('#phone').val()

After all these steps, publish your form and try a submission. In the data collection you should now see all Spider AF data:

Did this answer your question?