# HubSpot form personalization and testing

Show the right form to each visitor and test which one converts best.

Forms are where most visitors convert, so a single static form rarely fits every audience. A long-form approach that works for enterprise leads can scare off self-serve users, and the field that resonates with one segment can add friction for another.

With Croct, you can show a different form to each visitor and measure which one converts best. You control the form through a [slot](/explanation/slot), so a [personalized experience](/explanation/experience/introduction) or an [AB test](/explanation/experiment) decides which form each user sees.

![Different forms](/assets/immersion/playbooks/forms.png)

## Prerequisites

Before you start, make sure you have:

- A [Croct account](https://app.croct.com/signup) with a workspace and application set up.
- A slot that stores the form to render, with the page reading the form from it. The [HubSpot forms integration tutorial](/immersion/integrations/crm/hubspot-forms#dynamically-render-the-form) walks through this.
- A [goal completed](/reference/event/types/engagement/goal-completed) event tracking for form submissions, if you want to run an AB test. The same tutorial covers [tracking submissions](/immersion/integrations/crm/hubspot-forms#track-form-submissions).

If you have not done any of these, follow the instructions on the provided links and come back here once the setup is done.

> **How this works**
>
> Because the form ID lives in a slot, you never hardcode it again. An experience or experiment changes the slot's return value, and your page renders the matching form automatically.

## Personalize the form

Use a personalized experience when you already know which form each audience should see. For example, a shorter form for returning visitors or a sales-focused form for enterprise leads.

1. **Create an experience**

   Open the [experiences page](https://app.croct.com/redirect/organizations/-organization-/workspaces/-workspace-/experiences) in the admin app and click **New experience** to create an experience.

2. **Define an audience**

   In the **Audience** tab, click **New audience** and define a criteria for the visitors who should see the alternative form.

   For example, you can target high-intent accounts coming from a campaign:

   ```cql
   campaign's source is "linkedin"
   and campaign's name matches "enterprise"
   ```

3. **Select the slot**

   Click the **Slot** tab and select the slot that holds the form, for example `hubspot-form`.

4. **Define the personalized content**

   Click the **Content** tab and set the `formId` attribute to the ID of the Hubspot form you want this audience to see.

5. **Preview and publish**

   Publish your experience or click **Preview** to see the magic happen.

## Test which form converts best

If you want to learn which form performs better before rolling it out, you can run an [experiment](/explanation/experiment) for all users or for a specific audience.

1. **Create an experience**

   Open the [experiences page](https://app.croct.com/redirect/organizations/-organization-/workspaces/-workspace-/experiences) and click **New experience**.

2. **Define an audience**

   You can target all users to test it across your entire traffic, or create an audience to narrow it down. In this case, click **New audience** on the **Audience** tab and define the segment you want to test.

   For example, you can test only on returning visitors:

   ```cql
   user is returning
   ```

3. **Select the slot**

   Click the **Slot** tab and select the slot that holds the form, for example `hubspot-form`.

4. **Set up the experiment**

   Click the **Experiment** tab, give it a name like `Form length test`, and select the `form-submission` goal to measure which form drives more submissions.

   Set the percentage of eligible users who will participate. Use 100% to include the whole audience.

5. **Define the variants**

   Create two variants and split traffic evenly between them (50/50). In the **Content** tab, set a different `formId` for each:

   - **Variant A**: the ID of your current form.
   - **Variant B**: the ID of the alternative form.

6. **Publish and read the results**

   Click **Publish** and launch the experience.

Once the experiment collects enough data, open the [Performance per Goal](/reference/analytics/experiment/widgets/performance-per-goal) widget to compare submission rates. When a variant clearly wins, apply its form to the experience and stop the experiment.

## Explore

- [Experiences](/explanation/experience/introduction): Discover what an experience is and how it works.
- [Experiments](/explanation/experiment): Learn how to compare variations and measure their impact.
