> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cometly.com/llms.txt
> Use this file to discover all available pages before exploring further.

# HubSpot marketing forms (legacy forms)

> Track HubSpot legacy forms in Cometly: convert the form's embed code so the pixel captures each lead's email, name and phone number.

To track HubSpot legacy forms in Cometly, you convert the form's embed code so the Cometly pixel (the tracking script you install on your site) can read the form's fields. Once a legacy HubSpot marketing form is set up, the pixel captures the prospect's email, first name, last name and phone number from the form.

Those details let Cometly connect the submission to the source it came from. That means a lead who fills out your HubSpot form can be tied back to the ad or channel that brought them to the page.

HubSpot has two types of forms:

1. **Legacy forms**, built with the old editor.
2. **New forms**, built with the updated editor.

This page is for **legacy forms**. If your form was built with the new editor, follow [HubSpot forms (new forms)](https://docs.cometly.com/integrations/forms/hubspot.md) instead.

To check which type you have, click **Marketing > Forms** in the HubSpot menu and look at the label under each form name:

![HubSpot forms list with arrows marking a new form, labeled Form, and a legacy form, labeled Form (Legacy editor)](https://mintcdn.com/cometly/4NU5YV9iL1PADmGE/images/integrations/forms/hubspot-legacy-forms/01.webp?fit=max\&auto=format\&n=4NU5YV9iL1PADmGE\&q=85\&s=6c7a2310d13db30f41f76f2a509fc116)

> [!WARNING]
>
> This setup only works for embedded HubSpot lead capture marketing forms. It does not work for embedded meeting links where a prospect books a time.

## Step 1: Install and verify the Cometly pixel

Make sure the Cometly pixel is installed on every web page that holds one of your HubSpot marketing forms.

If you have not installed and verified the pixel yet, see [Install the Cometly pixel](https://docs.cometly.com/getting-started/install-pixel.md).

## Step 2: Test form tracking

Some HubSpot forms track without any extra work, so test the page first.

1. In Cometly, go to [**Setup** > **Install the Cometly pixel**](https://app.cometly.com/space-setup?step=install-pixel) and scroll to **Test form tracking**.
2. Under **Test a page**, pick your domain, enter the path of the page that holds your HubSpot form, and click **Test**.
3. Click **Open Page & Start Test**. Your page opens in a pop-up window.
4. Type something into every field of the form, but do not submit it. Then click **Finish test** at the top of the pop-up.

The page then appears under **Tested pages** as **Forms detected** or **Needs attention**. For more detail on the results, see [Test form tracking](https://docs.cometly.com/guides/form-tracking/testing.md).

**If your forms are tracking, you are done and do not need the steps below.**

## Step 3: Convert the HubSpot embed code in Cometly

**1. Copy the embed code from HubSpot**

Log in to HubSpot. In the left sidebar, click **Marketing > Lead Capture > Forms**.

Find the HubSpot form you want to track and click edit. On the form page, click **Share**, then **Embed code**, and copy the code.

![HubSpot Share your form dialog on the Embed code tab with the Copy button](https://mintcdn.com/cometly/4NU5YV9iL1PADmGE/images/integrations/forms/hubspot-legacy-forms/03.webp?fit=max\&auto=format\&n=4NU5YV9iL1PADmGE\&q=85\&s=91899b89211c6f4d786a5a7e2dd6716b)

**2. Open the converter in Cometly**

In Cometly, go to **Setup** > **Install the Cometly pixel** and scroll to **Test form tracking**. Click **HubSpot**, then click **Legacy Form**.

**3. Convert the code**

Paste the HubSpot embed code into the box and click **Convert Code**.

**4. Copy the converted code**

Click **Copy Converted Code**.

**5. Replace the code on your website**

Paste the converted code into the HTML embed on your landing page, in place of the HubSpot form code you had there before. Your page should contain only the converted code, not the original code from HubSpot.

With the converted code in place, the Cometly pixel captures the form fields for email, first name, last name and phone number.

## Step 4: Test form tracking again

Go back to **Setup** > **Install the Cometly pixel** > **Test form tracking**, open the page under **Tested pages** and click **Retest** (or test the page again as in step 2) to confirm your HubSpot marketing form now tracks.

If the test passes, you can continue with the rest of your setup.

## Check it worked

The page that holds your HubSpot form is listed under **Tested pages** with the green **Forms detected** status. When you click the page, the form shows **Tracking correctly**, and its email field appears under **Detected fields**.

## Frequently asked questions

### Why does Cometly say "Unrecognized script" when I convert my HubSpot embed code?

Cometly did not recognize the code you pasted as a legacy HubSpot form embed code. Most often the form was built with the new editor, so check the label under the form name in HubSpot and follow [HubSpot forms (new forms)](https://docs.cometly.com/integrations/forms/hubspot.md) if it is a new form. If it is a legacy form, copy the full embed code again from **Share** > **Embed code** and paste all of it.

### Do I need to convert the embed code for each HubSpot legacy form?

Yes. Each HubSpot form has its own embed code, and the converted code is for that one form. Repeat step 3 for every legacy form that does not pass the form tracking test.

### Does the converted code change my HubSpot form?

No. The converted code is your original HubSpot embed code with one addition: it loads Cometly's tracking script inside the form once the form is ready. It still points to the same HubSpot form.

## Next steps

* [Test form tracking on your other pages](https://docs.cometly.com/guides/form-tracking/testing.md)
* [Connect HubSpot and send its events to Cometly](https://docs.cometly.com/integrations/platforms/hubspot.md)
* [Set up HubSpot forms built with the new editor](https://docs.cometly.com/integrations/forms/hubspot.md)
* [Set up form tracking for third-party embedded forms](https://docs.cometly.com/guides/form-tracking/third-party-forms.md)
* [Troubleshoot form tracking when a form or field is not detected](https://docs.cometly.com/support/troubleshooting/form-tracking/troubleshooting-form-tracking.md)

Still have questions or need a hand? We're happy to help. Reach our team at [support@cometly.com](mailto:support@cometly.com).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.