# Send Data from a HubSpot Form to Advocate

Once you’ve integrated Advocate with HubSpot, you can automatically track referrals with HubSpot forms. Referrals are tracked by placing a cookie on the website that your referral form is on. Brands using other setups will need to add the UTT to their landing page.

An active HubSpot integration is required to send data from HubSpot Forms to Advocate. Refer to [Integrate with HubSpot for Advocate](https://integrations.impact.com/impact-brand/docs/integrate-with-hubspot-for-advocate) to get started.

{% hint style="success" %}
**Note on Program IDs:** This functionality relies on the single Advocate Program ID configured in your main HubSpot integration. It is not possible to send form data to multiple Advocate programs from a single HubSpot instance.
{% endhint %}

{% stepper %}
{% step %}

### Create a lead capture form in HubSpot

1. In HubSpot, create a lead capture form.
   * Skip this step if you have an existing lead capture form you want to use.
2. Make sure your form contains a field for `impact_referralcookies`. We recommend hiding this field from the interface.
   {% endstep %}

{% step %}

### Copy your UTT

1. From the top navigation bar, select ![](/files/UDyrrRTGbHJFFllCZxyw) **\[User profile] →** [**Settings**](https://app.impact.com/secure/advertiser/account-settings-flow.ihtml).
2. On the right, below *Program → Tracking*, select **General**.
3. Copy your UTT and save it somewhere you can easily access it, like a notepad app.
   {% endstep %}

{% step %}

### Generate your referral attribution script

1. In your impact.com account, from the top navigation bar, select ![](/files/UDyrrRTGbHJFFllCZxyw) **\[User profile] →** [**Settings**](https://app.impact.com/secure/advertiser/account-settings-flow.ihtml).
2. On the left, below *Advocate Settings*, select **Install**.
3. In the *Use referral cookies* section, select whether you’re using a **HubSpot landing page** or a **custom landing page**.
4. Copy the resulting *referral attribution script* and save it somewhere you can easily access it, like a notepad app.
   {% endstep %}

{% step %}

### Set up your landing page

Next, continue based on which type of landing page you're using.

#### HubSpot landing page

{% hint style="success" %}
**Note:** Not all HubSpot landing pages support adding custom code. If yours does not, then you’ll need to use another type of landing page.
{% endhint %}

1. In HubSpot, go to your landing page’s settings.
2. Expand the advanced options.
3. In the *Additional code snippets* box, add the UTT and the referral attribution script.
4. Save your changes.

#### Custom landing page

1. Paste the UTT and the referral attribution script on your landing page.
2. In HubSpot, go to your form settings.
3. Select **Embed** and find the `region`, `portalId`, and `formId` values.
4. Paste them into the referral attribution script on your landing page. There are instructions in the script to show you where to add this information.
   {% endstep %}

{% step %}

### Optionally, test the form

Submit test information to the form to confirm that it’s properly attributing referrals. Make sure that:

* The lead is created as a new Advocate participant, if you’re using this data sharing rule.
* The contact in HubSpot contains Advocate properties like referral code, share link and, message links.
  {% endstep %}
  {% endstepper %}


---

# Agent Instructions: 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:

```
GET https://integrations.impact.com/integration-guides/for-brands/advocate/advocate-plugin-integration/integrate-with-hubspot-for-advocate/send-data-from-a-hubspot-form-to-advocate.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
