How to get leads from HubSpot Forms?

HubSpot Forms are an easy way to build forms and get leads from your landing pages. You can use your existing HubSpot Forms with Kiflo to track leads coming from partners.

Here is how it works:

  • Install the Kiflo JS snippet on your website: to track visitors coming from referral links shared by partners. This will manage the tracking cookie automatically.
  • Configure your HubSpot Form to get and save the Tracking code: this code is stored in the tracking cookie and must be sent along with the rest of the form
  • Customize the JS code used to embed the form: in order to read the Tracking code from the existing cookie put by the Kiflo JS snippet and sent it to HubSpot
  • Use the Tracking code to create a new lead in Kiflo

In this article

Step 1: Install Kiflo tracking code

First things first, you need to install the Kiflo javascript snippet on your website. It is similar to Google Analytics snippet and will handle:

  • Tracking cookies for visitors and leads
  • Communication between your website and your Kiflo account

To install the Kiflo javascript snippet, please refer to this page:

Step 2: Configure your HubSpot Form

Create or edit an existing form in HubSpot, the way you are used to it, then:

  • Add a new field called: "Kiflo Tracking Code
  • Make this field hidden
If you choose a different name than "Kiflo Tracking Code", please save the "Contact property name" (in red in the screenshot below) for later.

At this point, you can save the Kiflo Tracking Code in HubSpot along with the other fields.

Step 3: Customize the embed code

Copy the embed code from the HubSpot Form editor and add a new callback: "onFormSubmit" that will be executed just before the form is submitted to HubSpot.

This callback is in charge of reading the Tracking code from the tracking cookie (if there is one), and populate the hidden field created at step 2 with this value.

The code should look like

<!--[if lte IE 8]>
<script charset="utf-8" type="text/javascript" src="//"></script>
<script charset="utf-8" type="text/javascript" src="//"></script>
		region: "na1",
		portalId: "1234567",
		formId: "72fadbf8-abaf-483e-ba65-c83755483421",
		onFormSubmit: function($form) {
			$form[0]["kiflo_tracking_code"].value = kiflo('getTrackingCode');

Be careful!

If you chose another name at step 2, please replace "kiflo_tracking_code" with the contact property name provided by HubSpot.

Find more information in the official HubSpot documentation:

Step 4: Send leads to Kiflo

Now you are ready to send leads to Kiflo! You have different options:

  • Using Zapier
  • Using API call

Using Zapier

Create a new Zap, that can be triggered from different triggers from HubSpot, and add the Create Lead action from Kiflo PRM:

Map all fields coming from HubSpot, then at the very bottom of the setup action step, insert the Tracking code:

You don't have to map the Partner field because Kiflo will use the Tracking code to associate the new lead with the source partner.

Using API call

If you prefer to call the Rest API the create leads, please refer to this method:

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.