> For the complete documentation index, see [llms.txt](https://docs-vnext.kiflo.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-vnext.kiflo.com/manage-partners/referral-links/get-leads-from-referral-links.md).

# How to get leads from referral links?

Referral links (or affiliate links) in Kiflo can be used to track visitors and leads from your website. Leads are automatically associated with the partner who referred them. It works just like an affiliate platform.

You have many ways to build and connect a lead form to your Kiflo account. This article covers the different possibilities and will help you choose the best option depending on your tech stack.

## For HubSpot Forms

Kiflo offers native integration with HubSpot Forms. You can connect your lead forms to Kiflo in just a few clicks.

Documentation: [How to connect a HubSpot form to get leads from your website?](/integrations/hubspot/connect-hubspot-form-leads.md)

## For custom websites

This section covers how to connect a lead form to Kiflo when you have a custom-made website (HTML/Javascript).

### 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: [https://docs.kiflo.com/article/34-get-started-with-kiflo-js](/developers/js-sdk/get-started.md)

### Step 2: Build your custom lead form

{% hint style="info" %}
**Be sure to have completed the previous step before connecting the lead form.**
{% endhint %}

Depending on your tech stack you have many ways to build forms. We won't cover all the details for all JS frameworks but instead, give you guidelines you can adapt to your use cases.

Here is an example of a lead form using pure HTML:

```html
<form method="post" onsubmit="sendLeadToKiflo(); return false;">
    <input type="text" placeholder="Firstname" id="firstname">
    <input type="text" placeholder="Lastname" id="lastname">
    <input type="email" placeholder="Email" id="email">
    <input type="text" placeholder="Company Name" id="companyName">
    ...
    <button type="submit">Submit</button>
</form>
```

You can of course customize it to ask for additional information. If you do so, you will need to customize lead properties in Kiflo to match the fields in the lead form.

And here is an example of how you can connect this form with Kiflo:

```js
function sendLeadToKiflo() {
    var firstname = document.getElementById('firstname').value;
    var lastname = document.getElementById('lastname').value;
    var email = document.getElementById('email').value;
    var companyName = document.getElementById('companyName').value;
    
    kiflo('lead', {
        status: 'Pending',
        properties: {
            firstName: firstname,
            lastName: lastname,
            email: email,
            companyName: companyName
        }
    },
    () => {
      /* Handle success */
   },
   (err) => {
      /* Handle error */
   });
}
```

You can find more details on how to use the `kiflo('lead', ...)` function on this page: [https://docs.kiflo.com/article/31-js-create-lead](/developers/js-sdk/create-lead.md)

## For WordPress websites

We have a dedicated Kiflo plugin for WordPress to offer you a seamless way to track leads, checkout: [https://docs.kiflo.com/article/39-wordpress](/integrations/website-forms/wordpress.md)

## For external forms (Typeform, etc)

*For any other integrations, please contact the support:* [*help@kiflo.com*](mailto:help@kiflo.com)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs-vnext.kiflo.com/manage-partners/referral-links/get-leads-from-referral-links.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
