Skip to main content

Integrating Fake Lead Protection with HubSpot: Own Page with Form Editor

This guide will walk you through the process of setting up HubSpot to work with a fake lead protection script when using your own Page with the Editor Form type. This setup allows you to identify and manage potentially fake or fraudulent leads.

Itzayana Rodríguez avatar
Written by Itzayana Rodríguez
Updated over a week ago

Step 1: Create a Custom Contact Property

First, you'll need a place to store the fraud score passed by the fake lead protection script. This is done by creating a custom property.

  1. Navigate to Settings: From your HubSpot dashboard, click the Settings icon ⚙️ in the top-right corner.

  2. Find Properties: In the left sidebar, scroll down to Data Management and select Properties.

  3. Create the Property: Click the Create property button.

    • Property Label: Give the property a clear, descriptive name like Spider AF Score.

    • Object Type: Select Contact. This ensures the property is associated with individual contact records.

  4. Select Field Type (left side bar): Search for and choose the Number field type. Using the Number field type is essential because the fraud score will be a numerical value.

  5. Finish: Click Create to save your new custom property.


Step 2: Create a Editor Form

Next, you will create a form that includes this hidden property. Using the Legacy Form Editor is necessary for the specific feature of setting a hidden field with a default value, which is crucial for this integration.

  1. Navigate to Forms: Use the search bar on your HubSpot dashboard to find and navigate to Forms (under Marketing or Content & Commerce depending on your settings).

  2. Create a Form: Click the Create form button.

  3. Choose the Form Editor and click Next.

  4. Select a Template: Choose the Start from blank template.

  5. Name the Form: Rename the form to something easily identifiable, for example, Spider AF Form.

  6. Add the Custom Property: In the left sidebar, use the search function to find your newly created property (Spider AF Score). Click it to include it.

  7. Edit the Property Settings:

    • Click on the Spider AF Score field on the form to open its edit panel.

    • Set the Default value to 2. This is a critical step. By setting the default to a "safe" or "passing" score (in this example, '2'), any form submission that is not processed by the fake lead protection script will still be created with a non-fraudulent score. This prevents accidental deletion or filtering of legitimate leads if the script fails to run for any reason.

    • Check the box to Make this field hidden. This ensures the field is present on the form and can receive the fraud score from the protection script, but remains invisible to the person filling out the form.

    • Click Review and Update.

  8. Publish: Review your form settings and click Update.


Step 3: Create an Automation Workflow

The workflow will automate an action (like deleting or disqualifying a contact) based on the score received in the hidden property. In this example, we'll create a workflow to delete contacts with a fraudulent score (score of 1).

Workflow 1: Deleting Fraudulent Contacts

  1. Navigate to Workflows: Use the search bar to find and navigate to Workflows (usually under Automation or Apps).

  2. Create a New Workflow: Click the Create workflow button and start from scratch.

  3. Workflow Setup:

    • Name your workflow (e.g., Spider AF Deletion Workflow).

    • Click on trigger manually and select the object type: Contact.

    • Click Save and continue.

  4. Set Enrollment Trigger: Click on the trigger and select When filter criteria is met.

    • Add a new filter: Choose Contact Properties and select your custom property, Spider AF Score.

    • Set the condition: Choose is equal to 1. A score of 1 in this example indicates a high-risk or fraudulent lead, which is why we set the action to delete.

    • Click Save.

  5. Add an Action: Click the plus icon (+) below the trigger to add an action.

    • Choose the action Delete contact.

    • Click Save.

  6. Review and Publish: Review your enrollment settings and turn the workflow On.

Workflow 2: Setting Status to Non-Marketing Contact

Instead of deleting a contact, you may choose to keep the record but prevent it from being counted as a marketing contact.

  1. Go back to workflows and repeat Steps 2-4 from Workflow 1: name it (e.g., Spider AF Non-Marketing Status Workflow)

  2. Add an Action: Click the plus icon (+) to add an action.

    • Choose Set Marketing Contact Status.

    • Select Set as non-marketing contact for the value.

    • Click Save.

  3. Review and Publish: Review your settings and turn the workflow On.


Step4: Script Placement on the Website (via GTM)

The last step is to ensure the external lead verification script runs on your website and is able to write the score back to the hidden form field. Using Google Tag Manager (GTM) is recommended for easy management.

1. Creating the Custom HTML Tag

  • Go to Google Tag Manager: Navigate to your GTM workspace.

  • Create a New Tag: Click New Tag.

  • Configure Tag:

    • Name the Tag (e.g., Legacy Form Own Website).

    • Choose Custom HTML as the Tag Type.

    • Paste the provided Spider AF script into the HTML field.

    • ⚠️ Crucially, ensure you change the unique tracker ID (tracker-01) within the script to your specific ID.

<script>
var sptrk=function(){var o="https://saf-lv-protect.com/",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');

function setSptrkScore(form, score) {
if (form && typeof form.setFieldValue === "function") {
form.setFieldValue('0-1/spider_af_score', String(score));
}
}

sptrk('event', 'form-initialization', null, function(data) {
if (data && typeof data.s === "number") {
var score = data.s;
window.addEventListener('hs-form-event:on-ready', function(event) {
var form = (typeof HubSpotFormsV4 !== "undefined" && HubSpotFormsV4.getFormFromEvent)
? HubSpotFormsV4.getFormFromEvent(event)
: null;

setSptrkScore(form, score);
});
if (HubSpotFormsV4) {
HubSpotFormsV4.getForms().forEach(function(form) {
setSptrkScore(form, score);
});
}
}
});
</script>

2. Setting the Trigger

The trigger ensures the anti-fraud script only executes when your form is visible.

  • Configure Trigger: Click in the "Triggering" section.

  • Create New Trigger: Click the plus icon (+) in the top-right.

  • Trigger Type: Choose Page View.

  • Set Condition: Select "Some Page Views."

  • Define Filter: Set the condition to "Page URL contains [The unique URL or identifier of the page where the form is embedded]."

    • Why this condition? You only want the fraud script to run on the specific page(s) where the vulnerable form is located. This prevents the script from unnecessarily executing on every page of your website, optimizing loading speed.

  • Name and Save the trigger.

  • Save the Tag.

  • Click Submit in the main GTM workspace to publish all your changes.

Setup is complete! Your external website form is now protected by an anti-fraud script that feeds data to HubSpot, allowing your workflow to automatically clean out fake leads.

Did this answer your question?